A full-stack CRUD application built to learn and practice Node.js, Express.js, and MongoDB — with a React + Vite frontend styled using Tailwind CSS.
Backend
- Node.js + Express.js (v5)
- MongoDB + Mongoose
- bcrypt (password hashing)
- dotenv, cors, nodemon
Frontend
- React 18 + Vite
- Tailwind CSS
- Axios
- React Router DOM
- User registration with hashed passwords
- User login / logout
- Protected routes (localStorage-based session)
- Create, Read, Update, Delete posts
- User profile page
Node_Revision/
├── backend/
│ └── src/
│ ├── config/
│ │ └── database.js
│ ├── controllers/
│ │ ├── user_controller.js
│ │ └── post_controller.js
│ ├── models/
│ │ ├── user_model.js
│ │ └── post_model.js
│ ├── routes/
│ │ ├── user_route.js
│ │ └── post_route.js
│ ├── app.js
│ └── index.js
├── frontend/
│ └── src/
│ ├── api/
│ │ └── axios.js
│ ├── components/
│ │ ├── Navbar.jsx
│ │ └── PostCard.jsx
│ ├── context/
│ │ └── AuthContext.jsx
│ ├── pages/
│ │ ├── Register.jsx
│ │ ├── Login.jsx
│ │ ├── Posts.jsx
│ │ └── Profile.jsx
│ ├── App.jsx
│ └── main.jsx
├── package.json
└── README.md
- Node.js v18+
- MongoDB (local or Atlas)
- npm or bun
git clone https://github.com/morningstar004/Node_Revision.git
cd Node_RevisionCreate a .env file inside backend/:
PORT=4050
MONGO_URI=your_mongodb_connection_stringInstall dependencies and start the backend:
npm install
npm run devThe backend will run at http://localhost:4050
cd frontend
npm install
npm run devThe frontend will run at http://localhost:5173
Base URL: http://localhost:4050/api/v1
| Method | Endpoint | Description | Body |
|---|---|---|---|
| POST | /users/register |
Register a new user | { username, email, password } |
| POST | /users/login |
Login a user | { email, password } |
| POST | /users/logout |
Logout a user | { email } |
| Method | Endpoint | Description | Body |
|---|---|---|---|
| GET | /posts |
Get all posts | — |
| POST | /posts/create |
Create a new post | { name, description, age } |
| PATCH | /posts/update/:id |
Update a post | { name, description, age } |
| DELETE | /posts/delete/:id |
Delete a post | — |
- Passwords are hashed using bcrypt before being stored in MongoDB.
- Authentication is session-less — the logged-in user object is stored in
localStorage. - There is no JWT implementation; this project is intended for learning core backend concepts.
Pranjal — @morningstar004
ISC