Reference
Reference: backend sources
Reference: backend sources
DDD + Hexagonal (Clean Architecture)
Source
- Skill:
.agents/skills/clean-ddd-hexagonal/SKILL.mdandreferences/
Relevant rule
- Dependencies point inward:
interfaces->application->domain;infrastructureimplementsdomainports. domain/has no framework/DB/transport dependencies. Behavior lives inside entities (no anemic models). One repository per aggregate. Keep controllers thin. One aggregate per transaction; cross-aggregate consistency via events.
Project decision
apps/api/src/{domain,application,infrastructure,interfaces}.Tripis the aggregate root;Stop,TripMember,Expenseare contained.MoneyandSettlementPlanare value objects. Vote/comment/expense/split rules live in the domain.- Repository ports live in
domain/*/ports; PostgreSQL adapters implement them ininfrastructure/persistence. See ../backend/domain.md.
Hono
Source
- Skill retrieval + Better Auth docs (Context7
/better-auth/better-auth). - Upstream: https://hono.dev
Relevant rule
- Framework-agnostic web framework running on Node, Workers, etc. Better Auth
mounts as
app.on(["POST","GET"], "/api/auth/*", (c) => auth.handler(c.req.raw)).
Project decision
- Hono is the
interfaces/httpadapter. The same app is served by a Node entry (@hono/node-server) for Docker and a Workersfetchentry for Cloudflare. Routes parse input, call use cases, and format responses. See ../backend/api/README.md.
Better Auth
Source
- Skill:
.agents/skills/better-auth-best-practices/SKILL.md - Context7
/better-auth/better-auth - Upstream: https://better-auth.com/docs
Relevant rule
betterAuth({ database, emailAndPassword, trustedOrigins, ... }). Accepts apg.Pooldirectly.BETTER_AUTH_SECRET(>= 32 chars) andBASE_URLvia env. Node:toNodeHandler(auth); Web/Workers:auth.handler(request). Run the CLI migrate/generate after config or plugin changes.
Project decision
- Config in
infrastructure/auth/auth.tsusing apg.Poolfrom the shared database module,emailAndPassword.enabled, andtrustedOriginsfrom env. Mounted on Hono at/api/auth/*. Auth tables are created by SQL migration so the same schema applies to Docker Postgres and Hyperdrive-fronted Postgres. See ../backend/auth.md.
PostgreSQL
Source
node-postgres(pg): https://node-postgres.com- Prototype seed data (members, days, stops, expenses).
Relevant rule
- Use a pooled client. On Cloudflare Workers, external Postgres must be reached through Hyperdrive with Node.js compatibility enabled.
Project decision
- A single
pg.Poolfactory backs both Better Auth and repositories. Node readsDATABASE_URL; Workers read the Hyperdrive binding'sconnectionString. Plain SQL migrations inapps/api/migrations. See ../backend/database.md.