Property Management Network — Next.js 16 (App Router), Better Auth, Drizzle ORM over PostgreSQL, Stripe, OpenAI, Resend. Includes: - Security hardening: access-control/IDOR fixes, TLS-by-default DB layer, constant-time cron auth, strict security headers, atomic AI quota gating, HTML/email output encoding, demo-backdoor disabled in production. - Superadmin dashboard at /admin (overview/MRR, server-paginated users with ban/impersonate/plan/delete, billing, platform activity + admin audit log, AI usage, system health) via the Better Auth admin plugin. - Seed/migration utility scripts under scripts/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
63 lines
2.5 KiB
Bash
63 lines
2.5 KiB
Bash
# ============================================================================
|
|
# PROPERTY MANAGEMENT NETWORK — Production Environment
|
|
# ============================================================================
|
|
# Set these in Coolify (Environment Variables). Do NOT commit real values.
|
|
#
|
|
# Build-time vs runtime:
|
|
# NEXT_PUBLIC_* are inlined into the browser bundle during `next build`, so
|
|
# they MUST also be set as Build Variables in Coolify (not just runtime).
|
|
# ============================================================================
|
|
|
|
# === DATABASE (PostgreSQL) ===
|
|
# Coolify Postgres (internal): postgres://USER:PASSWORD@<service-name>:5432/DB
|
|
DATABASE_URL=postgres://user:password@db:5432/pmn
|
|
|
|
# TLS policy (app + migrations). Default is encrypted + certificate-verified.
|
|
# disable -> no TLS. Use for Coolify's internal/private-network Postgres
|
|
# and the bundled docker-compose DB (plaintext over a private net).
|
|
# no-verify -> encrypted but unverified (self-signed certs).
|
|
# require -> encrypted + verified (managed DBs with a public CA).
|
|
# DATABASE_CA -> optional custom CA cert (PEM) when verifying.
|
|
DATABASE_SSL=require
|
|
# DATABASE_CA=
|
|
|
|
# Run pending migrations automatically when the container starts.
|
|
# Set to "false" for multi-replica deploys and run migrations as a one-off job.
|
|
RUN_MIGRATIONS_ON_START=true
|
|
|
|
# === BETTER AUTH ===
|
|
# Generate: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
|
BETTER_AUTH_SECRET=replace-with-a-64-char-hex-secret
|
|
# Public base URL of the app (no trailing slash).
|
|
BETTER_AUTH_URL=https://propertymanagement.network
|
|
|
|
# Google OAuth (optional). Redirect URI: <BETTER_AUTH_URL>/api/auth/callback/google
|
|
GOOGLE_CLIENT_ID=
|
|
GOOGLE_CLIENT_SECRET=
|
|
|
|
# === STORAGE (local disk — mount a persistent volume on this path) ===
|
|
STORAGE_DIR=/app/storage
|
|
|
|
# === STRIPE ===
|
|
STRIPE_SECRET_KEY=sk_live_xxx
|
|
STRIPE_WEBHOOK_SECRET=whsec_xxx
|
|
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_xxx
|
|
STRIPE_PRO_MONTHLY_PRICE_ID=price_xxx
|
|
STRIPE_LANDLORD_MONTHLY_PRICE_ID=price_xxx
|
|
STRIPE_LIFETIME_PRICE_ID=price_xxx
|
|
|
|
# === AI (OpenAI) ===
|
|
OPENAI_API_KEY=sk-xxx
|
|
|
|
# === EMAIL (Resend) ===
|
|
RESEND_API_KEY=re_xxx
|
|
RESEND_FROM_EMAIL=noreply@propertymanagement.network
|
|
|
|
# === APP (NEXT_PUBLIC_* — also set as Build Variables) ===
|
|
NEXT_PUBLIC_APP_URL=https://propertymanagement.network
|
|
NEXT_PUBLIC_APP_NAME=Property Management Network
|
|
|
|
# === CRON ===
|
|
# Bearer token required by the /api/cron/* and /api/follow-ups/run endpoints.
|
|
CRON_SECRET=replace-with-a-random-string
|