A full-featured monorepo using Turborepo + SvelteKit 2 with domain-driven design.
# Prerequisites: Node.js >= 18, npm >= 10, Docker/Podman
git clone [email protected]:thebrianbug/svelte-turbo-starter.git
cd svelte-turbo-starter
npm install
npm run dev
- 📦 Turborepo + SvelteKit 2
- 🎨 Tailwind CSS + TypeScript
- 🗄️ Drizzle ORM + PostgreSQL
- 🧪 Vitest + Playwright
- 🏗️ Domain-driven design architecture
- Set up e2e tests according to README
- Users CRUD UI
- Svelte-Clerk auth
- Storybook
- Tailwind v4 (issue)
# Start development
npm run dev
npm run build # Build all
npm run lint # Lint/format
# Testing
npm test # Run all tests
npm run test:e2e # E2E only
# Database
npm run docker:up # Start PostgreSQL
npm run docker:down # Stop PostgreSQL
.
├── apps/
│ ├── docs/ # Documentation
│ └── web/ # Main app
└── packages/
├── bll/ # Business logic
├── db/ # Database layer
├── ui/ # Shared UI
└── config/ # Tooling configs
-
Models (
db/src/models/
)- Entities and value objects
- Aggregate roots
- Rich domain models
-
Services (
bll/src/domains/
)- Business rules
- Aggregate coordination
-
Repositories (
db/src/repositories/
)- Data access patterns
- Transaction handling
-
DB Layer (
db/
)- DatabaseError wrapping
- Data validation
- Operation context
-
BLL Layer (
bll/
)- Domain-specific errors
- Business validation
- Error mapping
-
Shared Layer (
shared/
)- Base error types
- Error serialization
- Error metadata
- Transaction-based with rollback
- Factory function services
- Domain-organized structure
- Next to source files
- ts-mockito for mocking
- TDD principles
- Full workflow testing
- Playwright-based
- Automatic cleanup
npm run build npm run preview # Preview the built applications
The project uses TypeScript for static type checking:
- Run
npm run check
to verify types across all projects - TypeScript configuration is shared through the
typescript-config
package - Each app and package has its own
tsconfig.json
that extends the shared config - Database schema types are automatically generated by Drizzle ORM
When using AI coding assistants like GitHub Copilot or Claude, provide this system context for optimal code generation:
Tech Stack:
- Frontend: Svelte 5 (Svelte 5 syntax only) + TypeScript, Vite v6, TailwindCSS v3
- Backend: PostgreSQL with Docker/Podman, Drizzle ORM
- Architecture: Domain-driven design, Modular structure (UI, BLL, DB layers)
- Testing: Vitest for unit/integration, Playwright for E2E
- Quality: TypeScript v5, ESLint (security, promise, sonar, unicorn plugins), Prettier with Svelte plugin
- Node.js >=18, NPM 10
Testing Notes:
- ts-mockito is used for mocking in unit tests
- Follow TDD principles: write tests first, then implementation
- Place unit tests next to source files with .test.ts extension
- E2E tests go in the tests/ directory of each app
Note: See the scripts for additional utility scripts to help with LLM.
This project is licensed under the MIT License - see the LICENSE file for details.
- Ensure you have the prerequisites installed
- Fork and clone the repository
- Install dependencies:
npm install
- Create a branch for your changes
- Make your changes
- Run tests:
npm run test
- Submit a pull request