LifeMate — Personal, Family & Learning Companion
docs/offline-data-rescue-options
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 | name: ${COMPOSE_PROJECT_NAME:-lifeguide-stage0} |
| 2 | |
| 3 | x-api-environment: &api-environment |
| 4 | NODE_ENV: ${NODE_ENV:-production} |
| 5 | PORT: 8080 |
| 6 | PGHOST: postgres |
| 7 | PGPORT: 5432 |
| 8 | PGDATABASE: ${POSTGRES_DB:-lifemate} |
| 9 | PGUSER: ${API_DB_USER:-lifeguide_api} |
| 10 | PGPASSWORD: ${API_DB_PASSWORD:?Generate independent API_DB_PASSWORD in .env} |
| 11 | JWT_SECRET: ${JWT_SECRET:?Generate JWT_SECRET in .env} |
| 12 | PUBLIC_APP_URL: ${PUBLIC_APP_URL:?Set the operator-approved HTTPS origin} |
| 13 | CORS_ORIGINS: ${CORS_ORIGINS:?Set the operator-approved HTTPS origin} |
| 14 | LOG_REQUESTS: ${LOG_REQUESTS:-false} |
| 15 | RATE_LIMIT_SESSION_MAX: ${RATE_LIMIT_SESSION_MAX:-60} |
| 16 | RATE_LIMIT_SESSION_WINDOW_SECONDS: ${RATE_LIMIT_SESSION_WINDOW_SECONDS:-600} |
| 17 | EMAIL_FROM: ${EMAIL_FROM:-} |
| 18 | SMTP_HOST: ${SMTP_HOST:-} |
| 19 | SMTP_PORT: ${SMTP_PORT:-587} |
| 20 | SMTP_SECURE: ${SMTP_SECURE:-false} |
| 21 | SMTP_USER: ${SMTP_USER:-} |
| 22 | SMTP_PASSWORD: ${SMTP_PASSWORD:-} |
| 23 | SMS_PROVIDER: ${SMS_PROVIDER:-disabled} |
| 24 | SMS_PROVIDER_URL: ${SMS_PROVIDER_URL:-} |
| 25 | SMS_PROVIDER_TOKEN: ${SMS_PROVIDER_TOKEN:-} |
| 26 | TRUSTED_PROXY_CIDRS: ${GATEWAY_PROXY_IP:-172.30.86.10}/32 |
| 27 | |
| 28 | x-admin-environment: &admin-environment |
| 29 | PGHOST: postgres |
| 30 | PGPORT: 5432 |
| 31 | PGDATABASE: ${POSTGRES_DB:-lifemate} |
| 32 | PGUSER: ${POSTGRES_USER:-lifeguide} |
| 33 | PGPASSWORD: ${POSTGRES_PASSWORD:?Generate POSTGRES_PASSWORD in .env} |
| 34 | API_DB_USER: ${API_DB_USER:-lifeguide_api} |
| 35 | MIGRATOR_DB_USER: ${MIGRATOR_DB_USER:-lifeguide_migrator} |
| 36 | BACKUP_DB_USER: ${BACKUP_DB_USER:-lifeguide_backup} |
| 37 | |
| 38 | x-migration-environment: &migration-environment |
| 39 | PGHOST: postgres |
| 40 | PGPORT: 5432 |
| 41 | PGDATABASE: ${POSTGRES_DB:-lifemate} |
| 42 | PGUSER: ${MIGRATOR_DB_USER:-lifeguide_migrator} |
| 43 | PGPASSWORD: ${MIGRATOR_DB_PASSWORD:?Generate independent MIGRATOR_DB_PASSWORD in .env} |
| 44 | |
| 45 | services: |
| 46 | postgres: |
| 47 | image: postgres:16 |
| 48 | restart: unless-stopped |
| 49 | environment: |
| 50 | POSTGRES_DB: ${POSTGRES_DB:-lifemate} |
| 51 | POSTGRES_USER: ${POSTGRES_USER:-lifeguide} |
| 52 | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Generate POSTGRES_PASSWORD in .env} |
| 53 | PGDATA: /var/lib/postgresql/data/pgdata |
| 54 | volumes: |
| 55 | - postgres-data:/var/lib/postgresql/data |
| 56 | healthcheck: |
| 57 | test: [CMD-SHELL, 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"'] |
| 58 | interval: 5s |
| 59 | timeout: 5s |
| 60 | retries: 20 |
| 61 | networks: [private] |
| 62 | |
| 63 | db-provision: |
| 64 | image: ${API_IMAGE:-lifeguide-api:local} |
| 65 | build: |
| 66 | context: ./backend |
| 67 | command: [node, scripts/provision-db-roles.js, --prepare] |
| 68 | # Short-lived ops job reads root-owned mode600 backups read-only; the API |
| 69 | # remains USER node and never mounts this volume or receives admin secrets. |
| 70 | user: '0:0' |
| 71 | read_only: true |
| 72 | tmpfs: [/tmp] |
| 73 | security_opt: [no-new-privileges:true] |
| 74 | environment: |
| 75 | <<: *admin-environment |
| 76 | API_DB_PASSWORD: ${API_DB_PASSWORD:?Generate independent API_DB_PASSWORD in .env} |
| 77 | MIGRATOR_DB_PASSWORD: ${MIGRATOR_DB_PASSWORD:?Generate independent MIGRATOR_DB_PASSWORD in .env} |
| 78 | BACKUP_DB_PASSWORD: ${BACKUP_DB_PASSWORD:?Generate independent BACKUP_DB_PASSWORD in .env} |
| 79 | volumes: |
| 80 | - backups:/backups:ro |
| 81 | depends_on: |
| 82 | postgres: |
| 83 | condition: service_healthy |
| 84 | restart: 'no' |
| 85 | networks: [private] |
| 86 | |
| 87 | migrate: |
| 88 | image: ${API_IMAGE:-lifeguide-api:local} |
| 89 | build: |
| 90 | context: ./backend |
| 91 | command: [node, scripts/migrate.js] |
| 92 | environment: *migration-environment |
| 93 | depends_on: |
| 94 | postgres: |
| 95 | condition: service_healthy |
| 96 | db-provision: |
| 97 | condition: service_completed_successfully |
| 98 | restart: 'no' |
| 99 | networks: [private] |
| 100 | |
| 101 | catalog-import: |
| 102 | image: ${API_IMAGE:-lifeguide-api:local} |
| 103 | command: [node, scripts/import-learning-catalog.js] |
| 104 | environment: *migration-environment |
| 105 | depends_on: |
| 106 | migrate: |
| 107 | condition: service_completed_successfully |
| 108 | restart: 'no' |
| 109 | networks: [private] |
| 110 | |
| 111 | db-grants: |
| 112 | image: ${API_IMAGE:-lifeguide-api:local} |
| 113 | command: [node, scripts/provision-db-roles.js, --grants] |
| 114 | environment: *admin-environment |
| 115 | depends_on: |
| 116 | migrate: |
| 117 | condition: service_completed_successfully |
| 118 | catalog-import: |
| 119 | condition: service_completed_successfully |
| 120 | restart: 'no' |
| 121 | networks: [private] |
| 122 | |
| 123 | api: |
| 124 | image: ${API_IMAGE:-lifeguide-api:local} |
| 125 | build: |
| 126 | context: ./backend |
| 127 | restart: unless-stopped |
| 128 | environment: *api-environment |
| 129 | read_only: true |
| 130 | tmpfs: [/tmp] |
| 131 | security_opt: [no-new-privileges:true] |
| 132 | depends_on: |
| 133 | postgres: |
| 134 | condition: service_healthy |
| 135 | migrate: |
| 136 | condition: service_completed_successfully |
| 137 | db-grants: |
| 138 | condition: service_completed_successfully |
| 139 | healthcheck: |
| 140 | test: [CMD, node, -e, "fetch('http://127.0.0.1:8080/ready').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"] |
| 141 | interval: 10s |
| 142 | timeout: 5s |
| 143 | retries: 12 |
| 144 | start_period: 10s |
| 145 | # Provider delivery may use outbound networking after owner configuration; |
| 146 | # no API host port is published. PostgreSQL remains private-only. |
| 147 | networks: |
| 148 | private: |
| 149 | edge: |
| 150 | proxy: |
| 151 | aliases: [api-proxy] |
| 152 | |
| 153 | gateway: |
| 154 | image: ${WEB_IMAGE:-lifeguide-web:local} |
| 155 | build: |
| 156 | context: ./apps/lifemate |
| 157 | restart: unless-stopped |
| 158 | ports: |
| 159 | - '${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:443' |
| 160 | volumes: |
| 161 | - ${TLS_CERT_PATH:-./deployment/tls/server.pem}:/etc/nginx/tls/server.pem:ro |
| 162 | - ${TLS_KEY_PATH:-./deployment/tls/server-key.pem}:/etc/nginx/tls/server-key.pem:ro |
| 163 | - ./deployment/runtime-config.json:/usr/share/nginx/html/config.json:ro |
| 164 | - ./deployment/downloads:/usr/share/nginx/html/downloads:ro |
| 165 | depends_on: |
| 166 | api: |
| 167 | condition: service_healthy |
| 168 | healthcheck: |
| 169 | test: [CMD-SHELL, 'wget -Y off -q -O /dev/null http://127.0.0.1:8081/gateway-health'] |
| 170 | interval: 10s |
| 171 | timeout: 5s |
| 172 | retries: 6 |
| 173 | networks: |
| 174 | edge: |
| 175 | proxy: |
| 176 | ipv4_address: ${GATEWAY_PROXY_IP:-172.30.86.10} |
| 177 | |
| 178 | backup: |
| 179 | build: |
| 180 | context: . |
| 181 | dockerfile: deployment/backup/Dockerfile |
| 182 | restart: unless-stopped |
| 183 | environment: |
| 184 | DATABASE_URL: postgresql://${BACKUP_DB_USER:-lifeguide_backup}@postgres:5432/${POSTGRES_DB:-lifemate} |
| 185 | PGPASSWORD: ${BACKUP_DB_PASSWORD:?Generate independent BACKUP_DB_PASSWORD in .env} |
| 186 | BACKUP_SCHEDULE: ${BACKUP_SCHEDULE:-0 2 * * *} |
| 187 | BACKUP_KEEP_DAYS: ${BACKUP_KEEP_DAYS:-14} |
| 188 | BACKUP_MAX_AGE_SECONDS: ${BACKUP_MAX_AGE_SECONDS:-93600} |
| 189 | volumes: |
| 190 | - backups:/backups |
| 191 | depends_on: |
| 192 | postgres: |
| 193 | condition: service_healthy |
| 194 | db-grants: |
| 195 | condition: service_completed_successfully |
| 196 | healthcheck: |
| 197 | test: [CMD-SHELL, 'kill -0 1 && test -f /backups/last-success && test "$$(( $$(date +%s) - $$(stat -c %Y /backups/last-success) ))" -lt "$${BACKUP_MAX_AGE_SECONDS:-93600}"'] |
| 198 | interval: 60s |
| 199 | timeout: 5s |
| 200 | retries: 3 |
| 201 | start_period: 60s |
| 202 | networks: [private] |
| 203 | |
| 204 | # Explicit operator tools: never start these as a background application. |
| 205 | restore: |
| 206 | profiles: [ops] |
| 207 | build: |
| 208 | context: . |
| 209 | dockerfile: deployment/backup/Dockerfile |
| 210 | entrypoint: [/opt/lifeguide/restore.sh] |
| 211 | environment: |
| 212 | DATABASE_URL: postgresql://${MIGRATOR_DB_USER:-lifeguide_migrator}@postgres:5432/${POSTGRES_DB:-lifemate} |
| 213 | PGPASSWORD: ${MIGRATOR_DB_PASSWORD:?Generate independent MIGRATOR_DB_PASSWORD in .env} |
| 214 | volumes: [backups:/backups] |
| 215 | restart: 'no' |
| 216 | networks: [private] |
| 217 | |
| 218 | db-role-test: |
| 219 | profiles: [ops] |
| 220 | image: ${API_IMAGE:-lifeguide-api:local} |
| 221 | command: [node, scripts/test-db-roles.js, --synthetic-only] |
| 222 | environment: |
| 223 | <<: *admin-environment |
| 224 | API_DB_PASSWORD: ${API_DB_PASSWORD:?Generate independent API_DB_PASSWORD in .env} |
| 225 | MIGRATOR_DB_PASSWORD: ${MIGRATOR_DB_PASSWORD:?Generate independent MIGRATOR_DB_PASSWORD in .env} |
| 226 | BACKUP_DB_PASSWORD: ${BACKUP_DB_PASSWORD:?Generate independent BACKUP_DB_PASSWORD in .env} |
| 227 | DB_ROLE_RESTORE_FIXTURE: /app/restore-fixture.sql |
| 228 | volumes: |
| 229 | - ./backend/tests/online_acceptance.test.js:/app/tests/online_acceptance.test.js:ro |
| 230 | - ./deployment/restore-fixture.sql:/app/restore-fixture.sql:ro |
| 231 | restart: 'no' |
| 232 | networks: [private] |
| 233 | |
| 234 | volumes: |
| 235 | postgres-data: |
| 236 | backups: |
| 237 | |
| 238 | networks: |
| 239 | private: |
| 240 | internal: true |
| 241 | edge: |
| 242 | proxy: |
| 243 | internal: true |
| 244 | ipam: |
| 245 | config: |
| 246 | - subnet: ${PROXY_SUBNET:-172.30.86.0/24} |