A full-stack (MERN) Note-taking application built with React (frontend), Node.js + Express (backend), and MongoDB (database).
This README explains how the application works, its architecture, prerequisites, required environment variables, and how to run both the frontend and backend locally for development.
/
├── backend/ # Express API (Node.js)
│ ├── models/ # Mongoose models
│ ├── routes/ # Express routes
│ ├── controllers/ # Route handlers / logic
│ ├── .env.example # Example environment variables
│ └── server.js # Main entry point for backend
├── frontend/ # React application
│ ├── public/
│ ├── src/
│ └── package.json
└── README.md
- Location:
frontend/ - Built with React (JavaScript), providing a responsive and interactive UI for note-taking.
- Communicates with the backend via HTTP requests (usually to
/api/notes,/api/users, etc). - Handles user authentication (login/signup), note creation, editing, deletion, and visualization.
- Location:
backend/ - RESTful API built with Node.js and Express.
- Handles user authentication, CRUD operations for notes, and connects to MongoDB.
- Uses environment variables for sensitive data (MongoDB URI, JWT secret, etc).
- Has error handling and input validation for reliability and security.
- Stores users and notes.
- Accessed by the backend via Mongoose ODM.
- Node.js (v18 or higher recommended)
- npm (comes with Node.js)
- MongoDB Atlas account or local MongoDB server
Create a .env file in the backend/ directory.
You can copy .env.example as a template:
cp backend/.env.example backend/.envRequired variables:
PORT=5000 # Backend server port
MONGODB_URI=mongodb+srv://... # Your MongoDB connection string
JWT_SECRET=your_jwt_secret # Secret key for JWT signingNote: Never commit your real
.envto version control.
cd backend
npm installcd ../frontend
npm install- If using Atlas: ensure your cluster is running.
- If using local MongoDB: make sure
mongodis running.
cd backend
npm run dev- Backend API will run at
http://localhost:5000
cd ../frontend
npm start- React app will run at
http://localhost:3000and proxy API requests to the backend.
- Make sure the
proxyfield infrontend/package.jsonis set to the backend URL (usually"proxy": "http://localhost:5000"). - If you change ports or API paths, update them in both frontend and backend accordingly.
- The backend uses JWT for authentication. Make sure your
JWT_SECRETis strong and private. - CORS is enabled for frontend-backend communication during development.
- Test user signup, login, note creation, editing, and deletion.
- Check network requests in browser dev tools for error messages.
- Backend logs errors to the console.
- For production, build the frontend and serve static files from Express, or deploy frontend and backend separately (e.g., Vercel/Netlify + Render/Heroku).
- Set environment variables in your cloud environment.
Q: What if I get MongoDB connection errors?
A: Check your MONGODB_URI in .env and ensure your IP is whitelisted in Atlas.
Q: How do I reset my notes/users?
A: Drop the relevant collections in your MongoDB database.
MIT
Enjoy fast, secure, and reliable note-taking!