TaskMaster is a full‑stack task management app built with Next.js App Router. It features email/password authentication, MongoDB persistence, dark mode, rich task metadata (priority, category, due date, reminder), filtering, quick stats, and a polished UI.
- Next.js 15 (App Router)
- React 19
- NextAuth.js (Credentials provider, JWT sessions)
- MongoDB + Mongoose
- Tailwind CSS + PostCSS
- next-themes (dark mode)
- Heroicons
- Secure auth with email/password (JWT sessions)
- Create, read, update, and delete personal tasks
- Task attributes: title, description, category, priority, due date, reminder
- Custom categories (persisted locally) + filters (status, due date, priority)
- Dashboard with quick stats and category breakdown
- Responsive UI with light/dark theme toggle
- Node.js 18.18+ or 20+
- A MongoDB connection string (Atlas or local)
npm install
Create a .env.local
file in the project root:
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=replace-with-a-strong-random-string
MONGODB_URI=mongodb+srv://<user>:<password>@<cluster>/<db>?retryWrites=true&w=majority
Tips to generate a secret (any strong random string works):
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
npm run dev
App will be available at http://localhost:3000
.
npm run dev
: Start the Next.js dev servernpm run build
: Build for productionnpm run start
: Start the production servernpm run lint
: Run Next.js ESLint
src/
app/
api/
auth/[...nextauth]/route.js # NextAuth credentials provider
users/signup/route.js # Sign‑up endpoint
tasks/route.js # GET (list), POST (create) tasks
tasks/[id]/route.js # PUT (update), DELETE (remove) task
components/ # Navbar, Footer, DarkModeToggle, etc.
dashboard/page.js # Main authenticated dashboard
login/ # Login page and form
signup/ # Sign-up page
layout.js, page.js, globals.css # App shell & styles
lib/dbConnect.js # MongoDB connection helper
models/User.js # User schema
models/Task.js # Task schema
- Credentials-based login via NextAuth.js
- JWT session strategy; user id is added to the token and session
- UI routes:
/login
,/signup
Environment variables used by auth and database:
NEXTAUTH_URL=...
NEXTAUTH_SECRET=...
MONGODB_URI=...
All task endpoints require an authenticated session.
POST /api/users/signup
{
"name": "Jane Doe",
"email": "jane@example.com",
"password": "password123"
}
Responses
- 201 Created:
{ success: true, user: { ...without password } }
- 400/503/500:
{ error: string }
GET /api/tasks
- Returns the current user’s tasks sorted by creation date
POST /api/tasks
{
"title": "Finish report",
"description": "Q3 results",
"category": "Work",
"dueDate": "2025-01-25",
"reminder": null,
"priority": "High"
}
PUT /api/tasks/{id}
{ "completed": true }
DELETE /api/tasks/{id}
- Tailwind configured in
tailwind.config.js
- Dark mode handled via
next-themes
(class strategy)
The app is optimized for deployment on Vercel.
- Push to a Git repo (GitHub/GitLab/etc.)
- Import the repo in Vercel
- Set the environment variables (
NEXTAUTH_URL
,NEXTAUTH_SECRET
,MONGODB_URI
) - Deploy
For custom servers, build and run:
npm run build
npm run start
- Ensure your
MONGODB_URI
is correct and accessible from your environment - Make sure
NEXTAUTH_SECRET
is set; auth will fail without it - If you change env vars, restart the dev server
This project is provided as-is; add your preferred license if you plan to distribute.