A full-stack account dashboard with hardened auth/session handling, profile and security controls, and real API-driven account settings.
- Hardened backend API with:
- request IDs
- health endpoint (
/api/health) - env-driven CORS and rate-limiting
- login brute-force throttling and temporary lockouts
- graceful shutdown
- safer refresh-token lifecycle (
refreshTokenVersioninvalidation + tracked refresh sessions)
- Expanded account model and endpoints for:
- username-based identity with separate display names and login by email or username
- richer profile fields (avatar, headline, pronouns, bio, location, website, timezone, language)
- external profile references
- privacy/notification preferences and appearance settings
- security settings
- active session management (list/revoke/revoke-all)
- recent activity
- account JSON export
- Safer email utility configuration (no hardcoded credentials)
- Rebuilt frontend dashboard with:
- fully wired forms for every tab
- auto refresh-token retry on 401
- activity filtering, trend mini-bars, and CSV export
- toasts, loading states, sync status, connection status, and popup fallback
- in-memory access-token handling backed by secure refresh cookies
- appearance themes, density controls, high-contrast/reduced-motion options
- responsive layout and improved visual polish
- Install dependencies:
Use Node 20+ for the backend so the Resend SDK installs cleanly.
cd backend npm install - Create env file:
cp .env.example .env
- Configure Resend for verification emails:
RESEND_API_KEY=re_xxxxxxxxxxxxxxxxxxxxx EMAIL_FROM=no-reply@your-domain.com EMAIL_FROM_NAME=Continental ID EMAIL_REPLY_TO=support@your-domain.com LOGIN_POPUP_URL=https://login.continental-hub.com/popup.html EMAIL_VERIFY_URL=https://login.continental-hub.com/verify.html
- Start backend:
Startup now runs a user-identity migration so existing accounts get usernames and the new profile shape automatically.
npm run start
- Run the migration manually if needed:
npm run migrate:users
- Run the backend verification suite:
npm test
Required:
MONGO_URIJWT_SECRETREFRESH_TOKEN_SECRET
Common production settings:
NODE_ENV=productionHOST=0.0.0.0unless you intentionally want loopback-only bindingTRUST_PROXY=1when running behind Nginx, Caddy, or another reverse proxyALLOWED_ORIGINS=https://dashboard.example.com,https://login.example.comALLOW_LOCALHOST_ORIGINS=falseHTTPS_MODE=offwhen TLS terminates at the proxy, orHTTPS_MODE=onfor direct TLS on the Node process
Auth tuning:
JWT_EXPIRES_INREFRESH_TOKEN_EXPIRES_INRATE_LIMIT_WINDOW_MSRATE_LIMIT_MAXLOGIN_RATE_WINDOW_MSLOGIN_RATE_MAX_ATTEMPTSLOGIN_BLOCK_MSMFA_RATE_WINDOW_MSMFA_RATE_MAX_ATTEMPTSMFA_BLOCK_MSREFRESH_TOKEN_REPLAY_GRACE_MSPASSWORD_RESET_TTL_MSPASSWORD_RESET_EMAIL_COOLDOWN_MSVERIFICATION_EMAIL_COOLDOWN_MSLOGIN_ALERT_EMAIL_COOLDOWN_MSEMAIL_VERIFICATION_TTL_MSEMAIL_DAILY_LIMITEMAIL_MONTHLY_LIMITCOOKIE_DOMAIN
Passkeys / WebAuthn:
WEBAUTHN_RP_NAMEWEBAUTHN_RP_ID
OAuth:
GITHUB_CLIENT_IDGITHUB_CLIENT_SECRETGITHUB_OAUTH_CALLBACK_URLGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_OAUTH_CALLBACK_URLDISCORD_CLIENT_IDDISCORD_CLIENT_SECRETDISCORD_OAUTH_CALLBACK_URLMICROSOFT_CLIENT_IDMICROSOFT_CLIENT_SECRETMICROSOFT_TENANT_IDMICROSOFT_OAUTH_CALLBACK_URL
Optional Vanguard integration:
VANGUARD_API_KEYorVANGUARD_API_KEYSVANGUARD_API_KEY_HEADERVANGUARD_INSTANCE_HEADERVANGUARD_LICENSE_AUTHORIZEDVANGUARD_LICENSE_REASONVANGUARD_ALLOWED_GUILD_IDSVANGUARD_ENTITLEMENT_AIVANGUARD_ENTITLEMENT_ADVANCED_VOTESVANGUARD_ENTITLEMENT_GUARD_PRESETS
You can serve frontend/ with any static server (for example Live Server or python -m http.server).
Optional runtime globals:
window.__API_BASE_URL__window.__LOGIN_POPUP_URL__
Default behavior now assumes the frontend and /api/* are available on the same HTTPS origin. That is the preferred deployment because it avoids exposing :5000 to browsers and reduces cross-site cookie failures on restrictive networks.
For the current hosted static domains (dashboard.continental-hub.com, login.continental-hub.com, pulse.continental-hub.com, grimoire.continental-hub.com, and charlemagne404.github.io), the checked-in frontend now probes the same origin plus the known Continental auth/API hosts and only keeps a candidate that exposes the expected auth /api/health response. Set window.__API_BASE_URL__ when you want a deterministic backend origin.
For the operational integration rules, popup contract, redirect fallback, and deployment checklist, see docs/continental-id-integration.md.
- A deploy workflow is included at
.github/workflows/deploy-pages.yml. - A backend syntax-check workflow is included at
.github/workflows/backend-check.yml. - It publishes the
frontend/folder to GitHub Pages and includesCNAME. - In your GitHub repo settings, set Pages to GitHub Actions as the source.
- If your API is on a different origin, set backend
ALLOWED_ORIGINSto include your Pages/custom domain. - If you proxy the API through the same public host on
443, leave the frontend on its default same-origin/api/*setup instead of pointing browsers at:5000. - To mirror the auth pages into the sibling
Loginrepo, runbash scripts/sync-login-popup.sh.
You can run the backend and MongoDB together with Docker Compose:
cp backend/.env.example backend/.env
docker compose up --buildNotes:
compose.ymlexpectsbackend/.envto exist.- The compose stack sets
MONGO_URIto the bundledmongoservice automatically. - The checked-in compose stack is for local development: it binds the backend on
0.0.0.0, keepsNODE_ENV=development, and disables direct HTTPS on the Node process. - For a public/containerized deployment, switch to
NODE_ENV=production, replace the placeholder secrets, set the correctALLOWED_ORIGINS, and either terminate TLS at the proxy withHTTPS_MODE=offor run direct TLS withHTTPS_MODE=on.
- The repo currently ships deployment automation for the static frontend and a local deploy helper for the backend at
backend/deploy-backend.sh. - The backend no longer auto-enables HTTPS just because cert files happen to exist on the host. Set
HTTPS_MODE=onexplicitly when you want the Node process itself to serve TLS. - The backend workflow runs
npm run checkandnpm test; it still does not deploy or validate production secrets. - The dashboard and login popup now expose Microsoft alongside GitHub, Google, and Discord when the provider is configured on the backend.
- Passkeys and cross-site refresh cookies depend on your final public origins, proxy setup, and HTTPS configuration, so validate those flows in the deployed environment instead of assuming local success maps to production.
- Proxy clients such as StepCast can forward browser-originated
POST /api/auth/login,POST /api/auth/register,POST /api/auth/refresh_token, andGET /api/auth/metraffic through their own backend as long asALLOWED_ORIGINSincludes the browser origin and the proxy passes through the refresh cookie and bearer token unchanged.
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/logoutPOST /api/auth/refresh_tokenPOST /api/auth/resend-verificationGET /api/auth/mePATCH /api/auth/profilePATCH /api/auth/emailPATCH /api/auth/passwordGET/PATCH /api/auth/preferencesGET/PATCH /api/auth/linkedGET /api/auth/activityGET/PATCH /api/auth/securityGET /api/auth/sessionsDELETE /api/auth/sessions/:sessionIdDELETE /api/auth/sessionsGET /api/auth/exportDELETE /api/auth/accountGET /api/auth/verify-email?token=...GET /api/vanguard/healthPOST /api/vanguard/license/verifyPOST /api/vanguard/users/resolvePOST /api/vanguard/users/flagPOST /api/vanguard/users/unflag
- New registrations now create a verification token and send a verification email through Resend.
- Accounts now carry a distinct
usernamefor sign-in and a separatedisplayNamefor presentation. - Existing users are migrated forward on backend startup, and the same migration can be run manually with
npm run migrate:users. - Changing an account email resets
isVerified, issues a new token, and sends a fresh verification email. - Signed-in users can request a new verification email with
POST /api/auth/resend-verification. - Set
LOGIN_POPUP_URLto the public login page, for examplehttps://login.continental-hub.com/popup.html, so verification and reset emails can derive the correct hosted auth routes automatically. - Set
EMAIL_VERIFY_URLto the public URL of the verification page, for examplehttps://login.continental-hub.com/verify.html, that loads the token and calls/api/auth/verify-email. - For local email previews, open
http://127.0.0.1:5000/api/auth/email-previewafter starting the backend. You can switch between verification, password reset, and security/login alert templates and preview different dashboard themes without sending any email.
ALLOWED_ORIGINSis comma-separated.localhost/127.0.0.1are allowed automatically only in development, or whenALLOW_LOCALHOST_ORIGINS=true.
- Source code in this repository is licensed under the MIT license. See
LICENSE. - Service terms for the deployed dashboard are documented in
TERMS.md. - The hosted privacy policy is maintained in
frontend/privacy.html. https://mpmc.ddns.netremains a legacy trusted candidate, but the frontend will no longer treat it as the auth API unless it exposes the expected Continental ID health payload.- Login anti-bruteforce guardrails are configurable via
LOGIN_RATE_WINDOW_MS,LOGIN_RATE_MAX_ATTEMPTS, andLOGIN_BLOCK_MS. - Password updates invalidate existing refresh sessions and force re-login.
- Logout invalidates refresh sessions and clears auth cookie.
- Refresh cookies now use
SameSite=Laxfor same-origin HTTPS requests and only fall back toSameSite=Nonewhen the request is truly cross-site.