Full Stack MERN
Dashboard App
A simple full-stack web application built authentication, protected routes, and CRUD operations using React (Vite) for the frontend and Node.js + Express + MongoDB for the backend.
This project was created as a learning exercise to understand how frontend and backend communicate in a real-world setup.
- User Registration
- User Login
- Protected Dashboard (only accessible when logged in)
- Create, Read, Update, and Delete (CRUD) posts
- Logout functionality
- REST API integration
- React (Vite)
- React Router
- Axios
- Context API (AuthContext)
- Node.js
- Express.js
- MongoDB
- Mongoose
- backend/
- ββ src/
- ββ config/
- β ββ constants.js
- β ββ database.js
- β
- ββ controllers/
- β ββ user.controller.js
- β ββ post.controller.js
- β
- ββ models/
- β ββ user.model.js
- β ββ post.model.js
- β
- ββ routes/
- β ββ user.route.js
- β ββ post.route.js
- β
- ββ index.js
- frontend/
- ββ src/
- ββ api/ # Axios API calls
- β ββ postApi.js
- β ββ userApi.js
- β
- ββ Auth/ # Authentication pages
- β ββ Login.jsx
- β ββ Register.jsx
- β
- ββ components/ # Reusable components
- β ββ Navbar.jsx
- β ββ ProtectedRoute.jsx
- β ββ StyledWrapper.jsx
- β
- ββ context/ # Global state (Auth)
- β ββ AuthContext.jsx
- β
- ββ pages/ # Main pages
- β ββ Dashboard.jsx
- β
- ββ App.jsx
- ββ main.jsx
π API Endpoints (Backend) Auth
- POST /api/v1/users/register
- POST /api/v1/users/login
- POST /api/v1/users/logout
Posts
- POST /api/v1/posts/create
- GET /api/v1/posts/getPosts
- PATCH /api/v1/posts/update/:id
- DELETE /api/v1/posts/delete/:id
π§ What I Learned
- How React Context works for authentication
- How protected routes work using React Router
- How to connect frontend and backend using Axios
- How REST APIs handle CRUD operations
- Debugging common frontend/backend issues (CORS, routes, HTTP methods)
πΈ Screenshots
Author: Lester Laroya


