liftera-architecture

Liftera monorepo architecture patterns and best practices. Trigger: When making cross-app changes, adding new packages/apps, or deciding where code should live in the monorepo.

SKILL.md

GitHub

Liftera Architecture

Liftera is a Turborepo monorepo. The core principle: domain lives in packages/core/, apps are mere interfaces consuming compositions.

Package Layout

packages/core/           → DDD: Domain, Application, Infrastructure per feature
packages/core/composition/ → Pre-wired exports ready to consume
packages/ui/             → Shared tokens and components
packages/infrastructure/ → Shared DB, Stripe, Supabase config
apps/web/                → Next.js (interface only)
apps/mobile/             → Expo (interface only)

Architecture Rules

1. Core is framework-agnostic

packages/core/ MUST NOT import from:

  • Next.js, React, React Native, Expo
  • UI frameworks
  • HTTP client libraries
  • Any concrete infrastructure dependency

Core depends only on TypeScript, Zod, and Drizzle (for schema types).

2. Layers per Feature

Inside packages/core/<Feature>/:

Domain/       → Entities, Value Objects, repository interfaces
Application/  → Use cases (orchestrate domain + infrastructure)
Infrastructure/ → Concrete implementations (repos, external services)

Dependency rules:

  • Domain → nothing external (TS/Zod only)
  • Application → Domain
  • Infrastructure → Domain, Application (implements interfaces)

3. Composition Layer

packages/core/composition/<Feature>/ exports functions that:

  • Instantiate use cases with concrete implementations
  • Return objects/functions ready to consume from apps
  • Have NO framework dependency

4. Apps are Interfaces

  • apps/web/ and apps/mobile/ import only from @acme/core/composition/...
  • Apps contain no business logic
  • Server Actions in web consume compositions
  • Screens in mobile consume compositions

5. Project Stack

  • Supabase (auth + DB)
  • Drizzle ORM (schema, migrations)
  • Zod (validation in Domain and Application layers)
  • Gluestack UI (base components in packages/ui/)
  • Posthog (analytics)
  • Sentry (error tracking)
  • Next.js + Tailwind (web)
  • Expo + NativeWind (mobile)