Files
temetro/backend/.env.example
T
Claude 9dabe2f5d2 Add TypeScript + Express + Postgres backend with Better Auth
Implements the first temetro backend: an Express 5 API on Postgres via
Drizzle ORM, with authentication and multi-tenant clinics powered by
Better Auth.

- Auth: email/password with required email verification, password reset,
  rate limiting, CSRF/trusted-origins, secure cookies, session audit hook.
- Organizations (clinics) with RBAC (owner/admin/member/viewer) and an
  extended `patient` permission set; member invitations by email.
- Org-scoped patient records mirroring the frontend Patient shape, with
  CRUD endpoints gated by permission (read/write/delete).
- Email helper logs links to the console when SMTP is unset (zero-setup
  local dev); Dockerfile + docker-compose (db + backend + frontend) with
  migrations applied on startup and a configurable Postgres host port.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 21:27:32 +03:00

31 lines
1.4 KiB
Bash

# --- Database -------------------------------------------------------------
# When running via docker compose, "db" is the Postgres service hostname.
# For running the backend directly on your host, use localhost:5432.
DATABASE_URL=postgres://temetro:temetro@db:5432/temetro
# --- Better Auth ----------------------------------------------------------
# Generate a strong secret (min 32 chars): openssl rand -base64 32
BETTER_AUTH_SECRET=replace-me-with-openssl-rand-base64-32
# Public base URL of THIS backend (used for auth callbacks & cookies).
BETTER_AUTH_URL=http://localhost:4000
# --- App ------------------------------------------------------------------
# The frontend origin — used for CORS, Better Auth trustedOrigins, and the
# links embedded in verification / reset / invitation emails.
FRONTEND_URL=http://localhost:3000
PORT=4000
NODE_ENV=development
# Host port Postgres is published on by docker compose. Change it if 5432 is
# already in use on your machine (the app still talks to Postgres internally).
POSTGRES_PORT=5432
# --- Email (optional) -----------------------------------------------------
# If SMTP_HOST is unset, emails (verify/reset/invite) are printed to the
# server console instead of being sent — zero setup for local development.
# SMTP_HOST=smtp.example.com
# SMTP_PORT=587
# SMTP_USER=
# SMTP_PASS=
# SMTP_FROM="temetro <no-reply@temetro.local>"