FFlockbaseDocs

Deployment & Infrastructure

Production hosting on Railway, DNS configuration, environment variables, and Resend domain setup.

This document outlines the deployment topology, cloud infrastructure, and configuration settings required to run Flockbase in production.


Production Topology (Railway)

Flockbase is designed to run on Railway as four interconnected services:

                          ┌───────────────────────────┐
                          │   Railway Cloud Project   │
                          └─────────────┬─────────────┘

           ┌────────────────┬───────────┴───────────┬────────────────┐
           ▼                ▼                       ▼                ▼
     PostgreSQL        Core API               Web Dashboard    Documentation
      Database         (NestJS)               (Vite React)      (Fumadocs)
     pg-standard     api.flockbase.live     flockbase.live    docs.flockbase.live

Domain Architecture

DomainService TargetPurpose
flockbase.livechurch-app/frontendMain web dashboard for administrators, leaders, and workers.
docs.flockbase.livedocsPublic Fumadocs documentation engine.
notifications.flockbase.liveResend DNS (TXT / CNAME)Transactional email sending subdomain for invites and credentials.
api.flockbase.livechurch-app/backendNestJS REST API server.

Environment Variables Reference

Backend (church-app/backend)

VariableRequired in ProdDescriptionExample
DATABASE_URLYesPostgreSQL connection string.postgresql://user:pass@host:5432/db
JWT_SECRETYesSecret key for signing access tokens.super-secret-hex-string
TERMII_API_KEYYesAPI key from Termii developer dashboard.tlv_s5d_...
TERMII_SENDER_IDYesApproved alphanumeric SMS sender tag.Flockbase
RESEND_API_KEYYesResend API key for dispatching emails.re_123456789...
RESEND_FROM_EMAILYesSender email address.noreply@notifications.flockbase.live
APP_BASE_URLYesBase URL for generated invite & login links.https://flockbase.live
NODE_ENVYesSet to production in live environments.production

In development environments, leave TERMII_API_KEY unset. The backend automatically switches to local OTP stubbing and includes devOtpCode in login responses, saving SMS credits.

Documentation (docs)

The documentation site is a standard Next.js application:

  • Root Directory: docs
  • Build Command: npm run build
  • Start Command: npm run start
  • Port: 3000

Resend Email DNS Configuration

To send transactional emails from notifications.flockbase.live:

  1. In the Resend Dashboard, add domain notifications.flockbase.live.
  2. In your DNS provider (e.g., Cloudflare, Namecheap, Route53), configure:
    • SPF (TXT): Points to v=spf1 include:resend.com ~all
    • DKIM (CNAME): Configures cryptographic signing records provided by Resend.
  3. Inbound Receiving: As this domain is dedicated strictly to outbound transactional notifications (worker invitations and admin credentials), inbound email routing and MX receiving are not required.

On this page