Skip to content

Environment Config

All runtime configuration in Folio is supplied through environment variables. This page documents every variable used across the project.


API environment (/.env at repo root)

Sourced from apps/api/.env.example. The API reads this file via dotenv.

Required

VariableExampleDescription
DATABASE_URLpostgresql://folio:folio@localhost:5432/folioPostgreSQL connection string
JWT_SECRETchange-me-in-production-32chars+Secret for signing access tokens
REFRESH_TOKEN_SECRETanother-secret-different-from-jwtSecret for signing refresh tokens

CORS

VariableExampleDescription
CORS_ORIGINShttp://localhost:4200,https://yourdomain.comComma-separated list of allowed origins

Email (SMTP)

VariableExampleDescription
SMTP_HOSTlocalhostSMTP server hostname
SMTP_PORT1025SMTP server port
SMTP_USER(empty for Mailhog)SMTP username
SMTP_PASS(empty for Mailhog)SMTP password
SMTP_FROMnoreply@folio.localFrom address for outgoing email
SMTP_SECUREfalseUse TLS (true in production)

External book/author APIs

VariableRequiredProvider
GOOGLE_BOOKS_API_KEYOptionalGoogle Books
ISBNDB_API_KEYOptional (paid)ISBNdb
ISBNDB_BASE_URLOptionalISBNdb base URL override
WORLDCAT_WSKEYOptional (paid)WorldCat
WORLDCAT_BASE_URLRequired if using WorldCatWorldCat API base URL
OPENLIBRARY_DEBUGOptionalLogs raw OpenLibrary responses

File uploads

VariableRequiredDescription
UPLOADTHING_SECRETRequired for uploadsUploadthing secret key
UPLOADTHING_APP_IDRequired for uploadsUploadthing app ID

Runtime

VariableDefaultDescription
NODE_ENVdevelopmentSet to production in prod
PORT3000API port
ENABLE_SWAGGER_IN_PRODUCTION(unset)Set to true to expose Swagger in prod

Web environment (apps/web/.env)

Sourced from apps/web/.env.example. Vite exposes these as import.meta.env.*.

VariableExampleDescription
VITE_API_URLhttp://localhost:3000API base URL

In production, set this to your actual API domain (e.g. https://api.yourdomain.com).


Mobile environment (apps/mobile/app.json)

The mobile app reads configuration from apps/mobile/app.json under expo.extra:

json
{
  "expo": {
    "extra": {
      "apiUrl": "http://localhost:3000"
    }
  }
}

For Android emulators, use http://10.0.2.2:3000 instead of localhost.

For production, change apiUrl to your production API URL before building.


CI/CD secrets (GitHub Actions)

SecretUsed byDescription
CPANEL_FTP_HOSTcd-cpanel.ymlFTP host for cPanel deployment
CPANEL_FTP_USERNAMEcd-cpanel.ymlFTP username
CPANEL_FTP_PASSWORDcd-cpanel.ymlFTP password
CPANEL_API_REMOTE_PATHcd-cpanel.ymlRemote path for API deploy
CPANEL_WEB_REMOTE_PATHcd-cpanel.ymlRemote path for Web deploy

Security checklist for production

  • [ ] JWT_SECRET is 32+ random characters (generate with openssl rand -hex 32)
  • [ ] REFRESH_TOKEN_SECRET is different from JWT_SECRET
  • [ ] DATABASE_URL points to a restricted user (not a superuser)
  • [ ] CORS_ORIGINS lists only your actual frontend URL
  • [ ] NODE_ENV=production is set
  • [ ] ENABLE_SWAGGER_IN_PRODUCTION is not set (keeps API docs internal)
  • [ ] SMTP credentials are for a real mail provider (not Mailhog)

Deployment → · Testing →

Released under the MIT License.