Skip to content

shivam-js/people-notes-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

People Notes API

A multi-user Notes REST API built using Node.js, Express.js, MongoDB Atlas, and JWT Authentication.

This project was developed as part of an Engineering Internship assignment.


Live API URL

Base URL

https://people-notes-api.onrender.com

Public Endpoints

Health Check

GET /

Response

{
  "message": "Notes API is running"
}

About Developer

GET /about

Response

{
  "name": "Shivam Prasad",
  "email": "prajapati2shivam@gmail.com",
  "my features": {
    "search": "Users can search their notes by keyword. I chose this because real notes apps need fast retrieval when users have many notes."
  }
}

OpenAPI Documentation

GET /openapi.json

Features

  • User Registration
  • User Login with JWT Authentication
  • Protected Notes Routes
  • Create Notes
  • Get All Notes
  • Get Single Note
  • Update Notes
  • Delete Notes
  • Share Notes with Another User
  • Search Notes by Keyword
  • MongoDB Atlas Integration
  • Secure Password Hashing using bcrypt
  • JWT Authorization Middleware
  • RESTful API Design
  • Hosted on Render

Tech Stack

Backend

  • Node.js
  • Express.js

Database

  • MongoDB Atlas
  • Mongoose

Authentication

  • JWT (jsonwebtoken)
  • bcryptjs

Deployment

  • Render

Installation

Clone Repository

git clone https://github.com/shivam-js/people-notes-api.git

Move Into Project Folder

cd people-notes-api

Install Dependencies

npm install

Environment Variables

Create a .env file in the root folder.

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key

Run Project

Development Mode

npm run dev

Production Mode

npm start

Authentication

Protected routes require JWT token.

Add token in headers:

Authorization: Bearer YOUR_TOKEN

API Endpoints

Authentication Routes


Register User

POST /register

Request Body

{
  "name": "Shivam",
  "email": "shivam@example.com",
  "password": "123456"
}

Login User

POST /login

Request Body

{
  "email": "shivam@example.com",
  "password": "123456"
}

Response

{
  "token": "jwt_token_here"
}

Notes Routes


Create Note

POST /notes

Request Body

{
  "title": "My Note",
  "content": "This is my note"
}

Get All Notes

GET /notes

Get Single Note

GET /notes/:id

Update Note

PUT /notes/:id

Request Body

{
  "title": "Updated Title",
  "content": "Updated Content"
}

Delete Note

DELETE /notes/:id

Response

204 No Content

Share Notes

Share Note with Another User

POST /notes/:id/share

Request Body

{
  "share_with_email": "friend@example.com"
}

Search Notes

Search Notes by Keyword

GET /notes/search?q=keyword

Project Structure

people-notes-api/
│
├── controllers/
│   ├── authController.js
│   └── noteController.js
│
├── middleware/
│   └── authMiddleware.js
│
├── models/
│   ├── User.js
│   └── Note.js
│
├── routes/
│   ├── authRoutes.js
│   └── noteRoutes.js
│
├── config/
│   └── db.js
│
├── server.js
├── package.json
├── .env
└── README.md

Security Features

  • Password hashing using bcrypt
  • JWT-based protected routes
  • Authorization checks for note ownership
  • Shared note access control
  • Environment variables for secrets

Testing

Tested using:

  • Thunder Client
  • Browser API testing
  • Render Deployment Logs

Deployment

This API is deployed on Render.

Live URL:

https://people-notes-api.onrender.com

Developer

Shivam Prasad

Email:

prajapati2shivam@gmail.com

GitHub:

https://github.com/shivam-js

Assignment Notes

This project was built to demonstrate:

  • REST API Design
  • Authentication & Authorization
  • MongoDB Relationships
  • Secure Backend Development
  • API Deployment
  • Clean Project Structure
  • Real-world Note Sharing Logic

About

Secure Notes Management REST API with JWT authentication, note sharing, search, and MongoDB integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors