server.js
Entry point: initializes Express app, middleware, and starts HTTP server
config/db.js
PostgreSQL connection pool setup using pg and environment variables
config/jwt.js
JWT secret config and token generation/verification helpers
middleware/auth.js
JWT authentication middleware that validates Bearer tokens on protected routes
middleware/roles.js
Role-based access control middleware supporting admin and member roles
middleware/errorHandler.js
Global error handling middleware that formats and returns consistent error responses
routes/auth.js
Auth routes: POST /register and POST /login returning JWT tokens
routes/projects.js
CRUD routes for projects: list, create, get by ID, update, delete
routes/tasks.js
CRUD routes for tasks nested under projects: create, list, update, mark complete, delete
routes/users.js
Admin-only user management routes: list users, update roles, deactivate accounts
controllers/authController.js
Business logic for user registration, password hashing with bcrypt, and login
controllers/projectsController.js
Business logic for project CRUD with ownership and membership checks
controllers/tasksController.js
Business logic for task CRUD including due date handling and completion toggling
controllers/usersController.js
Business logic for admin user management operations
models/userModel.js
SQL query functions for user table: findById, findByEmail, create, updateRole
models/projectModel.js
SQL query functions for projects table: CRUD and membership lookups
models/taskModel.js
SQL query functions for tasks table: CRUD, filter by project, mark complete
db/migrations/001_create_users.sql
Creates users table with id, email, password_hash, role, created_at columns
db/migrations/002_create_projects.sql
Creates projects table with id, name, description, owner_id, created_at columns
db/migrations/003_create_project_members.sql
Creates project_members join table for role-based project membership
db/migrations/004_create_tasks.sql
Creates tasks table with id, project_id, title, description, due_date, completed, assignee_id, created_at
db/seed.js
Optional seed script to insert demo admin user and sample project/tasks
utils/validate.js
Input validation helpers using express-validator for request body sanitization
.env.example
Template for required environment variables: DATABASE_URL, JWT_SECRET, PORT
package.json
Project dependencies and npm scripts for start, dev, and migrate
README.md
API documentation with endpoint list, auth instructions, and setup guide