TypeScript monorepo guidance for LLM Agents
- TypeScript: Strict configuration across all packages for type safety
- Naming:
@xstack/*(platform packages),@infra/*(infrastructure services) - State Management: Use Effect-Atom for reactive React components
- Data Layer: SQLite for local storage, Effect for sync operations
- Testing:
@xstack/testingutilities required for all packages - Imports: Path aliases defined in tsconfig (e.g.,
@xstack/lib) - Style: Functional programming, immutable data structures
- infra: Infrastructure packages (@infra/*)
- packages: Platform libraries (@xstack/*)
- apps: Applications
- docs: Documentation
toaster: Toast notification componentsrouter: Routing utilitiesi18n: Internationalization supportform: Form handling and validationserver: Server utilities and middlewaredb: Database abstractions for both frontend SQLite and backend databasesevent-log: Event sourcing and logging for local-first synclib: Core utility functionsfx: Effect-TS utilitiesatom-react: Effect & React state management like jotaiapp: Application frameworkapp-kit: Application development kituser-kit: User management utilities
- web: Frontend applications
- server: Backend services and APIs (cloudflare workers)
- mobile: React Native/Expo applications
- shared: Shared libraries and utilities
- client: Pure client business logic shared across all apps
- emails: Email templates and services
Nx is our primary development orchestrator, managing 50+ packages and applications with intelligent caching, dependency tracking, and parallel execution.
nx show projects # List all projects
nx serve <project> # Start development server
nx app-build <project> # Build applications
nx app-deploy <project> # Deploy applications
nx typecheck <project> # Type checking
nx test <project> # Run tests
nx madge <project> # Check circular dependencies
nx db <project> --configuration=seed # seed, push, dump, execute, dev, reset, deploy
nx run-many -t <target> -p "apps-*" # All application
nx run-many -t <target> -p "*-web" # All web apps
nx run-many -t <target> --all # All projects
nx run-many -t test --exclude="*-e2e" # Exclude patterns
nx run-many -t typecheck --parallel=4 # Control parallelism
nx affected -t <target> # Only changed projects
nx affected -t <target> --base=main # Changed from main branch- Always run from monorepo root
- Always prefer
nx affectedovernx run-many --allfor efficiency. ll` for efficiency.