A modern todo management application built with Next.js 14, TypeScript, and PostgreSQL. This project demonstrates full-stack web development with API routes, database integration, and modern React patterns.
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Database: PostgreSQL
- ORM: Prisma
- Styling: Tailwind CSS
- Validation: Yup
- Runtime: Node.js 20.x
- ✅ Full CRUD operations for todos
- 📊 RESTful API endpoints
- 🗃️ Database integration with Prisma ORM
- 🎨 Modern UI with Tailwind CSS
- 🔧 TypeScript for type safety
- 📦 Docker containerized database
- 🌱 Database seeding functionality
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/todos |
Retrieve todos with pagination |
| POST | /api/todos |
Create a new todo |
| PUT | /api/todos/[id] |
Update an existing todo |
| DELETE | /api/todos/[id] |
Delete a todo |
| GET | /api/seed |
Seed the database with sample data |
- Node.js 20.x
- npm 10.x
- Docker and Docker Compose
- Start the database
docker compose up -d- Copy environment template
cp .env.template .env- Configure environment variables
npm run dev (outside Docker), ensure DATABASE_URL in .env uses localhost:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"If running the app inside Docker, use the container name:
DATABASE_URL="postgresql://postgres:postgres@todos-db:5432/postgres"- Install dependencies
npm install- Setup database schema
npx prisma db push
npx prisma generate- Start development server
npm run dev- Seed the database (optional)
Visit http://localhost:3000/api/seed or run the endpoint to populate with sample data.
The application uses a simple Todo model:
model Todo {
id String @id @default(uuid())
description String
completed Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}npx prisma init # Initialize Prisma (already done)
npx prisma migrate dev # Create and apply migrations
npx prisma generate # Generate Prisma Client
npx prisma db push # Push schema changes to database
npx prisma studio # Open Prisma Studio (database GUI)├── prisma/
│ └── schema.prisma # Database schema
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── todos/ # Todo CRUD endpoints
│ │ │ └── seed/ # Database seeding
│ │ ├── globals.css # Global styles
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Home page
│ └── lib/
│ └── prisma.ts # Prisma client configuration
├── docker-compose.yml # PostgreSQL container setup
└── .env # Environment variables