LifeMate — Personal, Family & Learning Companion
fix/managed-child-session-boundary
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | const publicPort = Number(process.env.PORT ?? 8080); |
| 2 | process.env.NODE_ENV = process.env.NODE_ENV || 'production'; |
| 3 | import express from 'express'; |
| 4 | import { |
| 5 | configureTrustedProxy, |
| 6 | operationalErrorHandler, |
| 7 | rateLimit, |
| 8 | requestContext, |
| 9 | requestTelemetry, |
| 10 | } from './operations.js'; |
| 11 | import { createAuthIpRateLimit } from './auth_rate_limit.js'; |
| 12 | |
| 13 | const { app, pool } = await import('./server.js'); |
| 14 | |
| 15 | const outer = express(); |
| 16 | outer.disable('x-powered-by'); |
| 17 | configureTrustedProxy(outer); |
| 18 | outer.use(requestContext); |
| 19 | outer.use(requestTelemetry); |
| 20 | outer.use(createAuthIpRateLimit({ pool, jwtSecret: process.env.JWT_SECRET })); |
| 21 | outer.use(rateLimit); |
| 22 | |
| 23 | outer.get('/live', (_req, res) => { |
| 24 | res.json({ status: 'ok', service: 'lifemate-api' }); |
| 25 | }); |
| 26 | |
| 27 | outer.get('/ready', async (_req, res) => { |
| 28 | try { |
| 29 | const result = await pool.query('select 1 as ok'); |
| 30 | if (result.rows[0]?.ok !== 1) return res.status(503).json({ status: 'degraded' }); |
| 31 | res.json({ status: 'ok', database: 'ready' }); |
| 32 | } catch { |
| 33 | res.status(503).json({ status: 'degraded', database: 'unavailable' }); |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | outer.use(app); |
| 38 | outer.use(operationalErrorHandler); |
| 39 | outer.listen(publicPort, () => console.log(JSON.stringify({ type: 'startup', service: 'lifemate-api', port: publicPort }))); |