This repository has been archived on 2026-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
wedding-app/.env.example
Claude 00baf9bd89
feat: full Docker stack on a VPS with improved admin editing
Self-hosted rewrite of the wedding photo app: Node + Hono replaces
Cloudflare Workers, Postgres 16 replaces D1, MinIO replaces R2,
Caddy fronts the stack with automatic Let's Encrypt TLS. Same routes
and feature set as before; storage abstraction is the same S3 client
so MinIO drops in without code changes.

Architecture:
- docker-compose.yml: postgres, minio, minio-init (creates bucket +
  anonymous read + CORS), app, caddy (reverse proxy + media subdomain).
- Dockerfile: multi-stage pnpm build, single runtime image serving
  the API and the SPA dist as static assets from one process.
- Caddyfile: primary domain proxies to app; media subdomain proxies
  to MinIO so guests upload directly and signatures match Host.
- app: tsx runtime, runs SQL migrations idempotently at startup via
  a schema_migrations(name, sha256, applied_at) table.

Admin upgrades requested:
- PATCH /api/admin/uploads/:id to edit author/message.
- POST /api/admin/uploads/bulk for bulk approve/reject/delete.
- POST /api/admin/uploads/:id/cover and DELETE /api/admin/event/cover
  to set/clear a featured image (rendered on Home when set).
- GET /api/admin/uploads gains ?q= text search across author and
  message and ?kind=photo|video filter.
- Dashboard: bulk select checkboxes with a toolbar, edit modal that
  rewrites author and message, search input, kind filter, set-cover
  button per item, cover preview + clear in the event card.

Singletons replace the per-request bindings pattern: initDb() and
initStorage() run once in server.ts; routes call getDb()/getStorage()
directly rather than threading env.DB / env.MEDIA through.

env.ts uses zod to parse process.env and fails fast if anything
mandatory is missing. .env.example documents every variable and
flags the hairpin tradeoff for MinIO access from the app container.
2026-06-07 22:11:10 +00:00

35 lines
1.4 KiB
Plaintext

# =============================================================================
# Edite essas variáveis e salve como .env (mesmo diretório do docker-compose.yml)
# =============================================================================
# ----- Domínios (apontar DNS A/AAAA pra IP do VPS antes do `docker compose up`)
DOMAIN=casamento.exemplo.com.br
MEDIA_DOMAIN=midia.exemplo.com.br
ACME_EMAIL=voce@exemplo.com
# ----- Postgres
POSTGRES_USER=wedding
POSTGRES_PASSWORD=troque-isso-por-uma-senha-forte
POSTGRES_DB=wedding
# ----- MinIO (root credentials = também usadas pelo app como S3 access keys)
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=troque-isso-por-uma-senha-forte
S3_BUCKET=wedding-media
S3_REGION=us-east-1
# Endpoint INTERNO usado pelo app pra falar com o MinIO. Use o do Caddy
# (https://${MEDIA_DOMAIN}) — necessário porque a assinatura S3 inclui o host
# e o browser faz upload direto pra MEDIA_DOMAIN. Hairpin via DNS público é OK.
# Pra evitar hairpin, ajuste extra_hosts no compose pra resolver MEDIA_DOMAIN
# pra IP interno e set S3_INTERNAL_ENDPOINT=http://minio:9000 (avançado).
S3_INTERNAL_ENDPOINT=
# ----- App
COUPLE_NAMES=Stefanie & Leandro
EVENT_DATE=07 de junho de 2026
# ----- Admin (painel dos noivos)
ADMIN_PASSWORD=senha-forte-compartilhada-entre-os-dois
SESSION_SECRET=gere-um-uuid-longo-aqui-min-32-chars
ALLOWED_ADMIN_EMAILS=voce@exemplo.com,outro@exemplo.com