iNotebook is a full-stack MERN application that enables users to securely create, read, edit, and delete notes in the cloud. Equipped with JSON Web Token (JWT) authentication, password hashing, and real-time state management via the React Context API.
- Key Features
- Tech Stack
- System Architecture
- Project Directory Structure
- API Reference
- Getting Started
- Building & Deployment
- License & Author
-
π Robust Authentication & Security:
- Secure user registration and login with salt-hashed passwords via
bcryptjs. - Stateless session authorization using JSON Web Tokens (JWT).
- Protected API routes verified via custom
fetchusermiddleware. - User-isolated data: each user can strictly access and modify their own notes.
- Secure user registration and login with salt-hashed passwords via
-
π Full CRUD Note Management:
- Create: Add notes with title, description, and custom tags.
- Read: Fetch and display notes belonging exclusively to the authenticated user.
- Update: Modal-based in-place editing with live state synchronization.
- Delete: Instant deletion of notes with confirmation feedback.
-
β‘ Modern Frontend Experience:
- Built with React 19 and bundled using Vite for ultra-fast Hot Module Replacement (HMR).
- State management powered by React Context API (
NoteContext) to prevent prop drilling. - Client-side routing with
react-router-dom(v7), including automatic redirects for unauthenticated routes. - Responsive, clean UI designed with Bootstrap 5 and FontAwesome iconography.
- Interactive dismissible alert banners for user actions.
-
π Developer Productivity:
- Unified script using
concurrentlyto boot up both the Vite frontend and Express nodemon backend with a single command.
- Unified script using
- Library: React 19
- Bundler & Dev Server: Vite 8
- Router: React Router DOM v7
- Styling: Bootstrap 5
- Icons: FontAwesome
- Runtime: Node.js
- Framework: Express 5
- Database & ODM: MongoDB with Mongoose 9
- Security & Validation:
jsonwebtokenβ Session tokensbcryptjsβ Password hashingexpress-validatorβ Request body sanitization and validationcorsβ Cross-Origin Resource Sharing
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React 19 Frontend β
β (Vite Dev Server :5173 | Context API | React Router) β
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
HTTP Requests (CORS Enabled)
Header: auth-token: <JWT>
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Express.js Backend β
β (Port 5000) β
β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ β
β β /api/auth Routes β β /api/notes Routes β β
β ββββββββββββ¬ββββββββββββ ββββββββββββ¬ββββββββββββ β
β β β β
β βΌ βΌ β
β [bcryptjs & JWT] [fetchuser MW] β
βββββββββββββββ¬ββββββββββββββββββββββββββββ¬βββββββββββββββ
β β
βββββββββββββββ¬ββββββββββββββ
βΌ
ββββββββββββββββββββββββββ
β MongoDB Database β
β (Users & Notes Docs) β
ββββββββββββββββββββββββββ
inotebook/
βββ backend/
β βββ middleware/
β β βββ fetchuser.js # JWT extraction and verification middleware
β βββ models/
β β βββ Notes.js # Mongoose schema for Notes
β β βββ User.js # Mongoose schema for Users
β βββ routes/
β β βββ auth.js # Authentication routes (/createuser, /login, /getuser)
β β βββ notes.js # CRUD routes (/fetchallnotes, /addnote, /updatenote, etc.)
β βββ db.js # MongoDB connection setup
β βββ index.js # Express server entry point
β βββ package.json # Backend dependencies and scripts
βββ public/ # Static assets
βββ src/
β βββ assets/ # Images and illustrations
β βββ components/
β β βββ About.jsx # About page component
β β βββ AddNote.jsx # Form to add new notes
β β βββ Alert.jsx # Dynamic alert feedback component
β β βββ Home.jsx # Main home dashboard component
β β βββ Login.jsx # User login view
β β βββ Navbar.jsx # Responsive navigation bar
β β βββ NoteItem.jsx # Individual note card component
β β βββ Notes.jsx # Note list & edit modal container
β β βββ Signup.jsx # User registration view
β βββ context/
β β βββ notes/
β β βββ noteContext.jsx # React Context creation
β β βββ NoteState.jsx # Global note state provider and API dispatchers
β βββ App.css
β βββ App.jsx # Application root with routing & alerts
β βββ index.css
β βββ main.jsx # React DOM entry point
βββ index.html # Main HTML template
βββ package.json # Root scripts and frontend dependencies
βββ vercel.json # Single-page application rewrites for deployment
βββ vite.config.js # Vite configuration
Base URL: http://localhost:5000
| Method | Endpoint | Description | Auth Required | Request Body |
|---|---|---|---|---|
POST |
/api/auth/createuser |
Register a new user account | β No | { "name", "email", "password" } |
POST |
/api/auth/login |
Log in and receive JWT token | β No | { "email", "password" } |
POST |
/api/auth/getuser |
Fetch current user profile | β
Yes (auth-token) |
None |
{
"success": true,
"authToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}All notes routes require the
auth-tokenheader containing a valid JWT.
| Method | Endpoint | Description | Header Required | Request Body |
|---|---|---|---|---|
GET |
/api/notes/fetchallnotes |
Retrieve all notes for logged-in user | auth-token: <TOKEN> |
None |
POST |
/api/notes/addnote |
Add a new note | auth-token: <TOKEN> |
{ "title", "description", "tag" } |
PUT |
/api/notes/updatenote/:id |
Update an existing note by ID | auth-token: <TOKEN> |
{ "title"?, "description"?, "tag"? } |
DELETE |
/api/notes/deletenote/:id |
Delete an existing note by ID | auth-token: <TOKEN> |
None |
Follow these steps to set up and run iNotebook locally on your machine.
Ensure you have the following installed:
- Node.js (v18.x or later recommended)
- npm (bundled with Node.js)
- MongoDB installed and running locally on port
27017(or a MongoDB Atlas connection string)
-
Clone the repository:
git clone https://github.com/Alaqmar-Yousuf/iNotebook.git cd inotebook -
Install root & frontend dependencies:
npm install
-
Install backend dependencies:
cd backend npm install cd ..
The backend connects to MongoDB via backend/db.js. By default, it targets:
const mongoUri = "mongodb://localhost:27017/inotebook";Ensure MongoDB service is active:
- Windows: Start the MongoDB service via
services.mscornet start MongoDB. - macOS / Linux:
brew services start mongodb-communityorsudo systemctl start mongod.
(Optional) You can customize your JWT Secret inside backend/routes/auth.js or migrate to a .env configuration file for production security.
You can launch both the frontend and backend simultaneously or independently.
From the project root:
npm run bothThis boots:
- Client:
http://localhost:5173 - Server:
http://localhost:5000
-
Start the backend server:
cd backend npx nodemon index.js -
Start the frontend development server:
# From the root directory npm run dev -
Open http://localhost:5173 in your browser.
To generate an optimized production bundle:
npm run buildThe output will be created inside the dist/ directory.
The project includes a vercel.json configured with SPA rewrites to ensure clean client-side routing on platforms like Vercel:
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
}- Author: Alaqmar Yousuf
- License: Licensed under the ISC License.