Skip to content

Add real backend: JWT auth, SQLite user storage, server-side file uploads#5

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/make-login-working
Draft

Add real backend: JWT auth, SQLite user storage, server-side file uploads#5
Copilot wants to merge 2 commits intomainfrom
copilot/make-login-working

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

Login was entirely frontend-simulated with no persistence. This adds a Node.js/Express backend with real auth, a SQLite database, and authenticated file uploads.

Backend (server/)

  • server/index.js — Express API with:
    • POST /api/auth/register / POST /api/auth/login — bcrypt-hashed passwords, JWT (7-day) response
    • GET /api/auth/me — token validation for session restore
    • POST /api/upload — multer-based image/audio upload (20 MB limit, mime-type validated), stored under server/uploads/, recorded in DB
    • SQLite schema (users, uploads) auto-created via better-sqlite3
    • Rate limiting on all routes via express-rate-limit (20 req/15 min auth, 10 req/min upload)
    • Production guard: throws at startup if JWT_SECRET env var is unset when NODE_ENV=production

Frontend

  • Login.js — Login/Register tabs; calls real API via axios; stores JWT in localStorage; surfaces server error messages
  • App.js — Restores session on mount via GET /api/auth/me; clears JWT on logout; removed Google-login stub
  • AdminPanel.js — POSTs files to /api/upload with ******; shows local blob preview immediately while upload completes async

Config

  • Root package.json: "proxy": "http://localhost:5000", npm run dev via concurrently, npm run server
  • .gitignore: excludes server/uploads/ and server/blebetalo.db
npm run dev   # Express on :5000 + React on :3000

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Add working login functionality with database storage Add real backend: JWT auth, SQLite user storage, server-side file uploads Mar 22, 2026
Copilot AI requested a review from codenimar March 22, 2026 11:23
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.

2 participants