Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Paramount-Intelligence/HR_Monitoring_System/llms.txt

Use this file to discover all available pages before exploring further.

Workforce OS is configured entirely through environment variables, loaded by Pydantic Settings (pydantic-settings) from the process environment or an .env file. This page documents every variable grouped by functional area. Variables marked Required in production will cause a startup RuntimeError if absent or left at an insecure default when APP_ENV=production.
Never copy a local .env file verbatim into Railway. Set only the variables each service needs. Backend secrets (database credentials, SMTP passwords, VAPID keys) must never appear on the Frontend service.

App Core

VariableTypeDefaultDescription
APP_ENVstringdevelopmentRuntime environment. Set to production on Railway to enable production-safety guards. Accepted values: development, dev, local, test, production.
APP_HOSTstring0.0.0.0Host interface the API server binds to. Leave as 0.0.0.0 for Railway.
APP_PORTinteger8000Local port the API listens on. Railway overrides this with the injected $PORT variable via the Procfile.
APP_SECRET_KEYstringchange-me-in-envRequired in production. Secret used to sign JWT access and refresh tokens. Generate with openssl rand -hex 32. The API refuses to start if this is left at any known-insecure default (changeme, secret, etc.) when APP_ENV=production.
Only APP_SECRET_KEY is used to sign JWTs. Do not set SECRET_KEY or JWT_SECRET_KEY — those variables are not read by the codebase.

Authentication

VariableTypeDefaultDescription
ACCESS_TOKEN_EXPIRE_MINUTESinteger15Lifetime of the short-lived JWT access token in minutes. Recommended production value: 120.
REFRESH_TOKEN_EXPIRE_DAYSinteger7Lifetime of the long-lived refresh token in days. Recommended production value: 30.
ONLINE_PRESENCE_TTL_SECONDSinteger90A user is considered online if a heartbeat was received within this window (seconds). Stored in Redis.
AUTH_LOGIN_MAX_ATTEMPTSinteger5Maximum failed login attempts allowed before the account is rate-limited.
AUTH_LOGIN_WINDOW_SECONDSinteger900Sliding window (seconds) for counting failed login attempts.
AUTH_FORGOT_PASSWORD_MAX_ATTEMPTSinteger3Maximum forgot-password requests per window.
AUTH_FORGOT_PASSWORD_WINDOW_SECONDSinteger900Sliding window (seconds) for forgot-password rate limiting.
AUTH_RESET_PASSWORD_MAX_ATTEMPTSinteger5Maximum password-reset requests per window.
AUTH_RESET_PASSWORD_WINDOW_SECONDSinteger900Sliding window (seconds) for password-reset rate limiting.

Database

The API resolves its PostgreSQL connection in two ways: directly from DATABASE_URL, or constructed from the individual PG* component variables. Both are supported, and Railway provides them automatically when the Postgres service is linked.
VariableTypeDefaultDescription
DATABASE_URLstring(none)Required. Full PostgreSQL connection string, e.g. postgresql://user:pass@host:5432/dbname. Railway injects this as ${{Postgres.DATABASE_URL}}. A postgres:// scheme is normalised to postgresql:// automatically. SQLite URLs are rejected.
DATABASE_PUBLIC_URLstring(none)Public-facing PostgreSQL URL. Used as a fallback when DATABASE_URL contains an unresolved Railway template placeholder.
PGHOSTstring(none)PostgreSQL host. Used to construct DATABASE_URL when DATABASE_URL is not set directly.
PGUSERstring(none)PostgreSQL user.
PGPASSWORDstring(none)PostgreSQL password.
PGDATABASEstring(none)PostgreSQL database name.
PGPORTstring5432PostgreSQL port.
The database must be created with UTF-8 encoding to support emoji and Unicode characters in message fields. Railway’s provisioned Postgres uses UTF-8 by default. For self-managed databases: CREATE DATABASE your_db WITH ENCODING 'UTF8' TEMPLATE template0 LC_COLLATE='C' LC_CTYPE='C';

Redis

VariableTypeDefaultDescription
REDIS_URLstringredis://localhost:6379/0Full Redis connection URL. Railway injects this as ${{Redis.REDIS_URL}} when the Redis service is linked. Used by Celery as its message broker.

Frontend & CORS

These variables control how the API identifies and communicates with the Next.js frontend.
VariableTypeDefaultDescription
FRONTEND_BASE_URLstringhttp://localhost:3000Required in production. The canonical URL of the deployed Next.js app. Used in email links and for CORS resolution. Must be an https:// URL in production.
CORS_ORIGINSstring* (dev only)Required in production. Comma-separated list of allowed frontend origins, e.g. https://your-app.up.railway.app. Wildcards (*) are rejected in production — the API refuses to start without explicit origins. FRONTEND_BASE_URL must appear in this list.
Frontend service variables (Next.js — set before build):
VariableTypeDescription
NEXT_PUBLIC_APP_NAMEstringDisplay name baked into the client bundle. Example: Workforce Intelligence & Execution OS.
NEXT_PUBLIC_API_URLstringFull URL of the Backend API’s /api/v1 prefix, e.g. https://<api>.up.railway.app/api/v1. Baked in at build time.
NEXT_PUBLIC_WS_URLstringWebSocket URL pointing to the API, e.g. wss://<api>.up.railway.app/api/v1/ws. Must point at the API host, not the frontend.
API_PROXY_URLstringServer-side proxy target for local development. Example: http://localhost:8080/api/v1. Not needed on Railway.

Email / SMTP

All SMTP variables are optional. When SMTP_HOST is unset, transactional emails (password-reset links, notifications) are silently disabled.
VariableTypeDefaultDescription
SMTP_HOSTstring(none)SMTP server hostname, e.g. smtp.gmail.com.
SMTP_PORTinteger587SMTP port. Use 587 for STARTTLS or 465 for SSL.
SMTP_USERstring(none)SMTP authentication username (also accepted as SMTP_USERNAME).
SMTP_PASSWORDstring(none)SMTP authentication password or app-specific password.
SMTP_TLSbooleanTrueEnable STARTTLS. Also accepted as SMTP_USE_TLS.
EMAILS_FROM_EMAILstring[email protected]From-address for outbound emails (also accepted as SMTP_FROM_EMAIL).
EMAILS_FROM_NAMEstringWorkforce OSDisplay name for the From header (also accepted as SMTP_FROM_NAME).

Bootstrap Admin

The backend seeds a default admin user on first startup if the email does not already exist in the database.
VariableTypeDefaultDescription
BOOTSTRAP_ADMIN_EMAILstring[email protected]Email address of the auto-created admin account.
BOOTSTRAP_ADMIN_PASSWORDstringchange-this-passwordRequired in production. Initial password for the bootstrap admin. The API refuses to start in production if this is left at change-this-password, changeme, or password. Change this after the first login.
BOOTSTRAP_ADMIN_NAMEstringHR AdminDisplay name of the bootstrap admin user.
BOOTSTRAP_ADMIN_PASSWORD is provided as plain text for the initial setup only. Change it immediately after the first successful login via the user profile settings page. The production startup validator will reject the default value.

Storage — Profile Images

VariableTypeDefaultDescription
PROFILE_IMAGE_STORAGEstringlocalStorage driver for profile pictures. Accepted: local, s3, railway_bucket, railway. Use s3 with the S3 variables configured below for production.
PROFILE_IMAGE_UPLOAD_DIRstringstorage/profile-picturesLocal filesystem path for profile picture uploads when using the local driver. Use a mounted Railway volume in production or switch to s3.
PROFILE_IMAGE_PUBLIC_BASE_URLstring(none)Public URL prefix for serving locally stored profile images.

Storage — Call Recordings

VariableTypeDefaultDescription
CALL_RECORDINGS_STORAGE_DRIVERstringlocalStorage driver for call recording uploads. Accepted: local, s3, railway_bucket, railway. railway_bucket and railway are aliases for s3.
CALL_RECORDINGS_LOCAL_DIRstringstorage/call-recordingsLocal filesystem path for call recording files when using the local driver. Use a mounted Railway volume or switch to s3 for persistent production storage.
CALL_RECORDINGS_MAX_UPLOAD_MBinteger100Maximum upload size for a single call recording file, in megabytes.

S3 / Object Storage

Used for call recordings and profile images when the storage driver is set to s3. Both AWS_* and S3_* prefixes are accepted; AWS_* takes priority.
VariableAliasesTypeDescription
S3_ENDPOINT_URLAWS_ENDPOINT_URLstringS3-compatible endpoint URL, e.g. https://<bucket-id>.r2.cloudflarestorage.com.
S3_BUCKETAWS_S3_BUCKET_NAMEstringBucket name.
AWS_ACCESS_KEY_IDS3_ACCESS_KEY_IDstringS3 access key.
AWS_SECRET_ACCESS_KEYS3_SECRET_ACCESS_KEYstringS3 secret key.
S3_REGIONAWS_DEFAULT_REGIONstringRegion. Defaults to auto when unset (suitable for Cloudflare R2).
S3_URL_STYLEAWS_S3_URL_STYLEstringURL style: virtual or path. Defaults to virtual.
S3_PUBLIC_BASE_URLstringOptional public base URL for generating direct links to objects in the bucket (e.g. a CDN prefix). When unset, the API constructs URLs from S3_ENDPOINT_URL and S3_BUCKET.

Push Notifications (Web Push / VAPID)

Web Push is optional. If all three VAPID_* variables are set, the API enables browser push notifications. If any one is missing, delivery stays disabled and a safe warning is logged.
VariableTypeDefaultDescription
PUSH_NOTIFICATIONS_ENABLEDbooleanTrueMaster switch for the push-notification subsystem. Set to False to disable all outbound push delivery without removing VAPID keys.
EXPO_PUSH_API_URLstringhttps://exp.host/--/api/v2/push/sendExpo push gateway URL. Only relevant if the mobile (Capacitor/Expo) push path is active. Change only if self-hosting the Expo push service.
PUSH_NOTIFICATION_MESSAGE_PREVIEW_ENABLEDbooleanTrueWhen True, notification payloads include a truncated message preview. Set to False to send title-only notifications for privacy.
VAPID_PUBLIC_KEYstring(none)VAPID public key for browser push subscriptions. Generate with npx web-push generate-vapid-keys.
VAPID_PRIVATE_KEYstring(none)VAPID private key. API service only — never set on the Frontend service.
VAPID_SUBJECTstring(none)Contact URI in the VAPID header, e.g. mailto:[email protected].
Do not set NEXT_PUBLIC_VAPID_PUBLIC_KEY on the web service. The browser fetches the public key dynamically from GET /api/v1/notifications/push-public-key.

Attendance & Scheduling

VariableTypeDefaultDescription
ATTENDANCE_MAX_ACTIVE_HOURSinteger16Maximum hours a check-in session can remain open before the system auto-closes it.
ATTENDANCE_AUTO_CLOSE_GRACE_MINUTESinteger60Grace period (minutes) added after ATTENDANCE_MAX_ACTIVE_HOURS before the auto-close Celery task fires.
BUSINESS_TIMEZONEstringAsia/KarachiIANA timezone identifier used for shift windows, roster generation, and end-of-day processing. Example values: UTC, America/New_York, Europe/London.

Build docs developers (and LLMs) love