Folder Structure
Root Structure
alphacode/
├── .cursor/ # Cursor IDE rules and configuration
├── docs/ # Documentation (VitePress)
├── frontend/ # React frontend application
├── packages/ # Shared packages
├── services/ # Backend microservices
├── docker-compose.yml # Docker orchestration
├── nx.json # NX workspace configuration
├── package.json # Root dependencies
├── pnpm-workspace.yaml # PNPM workspace configuration
└── tsconfig.base.json # Base TypeScript configurationServices Structure
Each service follows the same DDD structure:
services/[service-name]/
├── src/
│ ├── domain-layer/ # Pure business logic
│ │ ├── [aggregate]/
│ │ │ ├── [aggregate].aggregate.ts
│ │ │ ├── [aggregate].events.ts
│ │ │ └── index.ts
│ │ └── shared/
│ ├── application-layer/ # Use cases
│ │ ├── [aggregate]/
│ │ │ ├── dependencies/
│ │ │ │ └── [aggregate].repository.ts
│ │ │ └── [use-case]/
│ │ │ ├── [use-case].use-case.ts
│ │ │ ├── [use-case].use-case.module.ts
│ │ │ └── index.ts
│ │ └── shared/
│ └── infrastructure-layer/ # Technical implementations
│ ├── api/
│ │ ├── controllers/
│ │ ├── dtos/
│ │ └── mappers/
│ ├── persistence/
│ │ └── prisma/
│ │ ├── repositories/
│ │ └── mappers/
│ ├── external-services/
│ ├── consumers/
│ └── events/
├── prisma/
│ └── schema.prisma
├── tests/
└── package.jsonPackages Structure
packages/
├── nest/ # Shared NestJS utilities
│ └── src/
│ ├── ddd/ # DDD base classes
│ ├── guards/ # Auth guards
│ ├── modules/ # Shared modules
│ └── utils/ # Utilities
├── models/ # Shared domain models
├── utils/ # Shared utilities
└── eslint-config/ # Shared ESLint configurationFrontend Structure
frontend/
├── src/
│ ├── api/ # API clients
│ ├── contexts/ # React contexts
│ ├── features/ # Feature modules
│ │ ├── auth/
│ │ ├── coding/
│ │ ├── document/
│ │ └── screenflow/
│ ├── routes/ # TanStack Router pages
│ ├── shared/
│ │ ├── components/ # Shared UI components
│ │ ├── constants/
│ │ ├── helpers/
│ │ └── hooks/
│ ├── App.tsx
│ └── main.tsx
├── public/
└── package.jsonKey Points
- Services are independent - Each service has its own database and domain
- Shared code in packages - Common utilities and types
- Domain layer is pure - No framework dependencies
- Infrastructure is separated - All technical details isolated