Repository navigation
Conversation
- Environment checked once at boot, listing every missing or malformed setting instead of failing on the first request that needs one. - GET /health (with a database check) for Railway's health check. - Sign-in tokens are verified locally against Supabase's published ES256 key (cached), so requests no longer wait on a call to Supabase; older HS256 tokens, or a key lookup failure, fall back to asking it. - Rate limiting: 300 requests a minute per signed-in session (per IP when signed out), configurable with RATE_LIMIT_PER_MINUTE. - Every request gets an ID (returned in x-request-id and in error bodies) and one log line with status and duration; logs are JSON in production. A global exception filter keeps HTTP error bodies as they were, maps missing/duplicate records to 404/409, and hides internals of unexpected errors while logging their stack. - POST /client-errors records crashes reported by the app (throttled). - Graceful shutdown on SIGTERM; trust proxy for client IPs; CORS can be narrowed with CORS_ORIGINS. - Indexes for habits, challenge participants, kudos and finished challenges; caps on the challenge list, blocked list and the challenge ending batch; the alert jobs page through users. - users.pushToken removed from the schema. Its drop migration must only be applied after this version is deployed (Phase 2 servers read it).
- Crash handling: a screen crash shows a recovery screen with Try again instead of a blank app, and crashes (from the boundary and uncaught JS errors) are reported to the backend's new /client-errors log with the screen and app version. - Offline: NetInfo drives React Query's online state on phones (the browser's events on web). Cached screens keep showing, queries refetch on reconnect, saving fails straight away instead of spinning, and a banner above the tab bar explains, without blocking taps. - Store config: plain HTTP only in development builds (app.config.js), the microphone permission removed and blocked (the camera is only for barcodes), an iOS privacy manifest for the required-reason APIs, and the unused react-native-health / react-native-health-connect packages removed, since linking HealthKit without using it gets builds rejected. useHealthKit explains how to add them back. - Accessibility: every tappable element has a role, icon-only buttons have spoken labels, options and toggles report their selected or on state, and the tab bar uses tab roles.
- GitHub Actions: the backend job applies the migrations to a throwaway Postgres, checks the schema matches them, then runs prettier, eslint, tsc, unit tests, database tests and the build. The mobile job runs tsc, eslint and unit tests. - Mobile: ESLint with Expo's config (npm run lint) and Jest with jest-expo (npm test). Tests cover the calorie maths, units, local dates (checked in several time zones), challenge labels, where alerts open, and quick-food helpers, which move to lib/quickFoods.ts so they can be tested without the API client. Unused imports and the unused WeeklyBarChart are removed. - Backend: database tests for feed paging (items sharing a timestamp are neither skipped nor repeated, future items never shown) and the weekly leaderboard. Test scripts call the backend's own Jest, since jest-expo also installs a `jest` command.
The roadmap marks Phase 3 done, lists the one migration that waits for the deploy (dropping users.pushToken) and what's left for later. The README covers the health check, request IDs and logs, the new settings, mobile lint and tests, and CI.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 of the roadmap (docs/ROADMAP.md).
GET /health(railway.toml). The server checks its settings at boot and won't start ifDATABASE_URL,SUPABASE_URL,SUPABASE_ANON_KEY,AZURE_OPENAI_ENDPOINTorAZURE_OPENAI_API_KEYis missing or malformed. The log lists which.20261105130000_drop_users_push_token. Phase 2 servers still readusers.pushToken, so apply it only after Railway runs this version. The other new migration (20261105120000_add_missing_indexes) only adds indexes and is already applied to Supabase.RATE_LIMIT_PER_MINUTE(default 300) andCORS_ORIGINS(default: any origin).Backend
GET /health, including a database check.x-request-id, which is also in error bodies, and one log line with status and duration. Logs are JSON in production.POST /client-errorsrecords crashes reported by the app.trust proxyso client IPs are real.Mobile
app.config.js).react-native-healthandreact-native-health-connectremoved: linking HealthKit without using it gets builds rejected.useHealthKit.tssays how to add them back.Tests and CI
.github/workflows/ci.yml):jestcommand.Testing
npm installand an empty database, and all passed.Not testable here: real-device behaviour (push, photo picking, keyboard in sheets, NetInfo on phones).