Authentication System
Installation
SKILL.md
Authentication System Guide
Docklift uses a token-based authentication system (JWT) to secure the API and frontend.
Components
- Routes:
backend/src/routes/auth.ts - Middleware:
backend/src/lib/authMiddleware.ts - Frontend Context:
frontend/components/AuthProvider.tsx - Frontend API Helper:
frontend/lib/auth.ts - Database Model:
User(email, password hash, role).
Auth Flow
- Registration:
POST /api/auth/register- Only allows registration if zero users exist in the database (first user becomes admin).