MERN ThinkBoard is a backend REST API for managing notes, built as the server-side foundation of a full MERN stack application. It provides a complete set of CRUD endpoints for creating, reading, updating, and deleting notes, backed by MongoDB for persistent storage.
The project follows a clean MVC architecture with separated concerns β routes, controllers, models, and configuration β making it easy to understand, extend, and integrate with any frontend client.
- Developers learning the MERN stack who want a clean, well-structured backend reference
- Contributors looking for an open-source project to practice with
- Anyone needing a lightweight notes API to integrate with a frontend application
No live deployment is currently available. This is a backend API that runs locally and requires a MongoDB connection. See Getting Started to run it on your machine.
- Full CRUD Operations β Create, read, update, and delete notes via RESTful endpoints
- Versioned API β All routes are namespaced under
/api/v1/for clean API versioning - Sorted Results β Notes are automatically returned sorted by newest first (
createdAtdescending) - Proper Error Handling β Try-catch blocks with structured JSON error responses and 404 handling for missing resources
- Auto Timestamps β Every note automatically tracks
createdAtandupdatedAtvia Mongoose timestamps - ES Modules β Uses modern JavaScript
import/exportsyntax throughout - Environment Configuration β Database URI and port are configurable via
.envfile using dotenv - Hot Reloading β Development server uses nodemon for automatic restarts on file changes
| Layer | Technology |
|---|---|
| Runtime | |
| Framework | |
| Database | |
| ODM | |
| Dev Server | |
| Config | |
| Language |
Make sure you have the following installed:
- Node.js (v18 or higher)
- npm (comes with Node.js)
- MongoDB β either a local instance or a MongoDB Atlas cloud cluster
-
Clone the repository
git clone https://github.com/SirGhaniR/mern_thinkboard.git cd mern_thinkboard -
Install dependencies
cd backend npm install -
Configure environment variables
Create a
.envfile inside thebackend/directory:touch .env
Add the following variables:
MONGODB_URI=mongodb://localhost:27017/thinkboard PORT=5001
Replace the
MONGODB_URIvalue with your MongoDB Atlas connection string if using a cloud database. -
Start the development server
npm run dev
The server will start on
http://localhost:5001(or the port you specified in.env). -
Start in production mode
npm start
mern_thinkboard/
βββ .github/
β βββ ISSUE_TEMPLATE/
β βββ bug_report.md # Bug report issue template
β βββ feature_request.md # Feature request issue template
βββ backend/
β βββ src/
β β βββ config/
β β β βββ db.js # MongoDB connection logic using Mongoose
β β βββ controllers/
β β β βββ notesController.js # CRUD handlers for notes (get, create, update, delete)
β β βββ models/
β β β βββ Note.js # Mongoose schema & model for Note (title, content, timestamps)
β β βββ routes/
β β β βββ notesRoutes.js # Express router mapping HTTP methods to controller functions
β β βββ app.js # Application entry point β Express server setup & middleware
β βββ .gitignore # Node.js gitignore (includes .env, node_modules, etc.)
β βββ package.json # Project metadata, scripts, and dependencies
β βββ package-lock.json # Locked dependency tree
βββ README.md
All endpoints are prefixed with /api/v1/notes.
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
GET |
/api/v1/notes |
Fetch all notes (newest first) | β |
GET |
/api/v1/notes/:id |
Fetch a single note by ID | β |
POST |
/api/v1/notes |
Create a new note | { "title": "...", "content": "..." } |
PUT |
/api/v1/notes/:id |
Update an existing note | { "title": "...", "content": "..." } |
DELETE |
/api/v1/notes/:id |
Delete a note by ID | β |
Create a note:
curl -X POST http://localhost:5001/api/v1/notes \
-H "Content-Type: application/json" \
-d '{"title": "My First Note", "content": "This is the content of my note."}'Fetch all notes:
curl http://localhost:5001/api/v1/notesUpdate a note:
curl -X PUT http://localhost:5001/api/v1/notes/<note_id> \
-H "Content-Type: application/json" \
-d '{"title": "Updated Title", "content": "Updated content."}'Delete a note:
curl -X DELETE http://localhost:5001/api/v1/notes/<note_id>All responses follow a consistent JSON structure:
{
"success": true,
"message": "Notes has been fetched successfully",
"data": [ ... ]
}On error:
{
"success": false,
"message": "Note not found"
}Contributions are welcome! Whether you're fixing a bug, improving documentation, or suggesting a new feature β your help is appreciated.
- Fork the repository
- Create a feature branch from
maingit checkout -b feat/your-feature-name
- Make your changes and commit with clear, descriptive messages
git commit -m "feat: add your feature description" - Push to your fork
git push origin feat/your-feature-name
- Open a Pull Request against the
mainbranch
Found a bug? Open a bug report using the provided issue template. Include:
- A clear description of the bug
- Steps to reproduce the behavior
- Expected vs. actual behavior
- Screenshots (if applicable)
Have an idea? Submit a feature request using the provided template. Describe:
- The problem your feature would solve
- Your proposed solution
- Any alternatives you've considered
- Follow the existing code style (camelCase naming, ES module imports)
- Keep commits focused and atomic
- Reference related issues in your PR description
This project is licensed under the ISC License β see the package.json for details.
Built with β€οΈ by SirGhaniR and contributors
β Star this repo if you find it helpful!