← The stack
STACK GUIDE · TYPESCRIPT
Data, sign in and files
One Postgres database, typed queries, sign in with roles from the start, and an audit log that records everything people and agents do.
Database
- Postgres with Drizzle ORM, migrations committed to the repo
- Seed scripts that load hundreds of synthetic US records for the demo environment
- Cloudflare D1 is fine for a day 1 demo; move to Postgres in week 1
Sign in and roles
- Better Auth with organisations, so every customer company gets its own workspace
- Roles such as admin, manager and staff checked on every server action
Audit log
- One table: who, what, when, before and after, and whether it was a person or an agent
- Shown in the admin area and exportable
Files and email
- S3 compatible storage: Cloudflare R2, Supabase Storage, or MinIO on site
- Email through the customer's own mailbox or an SMTP service; Mailpit catches test mail locally
LEARN HOW IT WORKS
Four ideas to understand.
You direct the agent, so you need these in your head. Ask the agent to teach them with your own code.
- 1Tables and relations. How rows link to each other, and why the schema is the product's skeleton.
- 2Migrations. How the database changes safely as the product grows.
- 3Sessions and roles. How the app knows who you are and what you may do.
- 4Audit trails. Why every change keeps a record of who and when.
Explain how data, sign in and files works in our product, in plain words, for someone who will direct the code but not type it. Use our own repo as the example. Cover: tables and relations, migrations, sessions and roles, audit trails. Then ask me three questions to check I understood.
ASK YOUR AGENT TO BUILD IT
A brief to start from.
Fill in the brackets with your product and paste it into your agent.
Add Drizzle with Postgres to the monorepo with tables for [entities], an audit_log table and a jobs table. Add Better Auth with organisations and the roles admin, manager and staff, and check the role in every server action. Write a seed script that creates 500 synthetic US records shaped by [source statistics]. Explain the schema before you write it.