A minimal MERN starter template featuring JWT authentication and a cat-themed frontend. This template helps you quickly set up a full-stack application with a modular folder structure.
- Clone the repository:
git clone https://github.com/iamsaura8h/MERN-Minima.git
- Remove the existing git folder:
cd MERN-Minima rm -rf .git - Initialize a new git repository:
git init git add . git commit -m "Initial commit"
- Install dependencies in both directories:
cd backend npm install cd ../frontend npm install
- Add
.envfiles with the following values:- backend/.env
MONGO_URI=mongodb://localhost:27017/minima JWT_SECRET=your_jwt_secret - frontend/.env
VITE_API_BASE_URL=http://localhost:5000 VITE_CAT_API=https://cataas.com/cat?json=true
- backend/.env
- Start the backend and frontend servers:
# In backend/ node index.js # In frontend/ npm run dev
Your MERN app is now ready for development.
- Backend: Express and MongoDB (ESM modules)
- Frontend: React, Vite, TypeScript, and Tailwind CSS
- JWT authentication with
usernameandpassword(optionalemail) - Protected routes (Home page)
- Dynamic navbar (shows login/logout)
- Landing page with random cat images
- Simple and easy-to-understand folder structure
backend/
├── config/
├── controllers/
├── middleware/
├── models/
├── routes/
└── index.js
frontend/
├── src/
│ ├── components/
│ ├── contexts/
│ ├── hooks/
│ ├── pages/
│ ├── App.tsx
│ └── main.tsx
├── .env
└── index.html
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login and receive JWT token |
| GET | /api/auth/me |
Get current user info (protected) |
| GET | /api/cat |
Get a random cat image |
| Path | Component/Page | Description |
|---|---|---|
/ |
Landing | Cat-themed landing page |
/login |
Login | User login form |
/register |
Register | User registration form |
/home |
Home (Protected) | Protected user dashboard |
* |
NotFound | 404 fallback page |
If you find this project helpful, please consider giving it a ⭐ on GitHub!
Your feedback, issues, and pull requests are always welcome.
Thank you for checking out MERN Minima! Happy coding!