A lightweight, yet deeply structured task management application built with Node.js and Express β designed to showcase backend development skills and architectural understanding.
- β Full CRUD Operations: Create, Read, Update, and Delete tasks
- β Task Completion Status: Mark tasks as completed or incomplete
- β RESTful API: Clean and well-defined API endpoints
- β
Robust Error Handling:
- Custom API errors for specific HTTP statuses
- Asynchronous error wrapping to simplify try-catch blocks
- Dedicated middleware for handling 404 (Not Found) routes
- β MongoDB Integration: Persistent data storage using MongoDB with Mongoose ODM
- β Basic Frontend: Simple, vanilla JavaScript-powered web interface
- β
Environment Variable Management: Secure handling of sensitive data with
.env
Planner Flow/
βββ controllers/ # π¦ API endpoint logic (CRUD operations for tasks)
β βββ tasks.js
βββ db/ # πΎ Database connection setup
β βββ connect.js
βββ errors/ # β Custom error classes and helpers
β βββ custom-error.js
βββ middleware/ # βοΈ Express middleware functions (async handling, error handling, 404)
β βββ async.js
β βββ error-handler.js
β βββ not-found.js
βββ model/ # π Mongoose data models
β βββ Task.js
βββ public/ # π Static frontend files (HTML, CSS, client-side JS)
β βββ browser-app.js
β βββ edit-task.js
β βββ favicon.ico
β βββ index.html
β βββ main.css
β βββ normalize.css
β βββ task.html
βββ routes/ # π£οΈ Express route definitions for API endpoints
β βββ tasks.js
βββ .env # π Environment variables (ignored by Git)
βββ .gitignore # π« Files/folders to exclude from Git tracking
βββ app.js # π Main application entry point
βββ package-lock.json # π Exact dependency versions
βββ package.json # π¦ Project metadata and dependencies
- app.js initializes the Express server, sets up middleware, and defines API routes
- db/connect.js establishes a MongoDB connection using Mongoose
- routes/tasks.js defines API endpoints (
/api/v1/tasks
) for HTTP methods - controllers/tasks.js contains the core logic for each API operation
- model/Task.js defines the Mongoose schema for a Task document
- middleware/async.js wraps async controller functions for error handling
- middleware/error-handler.js centrally handles all application errors
- public/ serves static HTML, CSS, and client-side JS (browser-app.js, edit-task.js) which interact with the backend API using axios
- Node.js: v14 or higher
- MongoDB: Local or cloud instance (e.g., MongoDB Atlas)
-
Clone the project:
git clone [Your Project's GitHub Link] cd "Planner Flow"
-
Install dependencies:
npm install
-
Configure environment variables:
Create a.env
file in the project root and add:MONGO_URI=mongodb+srv://<YOUR_USERNAME>:<YOUR_PASSWORD>@<YOUR_CLUSTER_URL>/TaskManagerDB?retryWrites=true&w=majority
MONGO_URI
: Your MongoDB connection stringPORT
: Server port (defaults to 6000 if not set)
- Production:
node app.js
- Development (with auto-restart):
npm start
- Open your browser to http://localhost:PORT/
- Add new tasks using the input field
- View, edit, or delete existing tasks from the list
- Navigate to
task.html?id=<taskID>
to directly edit a specific task
- Low-level understanding of Node.js HTTP server and Express.js routing
- Building and consuming RESTful APIs
- Database integration with MongoDB and Mongoose
- Effective error handling strategies
- Middleware pattern implementation
- Frontend-backend integration using vanilla JavaScript and Axios
- Environment variable management
- Modular and organized project structure
Custom-built by Shayan Sharifi as a personal project for understanding the depths of Node.js and Express.
It serves as a foundational example of a full-stack application, focusing on backend robustness and clear architecture.
Feel free to fork and expand it into your own task management system or use it as a learning resource!
MIT