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.

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.