This project is a simple Note Making Application created using MERN Stack. The main motive behind developing this project was to learn full-stack web application development using MERN Stack.
This project helped me learn the fundamentals of:
- React Hooks
- MongoDB Schema and Validations
- API Versioning
- Modular Design of Project
- Centralized Error Handling
- JWT Authentication
- Docker and Containerization
Visit the live app here: https://inotebook-aayush.vercel.app/
To clone the repository, open git bash in your desired directory and execute the below given command:
git clone https://github.com/aayush7908/Note-Application.git
After this, a new directory named Note-Application will be created within the current working directory.
Create a .env file in that folder with following key-value pairs:
REACT_APP_API_BASE_URL=http://localhost:5000/api/v2
JWT_SECRET=YOUR_JWT_SECRET
MONGO_URI=mongodb://database/inotebook
GMAIL_APP_PASSWORD=<YOUR_GOOGLE_APP_PASSWORD>
GMAIL_SENDER=<EMAIL_ADDRESS_OF_ACCOUNT_LINKED_WITH_ABOVE_APP_PWD>
GMAIL_RECEIVER=<EMAIL_ADDRESS_OF_RECEIVER>
PORT=5000
After .env file is ready, use the following docker command to run the application:
docker-compose up --build -d
INFO: Docker will create three containers, one for each of Frontend, Backend and MongoDB Database. These containers will run in background. If you don't want them to run in background, then remove -d flag from docker command
After this, your application is ready. Visit following URL in your browser:
http://localhost:3000
To stop these containers, you can use the command:
docker-compose down
.
├── backend # express.js backend_
│ ├── config # configuration files for mongoDB database_
│ ├── middleware # middlewares for request processing_
│ ├── models # models for data storage_
│ ├── routes # API endpoints_
│ └── utils # utility functions used across the application_
│
└── frontend # react.js frontend_
└── src
├── assets # static assets for the application_
├── components # reusable components_
├── context # context for global state management_
├── pages # pages which for specifc routes_
├── services # service methods to request backend API_
└── utils # utility functions used across the application_
POST: /auth/register: Register a new userPOST: /auth/login: Login using email and passwordPOST: /auth/forgot-password/otp/send: Send OTP to verify email for password reset servicePOST: /auth/forgot-password/otp/verify: Verify OTP for password reset servicePOST: /auth/forgot-password/reset-password: Reset password
GET: /user/authenticate: Authenticate user using JWT tokenGET: /user/get: Get details of the authenticated userPATCH: /user/update/name: Update name of the authenticated userDELETE: /user/delete: Delete the authenticated user
POST: /note/create: Create notePUT: /note/update/:id: Update note by IDDELETE: /note/delete/:id: Delete note by IDGET: /note/get/one/:id: Get note by IDGET: /note/get/all: Get all notes created by the authenticated user
- If there is an error in any API, the error is passed to a Centralized Error Handler.
- Error is checked and if it is found to be critical, an email containing error stack trace is sent to the developer's email address.
- Notes can be searched with keywords.
- Provided keywords will be matched for Title, Content as well as Tags of the Notes.
- In one fetch request, only some fixed number of notes are fetched.
- This helps reducing latency, and thus improves user experience.
- Focus on the scroll bar to see how new contents are loaded (fetched from Database), as user reaches to end of scroll.
- While logging in, if the user checks this option, he will be remembered for next 7 days.
- Created Admin Panel for user and note management.
- Used
Dockerto containerize the application.