32 lines
1.6 KiB
Markdown
32 lines
1.6 KiB
Markdown
## Why
|
|
|
|
The monorepo needs a single source of truth for business schema (database tables, validation rules, and shared types) that both the API and web apps can import. Currently `packages/schema` is an empty placeholder with no package.json or source files, forcing each app to duplicate type definitions and validation logic.
|
|
|
|
## What Changes
|
|
|
|
- Populate `packages/schema` with a private npm package (`@workspace/schema`) including `package.json`, `tsconfig.json`, and source entry points
|
|
- Add Drizzle ORM schema definitions for PostgreSQL (tables, relations, enums)
|
|
- Add Superstruct-based runtime validators for request/response shapes
|
|
- Export shared TypeScript types derived from both Drizzle and Superstruct definitions
|
|
- Add `packages/schema` as a workspace dependency in both `apps/api` and `apps/web`
|
|
- Update Turborepo pipeline so `schema` build runs before dependent apps
|
|
|
|
## Capabilities
|
|
|
|
### New Capabilities
|
|
|
|
- `database-schema`: Drizzle ORM table definitions, relations, and enums targeting PostgreSQL
|
|
- `validation`: Superstruct schema definitions for runtime validation of data shapes
|
|
- `shared-types`: TypeScript type exports re-exported from Drizzle and Superstruct schemas
|
|
|
|
### Modified Capabilities
|
|
|
|
None — this is the first real content in `packages/schema`.
|
|
|
|
## Impact
|
|
|
|
- `packages/schema` will get a `package.json` and build output; its contents become importable by other workspace packages
|
|
- `apps/api` and `apps/web` gain a new workspace dependency
|
|
- `turbo.json` needs no changes — `^build` already handles topological build order
|
|
- No existing code is removed or modified; this is purely additive
|