Skip to content

Fix backend auth, DB wiring, and frontend API_BASE handling - #5

Merged
iamnotelias merged 7 commits into
mainfrom
iamnotelias-fix-backend-auth
Aug 9, 2026
Merged

iamnotelias merged 7 commits into
mainfrom
iamnotelias-fix-backend-auth

Conversation

@iamnotelias

Copy link
Copy Markdown
Collaborator

Why

Fixes runtime and deployment issues preventing the frontend from reaching the backend and new users from registering. The frontend showed “Failed to fetch” because API_BASE was hard-coded and the backend had path/import errors so it could not start reliably in deployed environments.

What changed (approach)

  • Frontend: api.js now reads window.API_BASE or a runtime value and falls back to same-origin /api. Added the meta tag to index/register/login so deployments can set the backend URL. Hides raw reg numbers in the nav and uses an example format on the landing card.
  • Backend: fixed require paths (regFormat import, auth -> auth2, papers requires local modules), corrected bad-words import so the screening pipeline constructs properly, and validated the server starts locally.
  • Verified: ran local health, register, and login endpoints against the SQLite dev.db to confirm DB writes and JWT token issuance.

Notes and follow-ups

  • On Railway, set a persistent path for SQLite (SQLITE_DB_PATH) or migrate to Postgres for production. Ensure a writable persistent volume is mounted so dev.db survives restarts.
  • Ensure JWT_SECRET is set in Railway environment (you said it is). If the frontend is hosted on Vercel, either set the meta to your Railway public API URL in the HTML before deploy or inject window.API_BASE at runtime.
  • No PR template found in .github; kept description concise and focused on the why and approach.

If you want, I can (a) update the HTML meta tags with your exact Railway public URL and push, or (b) open the PR as-is for review.

Admin and others added 6 commits August 9, 2026 18:03
…-base meta tags

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ning, categorize)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Vercel didn’t deploy this pull request to the eliashubber1-6807's projects team.

GitHub couldn’t verify an account for commit 624fdb2. Vercel blocks this deployment before it can verify the account’s access to the team.

Review the commit before changing settings. If you don’t recognize it, don’t deploy it. Ask a repository administrator to investigate.

If you do recognize it, verify the commit email in GitHub, connect that GitHub account to Vercel, then create a new commit and deploy again.

Check your GitHub commit email · Troubleshoot Vercel access

Commit: 624fdb201ad21039370d9aa4cdecaaa4d4e5dca1

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
past-paper Error Error Aug 9, 2026 3:33pm

@iamnotelias
iamnotelias merged commit e223daf into main Aug 9, 2026
1 of 3 checks passed

This branch was previously deployed

1 inactive deployment
Preview — 624fdb20 Deployed Aug 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant