Repo layout
One Bun workspace. TypeScript strict, ESM only.
apps/app Vue 3 + Vite SPA: staff app and customer portal (/portal), Rapport shell, PWAapps/www Astro landing page (www.cemco.app)apps/docs Astro Starlight: user guide and developer docs (docs.cemco.app)workers/web cemco-web: hostname router, static assets, same-origin proxiesworkers/api cemco-api: Hono API, CrmService RPC, queue consumer, cronworkers/auth cemco-auth: better-auth, AuthService RPCworkers/mcp cemco-mcp: MCP server, codemode, MCP Apps views hostworkers/agents cemco-agents: Agents (Durable Objects), Workflows, email handlerpackages/core constants, Zod schemas, business rules, the operation registry, typed clientpackages/db D1 migrations, seed data, typed query helperspackages/ui Rapport kit CSS/JS (unchanged) + Cemco tokens, fonts and shared stylespackages/views MCP Apps in-chat views (Lit), each built to one HTML fileprototype/ the earlier static prototypes, kept for referencedocs/ requirements (PRD, prototype handoff, screenshots) and the design contractscripts/ setup, dev and deploy scriptsInside the API Worker
Section titled “Inside the API Worker”workers/api/src app.ts Hono routes: /v1/ops/:name, /v1/ops, /v1/openapi.json, /v1/me, documents, calendar feed, invites index.ts default export (fetch, queue, scheduled) and the CrmService entrypoint framework/ dispatch (roles, validation, customer scoping, audit), actor mapping, signing, OpenAPI handlers/<group>.ts one file per operation group events.ts queue consumers (status emails, alerts)workers/api/test Vitest in workerd with a real local D1Packages
Section titled “Packages”@cemco/corehas no runtime dependencies besides Zod and never touches storage. Import from subpaths (@cemco/core/constants,/schemas,/rules,/operations,/errors,/auth,/client) to keep bundles small.@cemco/db: migrations inpackages/db/migrations, the seed builder inpackages/db/scripts, and helpers:mapRow,insertStatement,updateStatement, theWherebuilder,nextSequence,ftsQuery,reindexSearch.@cemco/ui:import "@cemco/ui/styles.css"for fonts, kit, tokens and Cemco additions;setTheme,toggleThemeandBRANDfrom@cemco/ui. Thekit/files are the unmodified Rapport kit; a test checks their hash.
Conventions
Section titled “Conventions”- Money is integer cents, dates are ISO 8601 text, ids are UUIDs (
crypto.randomUUID()). - The API is camelCase; the database is snake_case.
- New packages use caret ranges, never exact pins.
- No React. Vue in the app, Lit in the views, Astro for www and docs.
- No secrets in the repo. Each Worker documents its settings in
.dev.vars.example.