The ORM is Drizzle. The schema lives at apps/backend/src/db/schema.ts, the client at apps/backend/src/db/index.ts, and committed migrations under apps/backend/drizzle/.
Clerk is the source of truth for users and organizations. Postgres mirrors only what domain tables need to reference. Add columns only when something actually needs them.

Tables

organizations

Mirrors a Clerk org into Postgres so jobs and applications can reference it.
ColumnTypeNotes
idserial PK
clerkOrgIdtextUnique; links back to Clerk.
nametext
slugtextUnique; the {slug}.trexi.ai board subdomain.
createdAttimestamptz

jobs

ColumnTypeNotes
idserial PK
organizationIdint FKorganizations.id, cascade on delete.
slugtextUnique within the org.
titletext
descriptiontextDefaults to "".
locationtextOptional.
employmentTypetextOptional.
statusenumdraft | open | closed.
createdAttimestamptz
updatedAttimestamptz

job_applications

ColumnTypeNotes
idserial PK
jobIdint FKjobs.id, cascade on delete.
nametext
emailtext
coverLettertextOptional.
resumeUrltextOptional.
statusenumnew | reviewing | rejected | hired.
createdAttimestamptz

Migration workflow

Edit the schema → pnpm db:generate → review the generated SQL → pnpm db:migrate. Use pnpm db:push only for throwaway dev iteration.