Configuration Flags
All configuration is via environment variables (see Environment Variables for the full .env walkthrough). This page focuses on the behaviour-changing flags an operator reaches for.
Feature flags
| Flag | Default | Effect |
|---|---|---|
EMANDI_TILED_REDESIGN_ENABLED | true | The 4-tile hub landing pages for /buy and /sell (vs. flat boards). Gates the back-to-hub links. |
Runtime feature toggles are resolved through apps/api/src/lib/featureFlags.ts.
Quota limits (env-overridable)
Phase 1 is intentionally loose — instrument first, calibrate later.
| Var | Default | Axis |
|---|---|---|
SELL_LEADS_DAILY | 5 | Posts (sell) |
BUY_LEADS_DAILY | 5 | Posts (buy) |
LEAD_VIEWS_DAILY_SELL | 50 | Views (sell) |
LEAD_VIEWS_DAILY_BUY | 50 | Views (buy) |
LEAD_ENGAGEMENTS_DAILY_SELL | 20 | Engagements (sell) |
LEAD_ENGAGEMENTS_DAILY_BUY | 20 | Engagements (buy) |
QUOTA_TIMEZONE | Asia/Kolkata | IST reset boundary |
Rate limiting
| Var | Default | Notes |
|---|---|---|
RATE_LIMIT_DISABLED | false | Master off-switch. Ignored when NODE_ENV=production. Set true on CI/QA and before load tests. |
OTP_RATE_LIMIT_MAX / OTP_RATE_LIMIT_WINDOW_MS | 5 / 600000 | OTP per phone |
LOGIN_PHONE_LIMIT_MAX | 10 | Consecutive failures before lockout |
LOGIN_DEVICE_LIMIT_MAX | 20 | Per device |
LOGIN_IP_LIMIT_MAX | 300 | Coarse shared bucket (NAT-safe) |
SEARCH_RATE_LIMIT_MAX | 120 | Search |
Timing & pool tuning
| Var | Default | Notes |
|---|---|---|
DATABASE_POOL_SIZE | 5 (raise to ~20) | Connections per API process on the Supabase pooler |
DATABASE_POOL_TIMEOUT | 10s | P2024 → graceful 503 |
DATABASE_POOL_WARM | 3 | Connections opened at boot |
LOGIN_TIMEOUT_MS | 3000 | Fast-fail a login with 503 when the pool is saturated |
REFRESH_TOKEN_GRACE_MS | 60000 | Previous refresh token validity after rotation |
REDIS_MAX_RETRIES_PER_REQUEST | 2 | Reconnect attempts before a queued command is flushed with an error (request-path client only; BullMQ keeps null) |
REDIS_COMMAND_TIMEOUT_MS | 3000 | Command budget on a connected-but-silent socket; 0 disables |
Scheduled jobs
| Var | Default | Notes |
|---|---|---|
OVERCOMMITMENT_GRACE_WINDOW_HOURS | 48 | Stock-overcommit grace |
ACCOUNT_DELETION_MAX_PENDING_DAYS | 30 | Deferred-deletion ceiling |
FINALIZE_PENDING_DELETIONS_CRON | 30 4 * * * | Finalize sweep (10:00 IST) |
SOFT_DELETE_RETENTION_YEARS | 7 | Retention purge window |
Test/QA locks (never on production)
| Var | Effect |
|---|---|
ENABLE_TEST_ENDPOINTS + TEST_ENDPOINT_SECRET | Mounts /api/v1/test/* (both required). |
TEST_OTP_PHONES | Matched numbers get the fixed OTP 123456, no SMS, rate-exempt. Supports trailing-* prefix wildcards. |
Confirm on a running process: GET /api/v1/health → data.config shows testEndpoints and fixedOtpPhones counts.
See also: Troubleshooting · Scheduled Jobs & Workers · Security Checklist · Deployment (Railway) · External Services & Provisioning.
