Saltar al contenido principal

Configuration reference

Memship is configured through environment variables, typically set in a .env file next to docker-compose.yml. Copy .env.example to .env and adjust. This page documents every setting the backend reads.

Minimum for production: change SECRET_KEY and DB_PASSWORD, set IMAGE_TAG to a released version, and configure email.

Security

VariableDefaultDescription
SECRET_KEYchange-me-in-productionChange this. Signing key for auth tokens. Use a random 64-char string.
ACCESS_TOKEN_EXPIRE_MINUTES30Access token lifetime in minutes.

Database

VariableDefaultDescription
DB_PASSWORDmemshipChange this. PostgreSQL password used by Compose.
DATABASE_URLpostgresql://memship:memship@localhost:5433/memship_dbFull connection string. In Compose it points at the db service.

Application

VariableDefaultDescription
APP_ENVdevelopmentSet to production for deployments. Affects debug behaviour and API docs exposure.
APP_VERSION(from image / git tag)Baked into the image at build time; leave unset when running published images.
DEFAULT_LOCALEesDefault interface language: es, ca, or en.
CORS_ORIGINShttp://localhost:3000Comma-separated list of allowed browser origins. Set to your site URL(s).
FRONTEND_URLhttp://localhost:3000Public URL of the frontend; used in email links.
BACKEND_PUBLIC_URLhttp://localhost:8003Publicly reachable backend URL for payment-provider callbacks (e.g. Redsys Ds_Merchant_MerchantURL). In production this must be the external hostname the gateway can POST to.

Ports

Set in .env for the Compose stack (defaults shown in .env.example):

VariableDefaultDescription
HTTP_PORT80Caddy HTTP port.
HTTPS_PORT443Caddy HTTPS port.
API_PORT8003Direct backend API port.
DB_PORT5433PostgreSQL host port.

Email

Email is disabled unless either a Resend API key or an SMTP host is set. See Email delivery for a full walkthrough.

Resend (preferred, managed delivery):

VariableDefaultDescription
RESEND_API_KEY(empty)Enables Resend delivery.
RESEND_FROM_EMAIL(empty)Verified sender address.

SMTP (self-hosted alternative):

VariableDefaultDescription
SMTP_HOST(empty)Enables SMTP delivery when set.
SMTP_PORT587SMTP port.
SMTP_USER(empty)SMTP username.
SMTP_PASSWORD(empty)SMTP password.
SMTP_FROM[email protected]From address.
SMTP_TLStrueUse STARTTLS.

If both are configured, Resend takes precedence.

Background jobs (Celery / Redis)

VariableDefaultDescription
CELERY_BROKER_URLredis://localhost:6379/0Redis broker for async email, recurring billing, reminders. Redis is included in the Compose stack.

The worker and scheduler (Celery beat) run as part of the stack and power async emails, scheduled fee generation, and payment reminders.

File storage

VariableDefaultDescription
STORAGE_LOCAL_PATHstorageLocal path for uploads (logos, activity images, PDFs). Mounted as a Docker volume — include it in backups.
MAX_UPLOAD_SIZE_MB10Maximum upload size in megabytes.

Server

VariableDefaultDescription
HOST0.0.0.0Bind address of the backend.
PORT8000In-container backend port.

Migrations

VariableDefaultDescription
RUN_MIGRATIONS(set to 1 in Compose)When 1, the backend runs database migrations on startup. See Upgrading.