Skip to content

Icedmist/mern_thinkboard

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‹ MERN ThinkBoard

A RESTful notes management API built with Express.js and MongoDB

Node.js Express.js MongoDB License: ISC


πŸ“– Overview

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.

Who is this for?

  • 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

🌐 Live Preview

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.


✨ Features

  • 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 (createdAt descending)
  • Proper Error Handling β€” Try-catch blocks with structured JSON error responses and 404 handling for missing resources
  • Auto Timestamps β€” Every note automatically tracks createdAt and updatedAt via Mongoose timestamps
  • ES Modules β€” Uses modern JavaScript import/export syntax throughout
  • Environment Configuration β€” Database URI and port are configurable via .env file using dotenv
  • Hot Reloading β€” Development server uses nodemon for automatic restarts on file changes

πŸ›  Tech Stack

Layer Technology
Runtime Node.js
Framework Express.js
Database MongoDB
ODM Mongoose
Dev Server Nodemon
Config dotenv
Language JavaScript

πŸš€ Getting Started

Prerequisites

Make sure you have the following installed:

Installation

  1. Clone the repository

    git clone https://github.com/SirGhaniR/mern_thinkboard.git
    cd mern_thinkboard
  2. Install dependencies

    cd backend
    npm install
  3. Configure environment variables

    Create a .env file inside the backend/ directory:

    touch .env

    Add the following variables:

    MONGODB_URI=mongodb://localhost:27017/thinkboard
    PORT=5001

    Replace the MONGODB_URI value with your MongoDB Atlas connection string if using a cloud database.

  4. Start the development server

    npm run dev

    The server will start on http://localhost:5001 (or the port you specified in .env).

  5. Start in production mode

    npm start

πŸ“ Project Structure

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

πŸ“ Usage

API Endpoints

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 β€”

Example Requests

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/notes

Update 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>

Response Format

All responses follow a consistent JSON structure:

{
  "success": true,
  "message": "Notes has been fetched successfully",
  "data": [ ... ]
}

On error:

{
  "success": false,
  "message": "Note not found"
}

🀝 Contributing

Contributions are welcome! Whether you're fixing a bug, improving documentation, or suggesting a new feature β€” your help is appreciated.

How to Contribute

  1. Fork the repository
  2. Create a feature branch from main
    git checkout -b feat/your-feature-name
  3. Make your changes and commit with clear, descriptive messages
    git commit -m "feat: add your feature description"
  4. Push to your fork
    git push origin feat/your-feature-name
  5. Open a Pull Request against the main branch

Reporting Bugs

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)

Suggesting Features

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

Guidelines

  • Follow the existing code style (camelCase naming, ES module imports)
  • Keep commits focused and atomic
  • Reference related issues in your PR description

πŸ“„ License

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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%