.env.example to .env and fill in the values before starting the server.
.env.example
.env.example
Variable reference
Variable details
number
default:"3000"
Port the Express server binds to. Override this when running multiple services
on the same host or deploying behind a reverse proxy.
string
default:"development"
Controls runtime behavior: logging verbosity,
.env file loading, SSL
enforcement, and migration file extension. Accepted values are
development and production.string
default:"localhost"
required
Hostname or IP address of the PostgreSQL server.
number
default:"5432"
required
TCP port PostgreSQL is listening on.
string
default:"mais-habito-db"
required
Name of the PostgreSQL database. The
.env.example uses mais_habito;
make sure the value matches the database you created.string
default:"postgres"
required
PostgreSQL role used to connect to the database.
string
required
Password for the PostgreSQL role specified in
DB_USER.string
required
Secret string used to sign and verify JWT access tokens. Must be kept
private — never commit it to version control.
string
required
Full origin URL of the frontend application (e.g.
http://localhost:5173).
This value is passed directly to the CORS middleware as the allowed origin.When
NODE_ENV is set to development, the API automatically loads
variables from a .env file at the project root via dotenv. In
production, environment variables must be injected by the host environment
(e.g. Docker, Railway, or a process manager) — the .env file is not read.
SSL for the database connection is also enabled automatically in production.