A modern, full-stack task management application built with Next.js 15, featuring user authentication and comprehensive task management capabilities.
This Task Manager application allows authenticated users to efficiently manage their personal tasks. Users can create, view, update, and delete tasks with features like priority levels, status tracking, and advanced filtering options.
- π User Authentication: Secure sign-up and login system
- β Task Management: Complete CRUD operations for tasks
- π― Priority Levels: Categorize tasks as low, medium, or high priority
- π Status Tracking: Mark tasks as pending or completed
- π Advanced Filtering: Sort and filter tasks by priority and status
- π± Responsive Design: Works seamlessly on desktop and mobile devices
- β‘ Real-time Updates: Instant feedback with optimistic UI updates
- π‘οΈ Data Validation: Comprehensive validation on both client and server
- π Task Privacy: Users can only access their own tasks
- Frontend: Next.js 15 (App Router), React, TypeScript
- UI Components: Shadcn/ui, Tailwind CSS
- Backend: Next.js API Routes
- Database: PostgreSQL
- ORM: Prisma
- Validation: Zod
- Authentication: JWT with secure HTTP-only cookies
- State Management: React hooks and context
- Form Handling: React Hook Form
- Node.js 18+
- PostgreSQL database
- npm package manager
git clone https://github.com/adnan425/task-manager
cd task-manager
npm install
# or
yarn install
Create a .env
file in the root directory with the following variables:
DATABASE_URL="postgresql://neondb_owner:npg_kohf2WpULz9a@ep-shy-sea-a41r6vji-pooler.us-east-1.aws.neon.tech/neondb?sslmode=require"
JWT_SECRET="fsfrr32fsfrew"
NEXT_PUBLIC_API_URL="http://localhost:3000"
# Generate Prisma client (with custom output path)
npx prisma generate
# Run database migrations
npx prisma migrate dev
Note: The Prisma client is generated in src/generated/prisma
as configured in the schema.
npm run dev
# or
yarn dev
The application will be available at http://localhost:3000
For testing purposes, you can use the following default credentials:
- Email: [email protected]
- Password: Adnan425@@
task-manager/
βββ app/ # Next.js 15 app directory
β βββ (auth)/ # Authentication pages
β β βββ sign-in/ # Login page
β β βββ sign-up/ # Registration page
β βββ api/ # API routes
β β βββ sign-in/ # Login API endpoint
β β βββ sign-up/ # Registration API endpoint
β β βββ tasks/ # Tasks CRUD API endpoints
β βββ globals.css # Global styles
βββ components/ # React components
β βββ tasks/ # Task-related components
β β βββ TableHeader.tsx
β β βββ TableList.tsx
β β βββ TaskForm.tsx
β βββ ui/ # Shadcn UI components
β βββ Header.tsx
βββ generated/ # Generated files
β βββ prisma/ # Prisma client
βββ hooks/ # Custom React hooks
β βββ auth/ # Authentication hooks
β βββ useSignIn.ts
β βββ useSignUp.ts
β βββ useTasks.ts # Tasks management hook
βββ lib/ # Utility functions and configurations
β βββ axiosInstance.ts # Axios configuration
β βββ config.ts # App configuration
β βββ logoutAction.ts # Logout server action
β βββ prisma.ts # Prisma client instance
β βββ utils.ts # Utility functions
β βββ withAuth.ts # Authentication middleware
βββ prisma/ # Database schema and migrations
β βββ schema.prisma # Prisma schema definition
βββ schemas/ # Zod validation schemas
βββ middlewares/ # Middleware functions
POST /api/sign-up
- User registrationPOST /api/sign-in
- User login
GET /api/tasks
- Get all tasks for authenticated userPOST /api/tasks
- Create a new taskPUT /api/tasks/[id]
- Update a specific taskDELETE /api/tasks/[id]
- Delete a specific task
- JWT tokens stored in HTTP-only cookies
- Secure password hashing with bcrypt
- Protected routes with middleware
- Zod schemas for request validation
- Client-side form validation
- Server-side data integrity checks
- Real-time updates with optimistic UI
- Advanced filtering and sorting
- Pagination for large datasets
model User {
id String @id @default(cuid())
email String @unique
password String // Hashed password
firstName String
lastName String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Task Task[]
}
model Task {
id String @id @default(cuid())
title String
description String
priority Priority
status Status
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
user User @relation(fields: [userId], references: [id])
}
enum Priority {
low
medium
high
}
enum Status {
pending
completed
}
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
-
Next.js 15 with App Router: Chosen for its excellent developer experience, built-in API routes, and server-side rendering capabilities.
-
Prisma ORM: Selected for its type safety, excellent TypeScript integration, and ease of use with PostgreSQL.
-
Shadcn/ui: Provides accessible, customizable components that integrate well with Tailwind CSS.
-
Zod Validation: Enables consistent validation across client and server with TypeScript integration.
-
JWT Authentication: Offers a stateless authentication solution that scales well.
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js team for the amazing framework
- Shadcn for the beautiful UI components
- Prisma team for the excellent ORM