authentication
Authentication (Better Auth)
When to use: Sessions, sign-in/sign-up flows, OAuth, magic links, or organization context on the session.
Stack
@platform/db-postgresexposescreateBetterAuth()inpackages/platform/db-postgres/src/create-better-auth.ts, wiring better-auth with the Drizzle adapter against the shared Postgres client.- Sessions:
auth.api.getSession({ headers })→{ user, session }with typed fields. Userincludesid,email,name— use those fields directly (no assertions).
Web app helpers
- Session helpers:
apps/web/src/domains/sessions/session.functions.ts(getSession,ensureSession, etc.). - Organization context is added via the
customSessionplugin (multi-tenant product behavior).
Domain alignment
- Auth intent flows (login/signup completion) use use-cases from
@domain/authcomposed with Postgres repositories — keep policy in domain, wiring in apps.
More from latitude-dev/latitude-llm
gh-issue
Create clear, actionable GitHub issues for bugs, features, and improvements. Issues are primarily consumed by LLMs, so optimize for agent readability and actionability.
4testing
Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles.
4docs
Review the current conversation context and git changes, then persist durable repository knowledge into `dev-docs/*.md` by domain and into `AGENTS.md` for cross-cutting repo rules. Use after features, fixes, refactors, architecture changes, schema changes, or when the user mentions docs, documentation, design, architecture, business logic, conventions, or `AGENTS.md`.
4create-pr
Patterns and conventions for creating a good PR
4analyze-problem
>-
4code-style
Biome formatting, import style, strict TypeScript, naming (including React file names), or generated files.
4