A production-ready task management application built with Next.js App Router, MongoDB, and JWT authentication stored in HTTP-only cookies.
Before handing this repository over, update the placeholders below with your actual links after deployment:
- Live URL:
https://task-management-indol-phi.vercel.app/ - GitHub Repository:
https://github.com/SaratSatya/task_management
This repository now includes setup instructions, architecture documentation, deployment guidance, and sample API request/response documentation. The only remaining manual step is publishing the app to your hosting account and replacing the placeholders above with the real URLs.
- User signup, login, logout, and current-user APIs
- JWT authentication stored in secure HTTP-only cookies
- Protected frontend routes for authenticated task management
- Per-user task CRUD backed by MongoDB and Mongoose
- Paginated task listing with status filtering and title search
- Structured JSON success and error responses
- Encrypted task descriptions at rest before persistence
- Framework: Next.js 16 App Router
- Language: TypeScript
- Database: MongoDB with Mongoose
- Authentication: JWT in HTTP-only cookies
- Validation: Zod
- Styling: Tailwind CSS v4
- Password Hashing: bcryptjs
app/
api/ API route handlers
(auth)/ login and signup pages
dashboard/ protected task management UI
components/ shared client-side UI
lib/ auth, env, DB, encryption, validation helpers
models/ Mongoose schemas
public/ static assets
docs/ deployment, architecture, and API documentation
The application uses a server-first Next.js architecture:
- UI layer: App Router pages render the landing page, auth pages, and the protected dashboard.
- API layer: Route handlers under
app/api/**expose JSON endpoints for authentication, health checks, and task CRUD. - Auth layer: Successful login/signup issues a signed JWT that is stored in an HTTP-only cookie.
- Data layer: Mongoose models persist users and tasks in MongoDB.
- Security layer: Task descriptions are encrypted before being stored, and every task query is scoped to the authenticated user.
See docs/architecture.md for the detailed architecture explanation.
Create .env.local with the following values:
MONGODB_URI=mongodb://127.0.0.1:27017/task-management
JWT_SECRET=replace-with-a-secure-secret
TASK_ENCRYPTION_KEY=64-char-hex-string-for-aes-256-keyGenerate a valid encryption key with:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"npm installCreate .env.local using the values shown above.
npm run devOpen http://localhost:3000.
npm run lint
npm run buildThis project is ready to deploy to Vercel and can also run on any platform that supports Next.js server deployments.
- Push this repository to GitHub.
- Import the repository into Vercel.
- Set the following environment variables in the Vercel project:
MONGODB_URIJWT_SECRETTASK_ENCRYPTION_KEY
- Redeploy after confirming the environment variables are saved.
- Copy the generated Vercel production URL into the Live URL placeholder above.
- Use a hosted MongoDB instance such as MongoDB Atlas.
- Use a strong random
JWT_SECRET. - Use a 64-character hex key for
TASK_ENCRYPTION_KEY. - Secure cookies automatically enable
secure: truein production.
/— marketing landing page/signup— sign-up form/login— login form/dashboard— protected task dashboard
GET /api/healthGET /api/db-test
POST /api/auth/signupPOST /api/auth/loginPOST /api/auth/logoutGET /api/auth/me
GET /api/tasks?page=1&limit=10&status=pending&search=reportPOST /api/tasksGET /api/tasks/:taskIdPATCH /api/tasks/:taskIdDELETE /api/tasks/:taskId
Sample requests and responses are documented in docs/api.md.