Simple JWT-protected Todo backend built with Node.js, Express, Prisma (PostgreSQL), and bcrypt.
- Register and login (hashed passwords, JWT auth)
- Create todos with text and deadline
- View incomplete and completed lists
- Mark complete
- Delete todos
- Node.js >= 18
- PostgreSQL
- npm
- Enter server directory and install
cd server
npm install- Create .env
PORT=3000
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DB_NAME?schema=public"
JWT_SECRET="your-random-secret"- Migrate database and generate Prisma client
npx prisma migrate dev --name init- Run
node index.js
# http://localhost:3000- Register a user, then log in to get a JWT token.
- Add the token to requests using: Authorization: Bearer .
- Use protected routes to create/list/update/delete your todos.
- JWT expires in 1 hour by default.
- Prisma client is generated into src/generated/prisma.