refactor: Restructure monorepo to apps/server/ and apps/web/ layout
Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# Database Module
|
||||
|
||||
`src/db/` — SQLite database via better-sqlite3 + Drizzle ORM with hexagonal architecture.
|
||||
`apps/server/db/` — SQLite database via better-sqlite3 + Drizzle ORM with hexagonal architecture.
|
||||
|
||||
## Architecture
|
||||
|
||||
- **Schema**: `src/db/schema.ts` — all tables, columns, relations
|
||||
- **Ports** (interfaces): `src/db/repositories/*.ts` — 10 repository interfaces
|
||||
- **Adapters** (implementations): `src/db/repositories/drizzle/*.ts` — 10 Drizzle adapters
|
||||
- **Barrel exports**: `src/db/index.ts` re-exports everything
|
||||
- **Schema**: `apps/server/db/schema.ts` — all tables, columns, relations
|
||||
- **Ports** (interfaces): `apps/server/db/repositories/*.ts` — 10 repository interfaces
|
||||
- **Adapters** (implementations): `apps/server/db/repositories/drizzle/*.ts` — 10 Drizzle adapters
|
||||
- **Barrel exports**: `apps/server/db/index.ts` re-exports everything
|
||||
|
||||
All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.returning()` for atomic reads after writes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user