A beautiful, modern todo management application built with Next.js, Express.js, PostgreSQL, and Prisma. Features a stunning UI with dark mode support, responsive design, and user authentication.
- Next.js 15 - React framework with Turbopack
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Beautiful icon library
- Shadcn - Accessible UI components
- Express.js - Node.js web framework
- Prisma - Next-generation ORM
- PostgreSQL - Robust relational database
- JWT - JSON Web Tokens for authentication
- bcryptjs - Password hashing
git clone https://github.com/nafisnihal/postgres-express-nextjs-nodejs.git
cd postgres-express-nextjs-nodejs# Install root dependencies
npm install
# Install all project dependencies (frontend + backend)
npm run install:all- Create a PostgreSQL database named
todoapp - Copy the backend environment file:
cd backend cp .env.example .env - Update
backend/.envwith your database credentials:DATABASE_URL="postgresql://username:password@localhost:5432/todoapp" JWT_SECRET="your-super-secret-jwt-key" PORT=5000
Use services like Supabase, PlanetScale, or Neon for easy setup.
cd backend
npx prisma migrate dev --name init
npx prisma generateFrom the root directory:
npm run start:dev# Start both frontend and backend in development mode
npm run start:dev
# Install dependencies for all projects
npm run install:all
# Build the frontend for production
npm run build
# Start production servers
npm run start# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linting
npm run lint# Start development server with hot reload
npm run dev
# Start production server
npm start
# Run Prisma migrations
npx prisma migrate dev
# Generate Prisma client
npx prisma generate
# Open Prisma Studio (database GUI)
npx prisma studiofullstack-todo-app/
├── frontend/ # Next.js frontend application
│ ├── app/ # Next.js 13+ app directory
│ │ ├── login/ # Login page
│ │ ├── layout.js # Root layout with header
│ │ ├── page.js # Home page
│ │ └── globals.css # Global styles
│ ├── components/ # React components
│ │ ├── ui/ # Reusable UI components
│ │ ├── layout/ # Layout components
│ │ └── TodoApp.jsx # Main todo component
│ └── lib/ # Utility functions
├── backend/ # Express.js backend application
│ ├── routes/ # API routes
│ │ ├── todos.js # Todo CRUD operations
│ │ └── users.js # User authentication
│ ├── middleware/ # Custom middleware
│ ├── prisma/ # Database schema and migrations
│ ├── utils/ # Utility functions
│ └── index.js # Main server file
└── package.json # Root package.json for scripts
DATABASE_URL="postgresql://username:password@localhost:5432/todoapp"
JWT_SECRET="your-super-secret-jwt-key-make-it-long-and-random"
PORT=5000POST /api/users/register- Register new userPOST /api/users/login- Login user
GET /api/todos- Get user's todosPOST /api/todos- Create new todoPUT /api/todos/:id- Update todoDELETE /api/todos/:id- Delete todo
- Verify PostgreSQL is running
- Check database credentials in
.env - Ensure database exists
- Run migrations:
npx prisma migrate dev
# Regenerate Prisma client
npx prisma generate
# Reset database (⚠️ This will delete all data)
npx prisma migrate reset