This is a full-stack web application built using the MERN (MongoDB, Express, React, Node.js) stack. It includes user authentication and core functionalities connected to a backend API.
Intern/
βββ frontend/ # π§© Frontend React App
β βββ public/ # Static files (HTML, favicon, etc.)
β β βββ index.html
β β βββ favicon.ico
β βββ src/ # Source code
β β βββ api/ # API client setup (e.g., Axios)
β β βββ components/ # Reusable UI components
β β βββ context/ # React context providers
β β βββ pages/ # Route-level components
β β βββ styles/ # Tailwind or CSS files
β β βββ types/ # TypeScript interfaces/types
β β βββ App.tsx # Root component
β βββ .env # Environment variables
β βββ package.json # Project metadata & dependencies
β
βββ backend/ # π Backend Node.js Server
β βββ prisma/ # Prisma ORM schema and migrations
β β βββ schema.prisma # Database schema definition
β β βββ migrations/ # Auto-generated DB migrations
β βββ src/ # Application source code
β β βββ controllers/ # Request handlers
β β βββ middleware/ # Custom Express middlewares
β β βββ routes/ # API route definitions
β β βββ services/ # Business logic
β β βββ utils/ # Utility/helper functions
β β βββ index.ts # App entry point
β βββ .env # Backend environment variables
β βββ package.json # Backend dependencies
β
βββ README.md # π Project documentation
- Node.js
- TypeScript
- Express
- Prisma (ORM)
- SQLite (Dev DB) or other DB via
DATABASE_URL - JWT (Authentication)
- bcrypt (Password Hashing)
- Zod (Validation)
- React.js
- TypeScript
- Axios
- React Router
- TailwindCSS (if used)
- Node.js & npm
- Git
- SQLite (or your preferred DB setup)
- VS Code (Recommended)
git clone https://github.com/Krishnnavadiya/mern-project.git
cd mern-projectcd backend
npm installCreate a .env file in the backend folder:
DATABASE_URL="file:./dev.db"
JWT_SECRET="your-secret-key"
PORT=5000npx prisma generate
npx prisma migrate dev# Development
npm run dev
# Production
npm run build
npm start- Backend API:
http://localhost:5000/api - Health check:
http://localhost:5000/api/health
cd ../frontend
npm installnpm run dev- Frontend App:
http://localhost:5173(or your Vite port)
Use Postman or browser to test the following endpoints:
POST /api/auth/registerβ Register new userPOST /api/auth/loginβ LoginGET /api/healthβ Health check
| Script | Description |
|---|---|
npm run dev |
Run server in dev mode |
npm run build |
Build for production |
npm start |
Start production build |
npm test |
Run tests |
npm run lint |
Run ESLint |
npm run format |
Format code using Prettier |
| Script | Description |
|---|---|
npm run dev |
Start React dev server |
npm run build |
Build optimized production app |
npm run preview |
Preview built app |
-
Port Already in Use:
Change port in.envor kill the process using it. -
Database Issues:
RecheckDATABASE_URL
Use:npx prisma migrate reset
-
Dependency Errors:
rm -rf node_modules package-lock.json npm install
- Create new branches for new features
- Commit frequently with meaningful messages
- Run
npm run lintandnpm run formatbefore pushing - Keep code modular and readable
- Update README/API docs as needed
POST /api/auth/registerβ RegisterPOST /api/auth/loginβ Login
More routes available inside
backend/src/routes/
- Backend: Host on Render, Railway, or Vercel (API)
- Frontend: Host on Netlify or Vercel
Krishn Navadiya
GitHub: @Krishnnavadiya