feat: add JWT auth with db-backed users
Some checks failed
Build & Release / build (push) Has been cancelled

- users table created on startup via migrate()
- POST /api/auth/setup to create first user (blocked once any user exists)
- POST /api/auth/login returns httpOnly JWT cookie (7d expiry)
- POST /api/auth/logout clears cookie
- GET /api/auth/me for auth check
- All /api/customers routes require valid JWT
- Frontend shows login form when unauthenticated
- Fix type errors in k8s, do, and pgbouncer services
This commit is contained in:
Ryan Moon
2026-04-03 07:41:36 -05:00
parent 8dbfb5810f
commit 4bd1918e3b
11 changed files with 267 additions and 20 deletions

View File

@@ -2,7 +2,8 @@
"name": "lunarfront-manager",
"scripts": {
"dev": "bun run --watch src/index.ts",
"start": "bun run src/index.ts"
"start": "bun run src/index.ts",
"typecheck": "tsc --noEmit"
},
"module": "index.ts",
"type": "module",
@@ -15,6 +16,8 @@
"typescript": "^5"
},
"dependencies": {
"@fastify/cookie": "^11.0.2",
"@fastify/jwt": "^10.0.0",
"@fastify/static": "^9.0.0",
"fastify": "^5.8.4",
"postgres": "^3.4.8",