Taskify Backend is a secure RESTful API built with Express.js and MongoDB. It powers the Taskify task management app, providing endpoints for user authentication and personal task management.
-
User Authentication:
- Signup and login with JWT-based session management.
- Passwords are securely hashed with bcrypt.
- Input validation with Zod for strong security.
- All protected routes require a valid token.
-
Task Management:
- Create, read, update, and delete your own tasks.
- Strict validation for all fields and enums.
- Each task supports title, description, priority tag, deadline, status (section), and done flag.
- Fetch all tasks or a specific task by ID.
-
Secure & Modular:
- All user and task data is scoped per user.
- Modular route structure for users and todos.
- Uses environment variables for secrets and database config.
- Node.js & Express.js – Core server and routing
- MongoDB & Mongoose – Database and models
- jsonwebtoken – JWT authentication
- bcrypt – Password hashing
- zod – Input validation
- dotenv – Environment configuration
- cors – Cross-origin support
taskify-backend/
│
├── index.js # Entry point for the Express app
├── database/ # MongoDB models (User, Todo)
├── middleware/ # Authentication middleware
├── routes/
│ ├── user.js # User authentication and user-specific routes
│ └── todo.js # Task CRUD routes
├── package.json
├── .env.example # Example environment variables
├── package.json
├── .env # Environment variables
└── README.mdgit clone https://github.com/jaiswalism/taskify-backend.git
cd taskify-backendnpm install- Copy
.env.exampleto.env:
cp .env.example .env- Fill in your actual values in the
.envfile:
| Variable | Description |
|---|---|
| MONGODB_URI | Your MongoDB connection string |
| JWT_SECRET | Secret key for JWT token signing |
| PORT | Port number for the server (e.g. 3000) |
npm run dev
The API will be available at http://localhost:3000 (or your specified port).
All protected routes require a valid JWT token in the Authorization header.
-
POST /signup
Register a new user (name,email,password). -
POST /login
Log in and receive a JWT token (email,password). -
POST /logout
Log out the current user. -
GET /todos
Get all todos for the authenticated user.
-
POST /
Create a new todo (title,description,tag,deadline,section). -
PUT /
Update an existing todo by matchingtitleanddescription(fields:title,description, plus new values:newTitle,newDescription,newTag,newDeadline,newSection). -
DELETE /
Delete a todo by matchingtitle,description, andtag. -
DELETE /:id
Delete a todo by its unique ID. -
GET /
Get all todos for the authenticated user. -
GET /:id
Get a single todo by its unique ID.
- Make sure MongoDB is running and accessible.
- This backend is designed to work seamlessly with the Taskify Frontend.
- See
.env.examplefor required environment variables. - All input is validated and passwords are securely hashed for your safety.