Reference

Environment variables

Every setting a generated project reads: what it does, what it ships with, and what goes wrong when it is wrong. 187 of them, in the order your .env lists them, plus the ones it does not list because the default in code is what almost everybody wants. Each has its own link, so anything can point at one exactly: /docs/reference/environment#JWT_SECRET.

Your .env is a list of settings and their defaults, with one header per section and no prose. The explanations are here, where they can be searched and linked, rather than in a 591-line file that has to be scrolled past every time somebody changes a port.

Two labels matter when you are reading an entry. Commented out means the line is in your file with a # in front of it: delete that and it takes effect. Not in .env means the file does not mention it at all and the default is in the code, so add the line yourself to change it.

App

What the app calls itself and where it answers. APP_ENV is the one to get right: unset means production, which is the strict reading of every other setting here.

APP_NAME= <project>#
What the app calls itself, in page titles, generated mail and the admin's own header.
APP_ENV= development#
development or production. Unset means production, the strict one: rate limits on, the WAF blocking, GORM Studio and /docs off, and a default or short secret stops the server from starting.
SEED_ADMIN_PASSWORDemptycommented out#
The password grit seed gives admin@example.com. Unset, APP_ENV=development seeds admin123 and four demo accounts; any other APP_ENV refuses to seed the admin without a password of twelve or more characters, and skips the demo accounts.
API_DOCS_PUBLIC= false#
Serve the API reference at /docs in production as well. It maps every route and has a console that calls them, so it is off there unless you say so.
APP_PORT= 8080#
The port the API listens on. A platform that routes to a container injects PORT instead, and PORT wins where both are set, so a deploy binds what the platform is actually sending traffic to.
APP_URL= http://localhost:8080#
Where this API answers, as the outside world reaches it. Links in generated mail, local file URLs and the OAuth callbacks are all built from it, so a wrong value produces links that resolve to nothing. Change it whenever you change APP_PORT.
PORTemptynot in .env#
Set by the platform, not by you: a host that routes to a container injects it, and it wins over APP_PORT, so a deploy binds the port traffic is actually arriving on.
IMPORT_CONCURRENCY= 4not in .env#
How many spreadsheet imports may run at once. Each one holds a parsed file in memory, so this is the limit that keeps a bulk import from taking the process down.

Database

Which engine the project talks to. Only the block for the provider you pick is read, so the others can stay exactly as they are.

DB_PROVIDER= postgres#
Which engine this project talks to: postgres (the default, and what docker-compose starts), mysql (MySQL 8 or MariaDB), sqlite (one file, pure Go, no CGO) or memory (SQLite in RAM, empty at every boot, for tests and demos). Picked by grit new --db, and changeable here at any time.
DATABASE_URLemptycommented out#
A connection string that wins over the POSTGRES_* settings above. Use it for an external Postgres such as Neon, Supabase or RDS, or for SQLite: sqlite:./app.db for the pure-Go driver, sqlite::memory: for a database that is gone on restart.
DATABASE_REPLICA_URLSempty#
Read replicas, comma separated. Empty, and it should stay empty until the database's CPU is pegged by reads after the indexes are right: a replica is money spent on a problem you may not have. Set it and reads go to the replicas on the next boot, with writes, anything in a transaction, and the few seconds after a person writes staying on the primary. No code changes.
ALLOW_SQLITE_IN_PRODUCTION= falsenot in .env#
Lets APP_ENV=production run on SQLite. Refused without it: one file with one writer is not what a deployment wants, and finding out under load is expensive.
DB_LOG_LEVEL= warnnot in .env#
info logs every statement with its timing, silent logs none. Worth info while you are chasing a query, and never in production, where it writes your data into the log.
DB_PREPARED_STATEMENTS= falsenot in .env#
Caches a prepared statement per query shape. Faster on a direct connection, and wrong behind a transaction-pooling pgbouncer, which is why it is off.
DB_SKIP_DEFAULT_TRANSACTION= falsenot in .env#
GORM wraps every single write in its own transaction. Turning that off is measurably faster and gives up the guarantee that a write with hooks either all happened or none did.

Postgres: read when DB_PROVIDER=postgres

docker-compose.yml reads these same values through ${VAR}, so the server and the client cannot drift apart. The password is generated per scaffold, which is why grit migrate works on a fresh project with nothing edited.

POSTGRES_USER= grit#
The Postgres role the app connects as.
POSTGRES_PASSWORD= generated per project#
Generated per scaffold, so a new project migrates without anything being edited first. docker-compose.yml reads the same value, so the server and the client cannot disagree.
POSTGRES_DB= <project>#
The database name, defaulting to the project's own name.
POSTGRES_HOST= localhost#
Where Postgres is. localhost for the container docker-compose starts; a hostname for a managed one.
POSTGRES_PORT= 5434#
The host port Postgres answers on. 5434 rather than the default 5432 avoids collisions with another project; the container still listens on 5432 inside the Docker network, which is why docker-compose.prod.yml puts it back for traffic between containers.
POSTGRES_SSLMODE= disable#
require or verify-full for a managed Postgres that insists on TLS.

MySQL: read when DB_PROVIDER=mysql

Nothing in docker-compose.yml starts MySQL, so these point at a server you run.

MYSQL_USER= grit#
The MySQL user the app connects as.
MYSQL_PASSWORD= grit#
The password for MYSQL_USER. Nothing in docker-compose.yml starts MySQL, so this points at a server you run.
MYSQL_DB= <project>#
The database name, defaulting to the project's own name.
MYSQL_HOST= localhost#
Where MySQL is.
MYSQL_PORT= 3306#
MySQL's port, 3306 unless you moved it.

SQLite: read when DB_PROVIDER=sqlite

One file, the pure-Go driver, no CGO and no server. Add the path to .gitignore.

SQLITE_PATH= ./app.db#
The database file, relative to apps/api. Add it to .gitignore.

Docker host ports

What docker-compose binds on your machine. Every Grit project defaults to the same numbers, so the second one you start fails with "port is already allocated": change them here and compose binds them, while the API builds its Postgres, Redis and MinIO addresses from them. Only the host side moves. Inside the compose network the services keep their standard ports.

REDIS_PORT= 6380#
The host port docker-compose binds Redis on, and where the API looks unless REDIS_URL is set.
REDIS_PASSWORD= generated per project#
The production Redis (docker-compose.prod.yml) takes this password. The development one has none.
MAILHOG_SMTP_PORT= 1025#
The port Mailhog takes mail on. Development mail goes here, and nothing leaves your machine.
MAILHOG_UI_PORT= 8025#
Where to read the mail Mailhog caught, in a browser.
MINIO_PORT= 9002#
MinIO's S3 API port on this machine. The API builds its MinIO endpoint from it unless MINIO_ENDPOINT is set.
MINIO_CONSOLE_PORT= 9003#
MinIO's own web console, for looking in the bucket.
MINIO_BIND_ADDRESS= 127.0.0.1#
Which interface MinIO's API port answers on. 127.0.0.1 keeps it to this machine; 0.0.0.0 opens it to your LAN, which an Expo app on a phone needs to load uploaded images. The root credentials are then the only thing between that network and the bucket.

Connection pools

Each API process opens one pool for the app and one for Sentinel, and every replica does the same against one max_connections, 100 on a default Postgres. Size them so (DB_MAX_OPEN_CONNS + SENTINEL_DB_MAX_OPEN_CONNS) x replicas stays under max_connections - 10. The defaults fit three replicas. Behind pgbouncer, Postgres sees only pgbouncer's own pool size.

DB_MAX_OPEN_CONNS= 25commented out#
How many connections the app's pool may open. Lower it only if your queries are heavy enough to saturate the database, where a smaller pool acts as admission control and the queueing happens in the app instead of thrashing in Postgres.
DB_MAX_IDLE_CONNS= 25commented out#
How many of those connections stay open between queries. Defaults to the open limit, because a lower number closes connections under load and Postgres forks a new backend for every one reopened.
SENTINEL_DB_MAX_OPEN_CONNS= 5commented out#
The same limit for Sentinel's own pool, which is separate from the app's and counts against the same max_connections.
SENTINEL_DB_MAX_IDLE_CONNS= 5commented out#
How many of Sentinel's connections stay open between queries.

Tokens and keys

What signs a session and what encrypts a column. API keys are not here: they are created from the admin at /system/api-keys, sent as X-API-Key or a bearer token, and act as the user who created them.

JWT_SECRET= generated per project#
Signs the tokens. Generated at scaffold time; rotate with openssl rand -hex 32, which signs everybody out.
FIELD_ENCRYPTION_KEY= generated per project#
Encrypts two-factor secrets and every crypto.EncryptedString column, AES-256-GCM with 32 bytes in base64. Back it up with the database but not in the same place: losing it locks every two-factor user out and leaves encrypted columns unreadable, and changing it does the same. Generate one per environment with openssl rand -base64 32.
AUDIT_CHAIN_KEYemptycommented out#
Keys the activity log's hash chain with HMAC-SHA256. Unset it derives from JWT_SECRET, which is why it is commented out: a project gets a keyed chain without setting anything. Set it when the chain should outlive a JWT_SECRET rotation, or when the two should be held by different people. Unkeyed, the chain is a plain SHA-256 over values anybody can read: somebody with database write access edits a row, re-links what follows it, and verification passes.
JWT_ACCESS_EXPIRY= 15m#
How long an access token is good for. Short on purpose: the refresh token is what keeps somebody signed in, and it can be revoked.
JWT_REFRESH_EXPIRY= 168h#
How long a refresh token lasts, which is how long somebody stays signed in without typing a password. Every refresh rotates it, and a reused one revokes the whole session.
JWT_ISSUERempty#
Who minted a token and who it is for. Written into every token and checked on every token that carries them, so a token from staging is refused by production even if they share a secret. Safe to turn on at any time: tokens already issued carry neither and keep working until they expire.
JWT_AUDIENCEempty#
Who the token is for, checked on every token that carries it. Set it with JWT_ISSUER.
JWT_PRIVATE_KEYempty#
Asymmetric signing, for when another service has to verify these tokens. With a shared secret, every service that can verify can also mint, so one compromised service can forge an administrator token for all of them. Set a private key and the API signs RS256 and publishes only the public half at /.well-known/jwks.json, which verifies and cannot sign. Generate one with openssl genrsa -out jwt-private.pem 2048, then point at the file or paste the PEM inline.
JWT_PREVIOUS_PUBLIC_KEYempty#
During a rotation, the public half of the key you are retiring, so the tokens it signed stay verifiable until they expire instead of everybody being signed out at the moment of the switch. Remove it once one refresh lifetime has passed. Get it with openssl rsa -in jwt-private-old.pem -pubout.

OAuth and social login

A provider's credentials, and where the links in generated mail point. Both URLs default to development origins, and in a split-domain deployment a wrong one is a customer landing on the operator's console with nothing saying so.

GOOGLE_CLIENT_IDempty#
The Google OAuth client id, from the Google Cloud console under APIs and services, Credentials.
GOOGLE_CLIENT_SECRETempty#
The secret half of the Google OAuth pair, from the Google Cloud console.
GITHUB_CLIENT_IDempty#
The GitHub OAuth app's client id, from Settings, Developer settings, OAuth Apps.
GITHUB_CLIENT_SECRETempty#
The secret half of the GitHub pair.
SOCIAL_AUTH_ENABLED= false#
Whether the Google and GitHub buttons render. The OAuth routes stay registered either way. Off by default because no provider is configured yet, and a button with no provider fails with "no provider for google exists".
OAUTH_FRONTEND_URL= http://localhost:3001#
The origin for the links the API mails out: verify your email, reset your password, finish signing in with a provider. The default is the admin's port, because in development that is the app you are signed into. In a split-domain deployment that default is wrong and nothing will say so: the mail sends successfully and the customer lands on the operator's console.
GRIT_WEB_URL= https://app.example.comcommented out#
Where an invitation link points, when the multitenant plugin is installed. Falls back to the web app's development origin, which has the same failure as OAUTH_FRONTEND_URL and for the same reason: an invited colleague is not an operator and should not be sent to the admin.
OAUTH_NATIVE_REDIRECTS= <project>://callback#
Deep links the OAuth callback may send a sign-in code to, comma separated, for the mobile app. A browser gets HttpOnly cookies and a redirect; a native client cannot use those, so the callback redirects to the app with a one-time code it swaps for tokens. An allowlist and not a pattern, deliberately: a callback that redirects wherever redirect_uri says, carrying a sign-in code, is an account takeover. Empty means no native sign-in.

Sign-in protection

Four layers, from counting to barring. Sentinel rate-limits by address; the lockout here protects one account from attempts spread across many addresses. Only wrong passwords on real accounts count, because otherwise anybody could lock an address they guess. When an account locks its owner is emailed a reset link, and completing the reset clears the lock: nothing to configure, but without a mailer a locked-out user waits out the window instead.

LOGIN_MAX_ATTEMPTS= 10#
Wrong passwords before an account locks. 0 disables the lockout. Only wrong passwords on real accounts count: an unknown email never locks anything, or anyone could lock an address they guess.
LOGIN_LOCKOUT_MINUTES= 15#
How long an account stays locked after LOGIN_MAX_ATTEMPTS wrong passwords.
PASSWORD_BREACH_CHECK= false#
Check a chosen password against the public breach corpus, on registering, changing and resetting. Off by default because it calls a third party. k-anonymity: the password is hashed here and only the first five characters of the hash are sent, so the service never learns which password was asked about. It fails open, so an outage there cannot stop people signing up.
SENTINEL_TURNSTILE_SECRETempty#
The sign-in shield's challenge tier, between "let it through" and "bar this address". Set one of these and it starts working; leave them empty and the tier stays dormant.
SENTINEL_HCAPTCHA_SECRETempty#
An hCaptcha secret, as an alternative to Turnstile for the sign-in challenge.
SENTINEL_RECAPTCHA_SECRETempty#
A reCAPTCHA secret, as another alternative. Set one of the three, not all.
SENTINEL_LOCKOUT_EXEMPT_IPSempty#
Egress addresses or CIDRs a sign-in lockout never bars: your office, your VPN, a customer's corporate NAT. Behind one of those an address is hundreds of people, and barring it bars all of them. They are still counted, still throttled, and still subject to the (address, account) lockout, so this loosens the blunt control and not the precise one.
SENTINEL_AUTOBLOCK_EXEMPT_IPSempty#
Addresses or CIDRs auto-block never bars. Ten high-severity threats from one address inside ten minutes bars it for a day, which is a scanner and not a customer, but put your own monitoring and any partner that probes you here. Left empty this follows SENTINEL_LOCKOUT_EXEMPT_IPS, because both answer the same question.
SECURITY_AUTO_BAN= true#
The scheduled ban sweep, on outside development. Sentinel's own auto-block catches a burst; this catches the scanner patient enough to stay under it, counting each address's high-severity threats over a window. Loopback and private addresses are never banned, whatever they do, because behind a proxy you have not told Sentinel to trust they are where all your users appear to come from.
SECURITY_AUTO_BAN_MIN_THREATS= 3#
How many high-severity threats an address may raise inside the window before the sweep bans it. A threshold to exceed: at 3, the ban lands on the fourth.
SECURITY_AUTO_BAN_WINDOW_HOURS= 24#
How far back the sweep counts an address's threats.
AUTO_BAN_INTERVAL_HOURS= 6#
How often the sweep runs.
SECURITY_AUTO_BAN_PERMANENT= true#
A ban with no end, until somebody lifts it from the Security page. Set false and a ban lasts a week instead.
REQUIRE_EMAIL_VERIFICATION= false#
Require a confirmed email address before a password sign-in is accepted. Leave it false on an existing project: every current user has a NULL email_verified_at and would be locked out the moment you switch it on.

Redis

Unset, the API connects to localhost on REDIS_PORT, so moving the port moves the connection with it.

REDIS_URL= redis://localhost:6380commented out#
An external Redis, or empty to run without one at all: cache, background jobs and cron then stay off instead of retrying a dial in a loop. Unset, the API connects to localhost on REDIS_PORT.
REDIS_HOST= localhostnot in .env#
Where Redis is, when REDIS_URL is unset. The URL is built from this and REDIS_PORT.

Frontend origins

Where the browser reaches the API and the admin. Baked into the Next.js bundles at build time, so changing one means building again.

API_URL= http://localhost:8080#
Where the browser reaches the API. Baked into the Next.js bundles at build time, so a change needs a rebuild.
NEXT_PUBLIC_ADMIN_URL= http://localhost:3001#
Where the admin panel answers. It is a URL only when the panel is its own application: in a double it is a route inside the web app, which already knows the path, and in a single there is no Next.js app to read it. Set it when you move the panel to an origin of its own.

Storage: local, minio, s3, r2, b2

Where uploads go. local keeps them in a folder the API serves from APP_URL/files, with no bucket, no Docker and nothing else to run. Outside production a MinIO that is not answering falls back to local on its own and says so in the log, so a new project takes uploads before Docker is running; production never falls back.

STORAGE_DRIVER= minio#
Which storage provider is live: local, minio, s3, r2 or b2. Only that driver's settings are read.
ALLOW_LOCAL_STORAGE_IN_PRODUCTION= truecommented out#
Lets STORAGE_DRIVER=local run in production, for one server with the directory on a volume that is backed up. Without it, production refuses to start on the local driver.
STORAGE_LOCAL_ROOT= storage/appcommented out#
Where the local driver keeps files, relative to apps/api.
STORAGE_URL_SECRETemptycommented out#
Signs the local driver's temporary URLs. Unset, JWT_SECRET is used.
STORAGE_PUBLIC_PREFIXES= uploads/,thumbnails/commented out#
Key prefixes anyone may read without a signed link, comma separated. Every other key, backups included, is private: S3 and MinIO enforce it with the bucket policy, the local driver with its file route. R2 and B2 have no bucket policies, so there a bucket is public or not whatever the key: keep private files in a private bucket and serve them with a temporary URL.
STORAGE_DISKS= backupscommented out#
Named disks, such as a private bucket for backups, which use a disk named backups when there is one. Each takes STORAGE_DISK_<NAME>_* settings, and anything unset comes from that driver's own settings.
STORAGE_DISK_BACKUPS_BUCKETemptycommented out#
The bucket for the disk named backups. Every named disk takes the same set: DRIVER, BUCKET, ENDPOINT, ACCESS_KEY, SECRET_KEY, REGION, PUBLIC_URL and ROOT, and anything unset falls back to that driver's own settings.
UPLOADS_CONFIDENTIAL= truecommented out#
Uploaded files are customer content: with this on, an administrator reads none of them, the owner reads their own, and a holder of uploads.confidential reads all of them with every read recorded in the activity log. It also removes uploads/ from the public prefixes, because hiding the rows while the files stayed readable by URL would be no protection at all.
STORAGE_PUBLIC_URLempty#
The browser-facing origin for whichever driver is live. A per-driver setting (S3_PUBLIC_URL, R2_PUBLIC_URL, B2_PUBLIC_URL, MINIO_PUBLIC_URL) wins over this one. Leave it empty for MinIO in development, which serves objects from the same host it takes API calls on.
NEXT_PUBLIC_STORAGE_UPLOAD_URL= https://<account>.r2.cloudflarestorage.comcommented out#
The host presigned PUTs go to, when it is not the host files are served from. It is added to the frontend's connect-src and nothing else. A managed bucket usually does this, serving reads from its own CDN and signing writes for the underlying S3 endpoint, and the symptom is an upload the API signs happily and the browser refuses with a console violation and no HTTP status.
CLAMAV_ADDRemptynot in .env#
A ClamAV daemon, as host:port, to scan every upload before it is stored. Empty means the built-in check only: the magic bytes, the declared type and the extension have to agree.
CLAMAV_FAIL_OPEN= falsenot in .env#
What happens when ClamAV cannot be reached. False refuses the upload, which is the safe reading of "I do not know what this file is".
UPLOAD_ALLOWED_MIMEemptynot in .env#
The only content types to accept, comma separated. Empty accepts whatever the per-field rules allow.
UPLOAD_BLOCK_SUSPICIOUS= falsenot in .env#
Refuse an upload whose bytes disagree with its name, rather than storing it under the quarantine prefix. On, a disguised file never reaches the bucket.
UPLOAD_QUARANTINE_PREFIX= quarantine/not in .env#
Where a suspicious upload goes instead of its normal key. Nothing serves from this prefix, so the file is kept for a look rather than thrown away.

MinIO: read when STORAGE_DRIVER=minio

The local development bucket, started by docker-compose. The credentials are generated per scaffold and compose reads the same pair.

MINIO_ENDPOINT= http://localhost:9002commented out#
Unset, built from MINIO_PORT above. Set it only for a MinIO somewhere else.
MINIO_ACCESS_KEY= generated per project#
Generated per scaffold. docker-compose.yml gives MinIO the same pair, so the bucket and the API agree with no editing.
MINIO_SECRET_KEY= generated per project#
The secret half of the MinIO pair, generated per scaffold.
MINIO_BUCKET= <project>-uploads#
The bucket uploads go into, created on first use.
MINIO_REGION= us-east-1#
A region name MinIO does not use but the S3 protocol requires.
MINIO_USE_SSL= false#
Whether to talk to MinIO over HTTPS. False for the local container, true for a MinIO behind a certificate.
MINIO_HOST= localhostnot in .env#
Where MinIO is, when MINIO_ENDPOINT is unset. The endpoint is built from this and MINIO_PORT.
MINIO_PUBLIC_URLemptynot in .env#
The browser-facing origin for MinIO, when it is not the host the API signs against. Falls back to STORAGE_PUBLIC_URL.

AWS S3: read when STORAGE_DRIVER=s3

The keys fall back to the standard AWS ones, so an IAM role attached to your EC2, ECS or Lambda needs nothing set here.

S3_ENDPOINTempty#
Leave it empty for the AWS regional default. It falls back to AWS_ENDPOINT_URL, which is what the AWS SDKs read and what a managed bucket injects, so attaching one needs nothing set here.
S3_ACCESS_KEYempty#
An AWS access key. It falls back to AWS_ACCESS_KEY_ID, and S3_SECRET_KEY to AWS_SECRET_ACCESS_KEY, so an IAM role attached to your EC2, ECS or Lambda needs nothing set here.
S3_SECRET_KEYempty#
The secret half. Falls back to AWS_SECRET_ACCESS_KEY.
S3_BUCKETempty#
The bucket uploads go into. Falls back to AWS_BUCKET.
S3_REGION= us-east-1#
The bucket's region. Falls back to AWS_REGION.
S3_PUBLIC_URLempty#
Optional: a CloudFront or CDN domain, or the bucket's own https://<bucket>.s3.<region>.amazonaws.com if it is public.
AWS_BUCKETemptynot in .env#
What S3_BUCKET falls back to. It is what the AWS SDKs read and what a managed bucket injects, so attaching one needs nothing set here.
AWS_ENDPOINT_URLemptynot in .env#
What S3_ENDPOINT falls back to, for the same reason as AWS_BUCKET.
AWS_REGIONemptynot in .env#
What S3_REGION falls back to.

Cloudflare R2: read when STORAGE_DRIVER=r2

R2_PUBLIC_URL is required for images to display: the endpoint is the S3 API host and answers only signed requests, so an img tag pointed at it gets a 401 while uploads keep succeeding. R2 also needs a CORS rule for the presigned upload: your admin and web origins, GET and PUT, any header, and ETag exposed.

R2_ENDPOINTempty#
The R2 S3 API host, which is the account endpoint and not the bucket. It answers only signed requests, which is why images need R2_PUBLIC_URL as well.
R2_ACCESS_KEYempty#
An R2 access key, from the Cloudflare dashboard under R2, Manage API tokens.
R2_SECRET_KEYempty#
The secret half of the R2 pair.
R2_BUCKETempty#
The R2 bucket uploads go into.
R2_REGION= auto#
Always auto for R2.
R2_PUBLIC_URLempty#
Required for images to display, because the endpoint above answers only signed requests: an image tag pointed at it gets a 401, so uploads succeed and nothing renders. Get a public origin by enabling r2.dev on the bucket (Settings, Public Development URL) or binding a custom domain, then paste it here without the bucket name on the end.

Backblaze B2: read when STORAGE_DRIVER=b2

The S3-compatible endpoint for your bucket's region, and an application key.

B2_ENDPOINTempty#
The Backblaze S3-compatible endpoint for your bucket's region.
B2_ACCESS_KEYempty#
A B2 application key id.
B2_SECRET_KEYempty#
The application key itself.
B2_BUCKETempty#
The B2 bucket uploads go into.
B2_REGION= us-west-004#
The region in the endpoint, such as us-west-004.
B2_PUBLIC_URLemptynot in .env#
The browser-facing origin for the B2 bucket. Falls back to STORAGE_PUBLIC_URL.

Email

How mail is sent, and who it is from. Left empty, a real RESEND_API_KEY means Resend, and development sends to Mailhog and saves to storage/mail when Mailhog is not running. Production refuses MAIL_MAILER=log unless you say otherwise.

MAIL_MAILERemptycommented out#
How mail is sent: smtp, resend, mailgun, postmark, sendgrid, ses, log or failover. Left empty, a real RESEND_API_KEY means Resend, and development sends to Mailhog and saves to storage/mail when Mailhog is not running.
MAIL_ALLOW_LOG_IN_PRODUCTION= truecommented out#
Lets MAIL_MAILER=log run in production, where mail is written to the log instead of sent. Refused without it, because a deployment that quietly stops sending mail looks like one that is working.
RESEND_API_KEY= re_your_api_key#
A Resend API key. A real one is also what makes Resend the mailer when MAIL_MAILER is unset.
MAIL_FROM= noreply@<project>.dev#
The address generated mail is sent from. It has to be on a domain the provider has verified, or everything is rejected.
MAIL_FROM_NAMEempty#
The name beside that address in an inbox. Empty uses the project name.
MAIL_FAILOVER= smtp,logcommented out#
An ordered list of mailers to try when MAIL_MAILER=failover, such as smtp,log. The first that accepts the message wins.
MAIL_LOG_PATH= storage/mailnot in .env#
Where MAIL_MAILER=log writes messages instead of sending them. Also where development mail lands when Mailhog is not running, so you can read what the app sent with nothing installed.

SMTP: read when MAIL_MAILER=smtp

Unset, this is Mailhog on localhost.

SMTP_HOST= localhostcommented out#
The SMTP server. Unset, this is Mailhog on localhost.
SMTP_PORT= 1025commented out#
The SMTP port. Unset it is Mailhog's.
SMTP_USERNAMEempty#
The SMTP account.
SMTP_PASSWORDempty#
Its password.
SMTP_ENCRYPTIONempty#
tls, starttls or none. Empty means tls on port 465, none on localhost and starttls everywhere else.

Mailgun: read when MAIL_MAILER=mailgun

The sending domain and key from the Mailgun dashboard.

MAILGUN_DOMAINempty#
The sending domain you verified with Mailgun.
MAILGUN_SECRETempty#
The Mailgun sending key.
MAILGUN_ENDPOINT= api.mailgun.net#
api.mailgun.net, or api.eu.mailgun.net for a domain in the EU.

Postmark: read when MAIL_MAILER=postmark

A server token, and which stream to send on.

POSTMARK_TOKENempty#
The Postmark server token.
POSTMARK_MESSAGE_STREAM= outbound#
Which Postmark stream to send on. outbound is the transactional one.

SendGrid: read when MAIL_MAILER=sendgrid

An API key with Mail Send permission.

SENDGRID_API_KEYempty#
A SendGrid API key with Mail Send permission.

Amazon SES: read when MAIL_MAILER=ses

SES API v2, with the usual AWS keys.

AWS_SES_REGION= us-east-1#
The SES region, which has to be one where your sending identity is verified.
AWS_ACCESS_KEY_IDemptycommented out#
The standard AWS key, read by SES and used as the fallback for S3_ACCESS_KEY. Leave both empty on an instance with an IAM role.
AWS_SECRET_ACCESS_KEYemptycommented out#
The secret half of the standard AWS pair.
SUPPORT_EMAILempty#
Where a ticket opened in /system/support is emailed, when a mailer is configured. Leave it empty in development to skip sending.
AWS_SESSION_TOKENemptynot in .env#
The third part of a temporary AWS credential, which is what an assumed role gives you. Leave it empty for a long-lived key pair.

CORS

Browser origins allowed to call the API. The Wails desktop webview needs no entry: its origin varies by platform and build, so the middleware matches the wails.localhost host on any port instead.

CORS_ORIGINS= http://localhost:3000,http://localhost:3001#
Browser origins allowed to call the API, comma separated.

GORM Studio

The database browser at /studio. It reads and edits every table, so its password is generated per scaffold, and in production it stays off whatever GORM_STUDIO_ENABLED says, because this file gets copied to servers whole.

GORM_STUDIO_ENABLED= true#
Whether Studio is mounted at /studio. In production it stays off whatever this says: see GORM_STUDIO_IN_PRODUCTION.
GORM_STUDIO_USERNAME= admin#
The username for Studio's own sign-in, which is separate from your app's.
GORM_STUDIO_PASSWORD= generated per project#
Generated per scaffold, because Studio reads and edits every table.
GORM_STUDIO_READ_ONLY= false#
Lets Studio browse but not change anything. Worth turning on anywhere real data lives.
GORM_STUDIO_DISABLE_SQL= false#
Removes Studio's SQL editor, leaving the table browser.
GORM_STUDIO_IN_PRODUCTION= false#
Turns Studio on in production, read-only and with no SQL editor. It is off there whatever GORM_STUDIO_ENABLED says, because this file gets copied to servers whole.

Optional modules

Grit ships every battery enabled. Switch one off and it mounts no routes, starts no workers, creates no tables and disappears from the admin nav. The code stays in the repo. All default to true, so leaving these unset changes nothing.

MODULE_AI= true#
The AI endpoints, the gateway client and the admin page for them.
MODULE_JOBS= true#
Background jobs: the queue, the workers and the admin page for them.
MODULE_CRON= true#
Scheduled jobs and the schedule page.
MODULE_BACKUP= true#
Database backups, the schedule for them and the restore command.
MODULE_WEBHOOKS= true#
Outbound webhooks, their delivery log and the retry schedule.
MODULE_REALTIME= true#
The websocket hub, channels and presence.
MODULE_FILES= true#
Uploads, image processing and the files page.
MODULE_MAIL= true#
Mail sending, the templates and the preview page.
MODULE_AUDIT= true#
The activity log and its hash chain.
MODULE_FLAGS= true#
Feature flags and the page for toggling them.
MODULE_TWOFACTOR= true#
Two-factor sign-in, recovery codes and the enrolment screens.
MODULE_SSO= false#
Enterprise SSO, OIDC and SAML: the one module that defaults to false. It mounts four public endpoints, one of which parses a signed assertion, so most projects leave it off until they need an IdP.
AUDIT_RETENTION_DAYSemptynot in .env#
How long activity log entries are kept before the nightly job deletes them. Empty keeps them forever, which is the right default for a log whose point is that it is complete.
GRIT_USER_CACHE= onnot in .env#
Caches the signed-in user's row for a few seconds, so a burst of requests from one person is one read. Set it to off to read the row on every request, which is what you want when another system is editing users behind the app.

AI

One key, hundreds of models, through the Vercel AI Gateway.

AI_GATEWAY_API_KEYempty#
A Vercel AI Gateway key, from vercel.com/docs/ai-gateway/authentication-and-byok/api-keys.
AI_GATEWAY_MODEL= anthropic/claude-sonnet-5.5#
Which model to call, in provider/model form. The default needs paid credits, and a free-tier key is refused with AI_FORBIDDEN rather than a billing error.
AI_GATEWAY_URL= https://ai-gateway.vercel.sh/v1#
The gateway's base URL. Change it to point at a different OpenAI-compatible gateway.

Two-factor authentication

What an authenticator app shows beside the account.

TOTP_ISSUER= <project>#
The name shown beside the account in an authenticator app, so somebody with codes for six systems can tell which is yours.

OpenTelemetry tracing

Off until an endpoint is set. With one, every request, database query, cache lookup, outgoing HTTP call and queued job is a span, and the trace goes wherever you point it: Sentry, Grafana, Jaeger, Honeycomb, Datadog.

OTEL_EXPORTER_OTLP_ENDPOINTemptycommented out#
Where to send traces, such as http://localhost:4318. Nothing is traced until this is set.
OTEL_SERVICE_NAMEemptycommented out#
The name this service appears under in the trace viewer. Defaults to APP_NAME.
OTEL_TRACES_SAMPLER_ARGemptycommented out#
What fraction of requests to trace, 0.0 to 1.0. 1.0 in development, 0.1 otherwise.

Pulse

The performance dashboard at /pulse. It refuses to mount in production with its default password, which is why the value here is generated at scaffold time.

PULSE_ENABLED= true#
Whether Pulse is mounted at /pulse. It is the performance dashboard: requests, queries, jobs and the slowest of each.
PULSE_USERNAME= admin#
The username for Pulse's own sign-in.
PULSE_PASSWORD= generated per project#
Generated per scaffold. Pulse refuses to mount in production with its default password, so a generated value is what lets production start.
PULSE_PROFILING= false#
Pulse's runtime profiles: heap, allocations, mutex, block and CPU, served as standard pprof so "go tool pprof http://host/pulse/api/profile/heap" works. Two switches on purpose, this one and PULSE_PROFILE_ENABLED in the server's own environment, because a profile leaks the shape of your code and one forgotten setting should not be enough to expose it.
PULSE_MUTEX_PROFILE_FRACTION= 0#
Samples what is contended, which nothing else here can answer. It costs the runtime a little while on, so it stays 0 until you are looking; 100 is a common starting point.
PULSE_BLOCK_PROFILE_RATE= 0#
Samples goroutines blocked on a channel or a lock. Costs a little while on, so it stays 0 until you are looking; 10000 is a common starting point.
PULSE_EXPLAIN_SLOW_QUERIES= false#
Ask the database for the plan behind a slow SELECT and show it on Pulse's Database page. Off by default because it issues extra read-only queries. EXPLAIN only, never EXPLAIN ANALYZE, so the slow query is never run a second time.
PULSE_STORAGE= memorynot in .env#
Where Pulse keeps what it records: memory loses it on restart, sqlite keeps it. Worth sqlite on a deployment, where the interesting request happened an hour ago.
PULSE_STORAGE_DSN= pulse.dbnot in .env#
The SQLite file for PULSE_STORAGE=sqlite, relative to apps/api.

Sentinel

The WAF, the rate limits and the threat log, at /sentinel. Same as Pulse: it refuses to mount in production with default credentials, and the secret key needs at least 32 bytes of entropy.

SENTINEL_ENABLED= true#
Whether Sentinel is mounted. Like Pulse, it refuses to start in production with default credentials, which is why the password and the secret key below are generated per project.
SENTINEL_USERNAME= admin#
The username for Sentinel's dashboard.
SENTINEL_PASSWORD= generated per project#
Generated per scaffold, for the same reason as Pulse's.
SENTINEL_SECRET_KEY= generated per project#
Signs Sentinel's own session cookies and needs at least 32 bytes of entropy. Generated per scaffold.
SENTINEL_AUDIT_KEY= generated per project#
Keys the security audit log's hash chain, so an entry edited by somebody with database access but not this key fails verification. Keep it: entries written under one key verify only with that key.
TRUSTED_PROXIES= 127.0.0.0/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7commented out#
The reverse proxies whose X-Forwarded-For and X-Forwarded-Proto the API believes, as addresses or CIDRs. Unset trusts loopback and the private ranges, which covers a proxy on this machine or on the Docker network. "none" trusts no proxy. Behind a CDN that connects to the API directly, list its ranges.
SENTINEL_TRUSTED_PROXIESemptynot in .env#
The proxies Sentinel itself believes, which defaults to whatever TRUSTED_PROXIES says. Set it only when the WAF sits behind something the app does not.

Theme

The visual identity of the auth pages and the dashboard. Mirrored to the frontends at build time so a server component renders the right theme with no flash of the wrong one.

THEME= atlas#
The visual identity for the auth pages and the dashboard: atlas (split-screen, team, Inter), aurora (centered, consumer SaaS, Geist) or pulse (split-screen with a carousel, ecommerce, Onest and DM Serif). Mirrored into NEXT_PUBLIC_THEME for the Next.js apps at build time.
VITE_THEME= atlas#
The same value where a Vite app can see it. Vite exposes only VITE_-prefixed variables to client code, so without this a TanStack project read undefined and fell back to atlas: an emerald dashboard behind an indigo sign-in screen. Next.js projects ignore it.

A setting that is not here

Two kinds are deliberately absent. API keys are created from the admin at /system/api-keys and have no setting at all. And a plugin brings its own: installing one writes its settings into .env and .env.example, empty, each under a comment saying where to get it.