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!