Documentation
Foundation architecture
Kaosin ships as a single deployable app on the edge. Boundaries are enforced by layer, so each upcoming module drops into its own feature folder without reshaping what exists.
Layers
- src/routes
- Transport. Pages plus /api/v1 and /api/public handlers. No business rules.
- src/features/<feature>
- Feature-owned UI, services, repositories and types behind a barrel export.
- src/core
- Errors, logging and the Service / Repository contracts every feature builds on.
- src/db
- Connection layer and Drizzle schema root. Only repositories import it.
- src/config
- zod-validated server and client environment.
- src/types
- Global contracts: API envelopes, roles, pagination.
Module roadmap
Namespaces are registered up front. GET /api/v1 returns this list at runtime.
- /api/v1/authSessions, sign in, sign outplanned
- /api/v1/workspacesTeams and membershipplanned
- /api/v1/projectsDesign projectsplanned
- /api/v1/designsGenerated apparel designsplanned
- /api/v1/assetsUploads and object storageplanned
- /api/v1/exportProduction-ready exportsplanned
- /api/v1/billingPlans, credits, invoicesplanned
- /api/v1/marketplacePublic template marketplaceplanned
Migrations
No tables exist yet. Schema files land in src/db/schema/, are re-exported from src/db/schema.ts, and every create-table change ships with its grants and row-level security policies in the same migration.