Naalya Handbook

Environment variables

Every variable the API's env schema declares, grouped, with whether it is required and its default. Generated from envSchema.

Every variable in envSchema (libs/shared/src/config/env.config.ts). Required means the app won't boot without it. How the schema is loaded and read is on Config and environment; where the values live is on Secrets and credentials.

Never copy real values here

This page lists names and committed defaults only. Secret defaults are development placeholders and are hidden. Get real values from a teammate, never from a production dump or a screenshot.

Server and URLs

VariableRequiredDefaultWhat it does
PORTYesNonePort the server listens on
HOSTYesNoneHost the server binds to
NODE_ENVYesNonedevelopment turns off docs basic auth; production turns on PostHog
FRONTEND_URLYesNoneCORS allow-list, comma-separated origins
EDUCATION_HUB_URLYesNoneThe Hub origin every emailed, messaged or redirected link uses
SHORT_LINK_URLNoNoneShort-link host for WhatsApp links; unset sends long links
DOCS_USERNAMEYesNoneBasic auth username for /docs and /queues outside development
DOCS_PASSWORDYesNoneBasic auth password for /docs and /queues outside development

Database and Redis

VariableRequiredDefaultWhat it does
DATABASE_URLYesNonePostgres for the schools API
DATABASE_POOL_SIZENo30Connections per running copy; copies times this must fit the database limit
REDIS_URLNoredis://localhost:6379BullMQ, collaboration, Pip ownership, shared rate limits
CACHE_REDIS_URLNoredis://localhost:6379/1Permission, feature-flag and presence caches

Messaging and realtime

VariableRequiredDefaultWhat it does
RABBIT_MQ_URLYesNoneRabbitMQ for health pings, Rover turns and tool calls
AGENT_QUEUE_PREFETCHNo20Rover turns one worker runs at once (Railway sets 20 on staging and 30 on production)
ROVER_JOB_CONCURRENCYNo5Background Rover jobs one worker process runs at once. The Railway file sets 100 on staging and 50 on production
CENTRIFUGO_URLNohttp://localhost:8006Centrifugo's HTTP API
CENTRIFUGO_API_KEYNoDevelopment placeholderKey for publishing to Centrifugo
CENTRIFUGO_HMAC_SECRETNoDevelopment placeholderSigns connection and subscription tokens

Sign-in and tokens

VariableRequiredDefaultWhat it does
JWT_SECRET_KEYYesNoneSigns access and refresh tokens
JWT_SALT_ROUNDSYesNonebcrypt cost for password hashes; an empty value falls back to 12
JWT_ACCESS_TOKEN_EXPIRATION_MSNo900000Access token life (Railway sets a day)
JWT_REFRESH_TOKEN_EXPIRATION_MSNo604800000Refresh token life, 7 days
IMPERSONATION_REFRESH_EXPIRATION_MSNo3600000Refresh life while impersonating, 1 hour
OTP_EXPIRY_MINUTESNo15One-time code life
OTP_RESEND_COOLDOWN_SECONDSNo30Wait before resending a code
OTP_MAX_ATTEMPTSNo10Wrong codes allowed for one code
MAGIC_LINK_EXPIRY_MINUTESNo5Magic link life
MAGIC_LINK_RESEND_COOLDOWN_SECONDSNo60Wait before resending a link
SUPERADMIN_EMAILSNoNoneOperators created at boot
PLATFORM_ADMIN_EMAIL_DOMAINSNoNoneDomains an operator email must be on
FEATURE_FLAGS_BYPASSNo01 turns every feature on. Local development only

Microsoft 365

VariableRequiredDefaultWhat it does
MICROSOFT_CLIENT_IDYesNoneThe app registration the API signs in to Microsoft Graph as
MICROSOFT_CLIENT_SECRETYesNoneProves the API is that app registration when it asks for Graph tokens
MICROSOFT_TENANT_IDYesNoneThe Microsoft 365 directory that Graph sign-in uses at login.microsoftonline.com
MICROSOFT_OAUTH_CALLBACK_URLYesNoneWhere Microsoft sends the browser back after sign-in
MICROSOFT_WEBHOOK_SECRETYesNoneChecks directory-sync webhooks
MICROSOFT_TOKEN_ENC_KEYNoDevelopment placeholderEncrypts stored Microsoft refresh tokens. Override in production

AI

VariableRequiredDefaultWhat it does
OPENAI_API_KEYYesNoneOpenAI key. Rover's chat, small talk, slide reader, and illustrations use it
OPENAI_MODELNogpt-5.2Chat model name. Rover sends this value as it is
PUBLIC_AI_MODELNoNoneThe website chat's model name. Falls back to OPENAI_MODEL. That client was not re-opened
OPENAI_IMAGE_MODELNogpt-image-1Image model for illustrations and school-report pages
MICRO_MODELYesNoneSmall-talk model name. Rover sends this value as it is
MICRO_SERVICE_TIERNoNoneOpenAI tier for the small model: auto, default, flex, priority
AI_GATEWAY_API_KEYYesNoneAI gateway key
AI_GATEWAY_BASE_URLYesNoneAI gateway URL
PINECONE_API_KEYNoNonePinecone, for the NCDC assistant and lesson index
PINECONE_ASSISTANT_NAMENoNonePinecone assistant
PINECONE_HOSTNoNonePinecone index host
NCDC_WEBHOOK_SECRETNoNoneChecks NCDC indexing callbacks
MODAL_TOKEN_IDNoNoneModal sandbox for the agent's shell; unset means no shell
MODAL_TOKEN_SECRETNoNoneModal sandbox secret, paired with MODAL_TOKEN_ID
MODAL_APP_NAMENonaalya-roverModal app
MODAL_IMAGE_NAMENopython:3.12-slimSandbox image
MODAL_TIMEOUT_MSNo3600000Longest a sandbox may live

Storage and files

VariableRequiredDefaultWhat it does
CLOUDFLARE_ACCOUNT_IDYesNoneBuilds the R2 storage endpoint and the AI search URL
CLOUDFLARE_BASE_URLYesNoneStart of the AI search URL; the account ID is added after it
CLOUDFLARE_API_TOKENYesNoneRequired by the R2 storage service at start-up
CLOUDFLARE_AI_SEARCH_API_TOKENYesNoneAuthorises calls to Cloudflare AI search
R2_ACCESS_KEY_IDYesNoneR2 storage key
R2_SECRET_ACCESS_KEYYesNoneR2 storage secret
R2_DEFAULT_BUCKETNonaalya-storagePrivate bucket
R2_PUBLIC_BUCKETYesNonePublic bucket
R2_PUBLIC_BASE_URLYesNonePublic bucket URL
GOTENBERG_URLNohttp://localhost:3010HTML to PDF service
GOTENBERG_BASIC_AUTHNoNoneGotenberg credentials, if it has them

Email and messaging

VariableRequiredDefaultWhat it does
RESEND_API_KEYYesNoneResend key
RESEND_FROM_EMAILYesNoneSender address
RESEND_FROM_NAMEYesNoneSender name
UNIPILE_API_KEYYesNoneUnipile (WhatsApp and social)
UNIPILE_BASE_URLNoNoneUnipile API base
UNIPILE_WEBHOOK_SECRETNoNoneChecks Unipile webhooks
UNIPILE_CALLBACK_BASE_URLNoNoneWhere Unipile's hosted sign-in returns

Payments

VariableRequiredDefaultWhat it does
SCHOOL_PAY_API_BASE_URLNoNoneSchoolPay host. Unset refuses SchoolPay calls
PESAPAL_CURRENCYNoUGXPesapal currency
PAYMENT_CREDENTIALS_ENC_KEYNoDevelopment placeholderEncrypts campus gateway credentials. Override in production

The clinic link stays off until all four variables are set.

VariableRequiredDefaultWhat it does
NAALYA_EHR_API_URLNoNoneThe clinic API
NAALYA_EHR_API_KEYNoNoneThe clinic API key
NAALYA_EHR_WEBHOOK_SECRETNoNoneChecks webhooks from the clinic API
NAALYA_EHR_SCHOOL_IDNoNoneWhich school the link works for

Logging and tracing

VariableRequiredDefaultWhat it does
LOGGING_LEVELNodebugpino level
LOGGING_REQUEST_LOGGER_ENABLEDNo1One line per request
OTEL_EXPORTER_OTLP_ENDPOINTNoNoneDash0 endpoint; unset means stdout logs only
OTEL_EXPORTER_OTLP_HEADERSNoNoneDash0 token and dataset
OTEL_DETAILED_TRACINGNoNone1 adds Nest, Postgres and Redis spans
LANGFUSE_TRACINGNoNoneAgent tracing (worker)
LANGFUSE_PUBLIC_KEYNoNoneLangfuse key
LANGFUSE_SECRET_KEYNoNoneLangfuse secret
LANGFUSE_BASE_URLNoNoneLangfuse host
POSTHOG_PROJECT_TOKENNoNonePostHog, production only
POSTHOG_HOSTNoNonePostHog host

Scheduled jobs

All run on the worker, in UTC. CRON_ENABLED=0 stops every one.

VariableDefaultKampala time
CRON_CLEAN_LIBRARY_COVERS0 22 * * *01:00 daily
CRON_ENABLED1Not applicable
CRON_FEE_REMINDERS0 4 * * *07:00 daily
CRON_INDEX_LESSON_FILES0 0,12 * * *03:00 and 15:00
CRON_LAPSE_LIBRARY_HOLDS*/10 * * * *Every 10 minutes
CRON_LIBRARY_REMINDERS0 5 * * *08:00 daily
CRON_OPEN_YEAR_ENROLMENT0 0,12 * * *03:00 and 15:00
CRON_PUBLISH_NOTICES0 0,12 * * *03:00 and 15:00
CRON_PURGE_EXPIRED_STORAGE0 0 * * *03:00 daily
CRON_PURGE_REFRESH_TOKENS0 0 * * *03:00 daily
CRON_PURGE_SHORT_LINKS0 0 * * *03:00 daily
CRON_PURGE_TEAMS_MESSAGES0 0 * * *03:00 daily
CRON_RECORDS_RETENTION0 1 * * *04:00 daily
CRON_REKEY_STORAGE0 0 * * *03:00 daily
CRON_RELEASE_TERM_REPORTS0 0,12 * * *03:00 and 15:00
CRON_SCHOOL_REPORTS_MONTHLY0 0 * * *03:00 daily
CRON_SCHOOL_REPORTS_TERMLY0 0 * * *03:00 daily
CRON_SWEEP_CALENDAR_COPIES0 0,12 * * *03:00 and 15:00
CRON_SWEEP_LESSON_COPIES0 0,12 * * *03:00 and 15:00
CRON_SWEEP_NAALYA_EHR0 0,12 * * *03:00 and 15:00
CRON_SYNC_SCHOOL_PAY0 0 * * *03:00 daily
CRON_TEAMS_WEEKLY_SUMMARY0 13 * * 5Friday 16:00

REFRESH_TOKEN_RETENTION_DAYS (default 30) is how long expired refresh tokens are kept before the purge.

On this page