Frontier Ledger (MERN)
A chapter-by-chapter completionist checklist for Red Dead Redemption 2.
- MongoDB + Mongoose: stores each user’s ticked items
- Express: email and password sign up and sign in (passwords hashed with bcrypt, session in an httpOnly cookie) and a small progress API
- React (Vite): app shell, sign up and sign in form, account bar and sync; hosts the tracker
- Node: runs the server, and in production also serves the built React app
- PWA: installable and works offline. Ticks made offline are saved on the device and synced when you reconnect.
The tracker itself (all chapters, collectibles, unlock rules, link sync) is client/public/ledger-engine.js. React mounts it, seeds its starting ticks from your account, and saves each change through the API.
cp server/.env.example server/.env
Fill in MONGODB_URI (local MongoDB or an Atlas connection string) and JWT_SECRET (a long random string).
2. Run in development
npm run install:all
npm run dev:server # API on http://localhost:5000
npm run dev:client # app on http://localhost:5173 (proxies /api to the server)
3. Run in production
npm run install:all
npm run build # builds client/dist
NODE_ENV=production npm start
Express serves client/dist and /api from one origin, so the cookie and the service worker work without extra setup. Production needs HTTPS (any host that gives you a certificate, such as Render, Railway or a VPS behind Caddy or nginx).
Deploy on Vercel (two projects)
This repo is set up for the API at https://rdr2-fullguide-api.vercel.app and the app at https://rdr2-fullguide.vercel.app.
API project (Root Directory: server)
Environment variables:
MONGODB_URI: your MongoDB Atlas connection string (allow Vercel’s IPs in Atlas, or use 0.0.0.0/0)
JWT_SECRET: a long random string
NODE_ENV: production
CLIENT_ORIGIN: https://rdr2-fullguide.vercel.app
App project (Root Directory: client, framework Vite)
No environment variables are needed. client/vercel.json forwards /api/* to the API project, so the browser only ever talks to the app’s own address. That keeps the sign-in cookie first-party, which browsers that block third-party cookies (Safari, for example) require. If you rename the API project, change the address in client/vercel.json.
Check https://rdr2-fullguide-api.vercel.app/api/health returns {"ok":true}, then sign up on the app.
API
| Method |
Path |
Purpose |
| POST |
/api/auth/signup |
Body { name, email, password }. Creates the account and signs in |
| POST |
/api/auth/login |
Body { email, password }. Sets the session cookie |
| GET |
/api/auth/me |
Current user |
| POST |
/api/auth/logout |
Clears the cookie |
| GET |
/api/progress |
Saved ticks |
| PUT |
/api/progress |
Replace saved ticks with { checked } |
| POST |
/api/progress/merge |
Add ticks without removing any (used at first sign-in) |
How sync behaves
- Guests: the first screen offers sign up, sign in or Skip for now. Skipping keeps ticks in this browser only, and the account bar stays available for signing in later.
- First sign-in or sign-up: ticks already on the device are merged into the account, so nothing is lost.
- Later loads: the account is the source of truth, unless you changed things offline, in which case the device’s version is sent up first.
- Two devices edited offline at once: the last one to sync wins.
Look and feel
The UI follows a dark maroon dashboard style: a left icon rail on wide screens (a bottom tab bar on phones), a greeting header with search, a hero card for the current chapter, a chapter list, a statistics ring, filled icons, rounded cards and short entrance animations. Animations are switched off for people who have “reduce motion” turned on. Styling lives in client/src/theme.css and client/src/app.css; the tracker’s markup is client/src/ledgerMarkup.html.
About page and build number
The About page (the About tab, or #about in the address) shows the version from client/package.json and a build number. The build number is BUILD_NUMBER from your CI if set, otherwise the build time as YYMMDD.HHMM (UTC). It also has Sign in and Sign out.
Updating the app
Change CACHE in client/public/sw.js when you ship changes so installed copies refresh.
评论