A modern portfolio website built with the MERN stack (MongoDB, Express, React, Node.js). The frontend is built with React and Vite, while the backend uses Express.js and MongoDB for data management.
This project follows a MERN-stack architecture:
- Frontend (Client): React + Vite application located in
/client - Backend (Server): Node.js + Express API located in
/server - Database: MongoDB for storing projects, skills, and contact messages
my_profile/
├── client/ # React + Vite frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── assets/ # Images and static assets
│ │ └── utils/ # API utilities
│ ├── public/ # Public assets
│ ├── package.json
│ └── vite.config.js
├── server/ # Node.js + Express backend
│ ├── config/ # Database configuration
│ ├── controllers/ # Route controllers
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── index.js # Server entry point
│ └── package.json
└── package.json # Root package.json for managing both apps
- Node.js (v16 or higher)
- MongoDB (local installation or MongoDB Atlas)
- npm or yarn
-
Clone the repository (if applicable)
git clone <repository-url> cd my_profile
-
Install all dependencies
npm run install:all
This will install dependencies for:
- Root project (concurrently for running both apps)
- Client (React frontend)
- Server (Express backend)
-
Backend Environment Variables
Create a
.envfile in theserver/directory:PORT=5000 MONGO_URI=mongodb://localhost:27017/portfolio
For MongoDB Atlas, use:
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/portfolio
-
Frontend Environment Variables
Create a
.envfile in theclient/directory (optional):VITE_API_BASE_URL=http://localhost:5000/api
If not set, it defaults to
http://localhost:5000/api
Run both frontend and backend concurrently:
npm run devThis will start:
- Frontend dev server on
http://localhost:5173(Vite default) - Backend API server on
http://localhost:5000
Frontend only:
npm run dev:clientBackend only:
npm run dev:serverBackend production:
npm run start:serverThe backend provides the following REST API endpoints:
GET /api/projects- Get all projectsPOST /api/projects- Create a new project (admin)
GET /api/skills- Get all skills organized by categories
POST /api/contact- Submit a contact form messageGET /api/contact- Get all contact messages (admin)
GET /api/health- Server health status
The application uses MongoDB to store:
- Projects: Portfolio projects with details, tech stack, and links
- Skills: Technical skills organized by categories
- Contact Messages: Form submissions from the contact page
On first run, the API returns mock data if the database is empty. You can populate the database through the API endpoints or MongoDB directly.
- React Components: Modular, reusable components
- Vite: Fast build tool and dev server
- Tailwind CSS: Utility-first CSS framework
- Framer Motion: Smooth animations
- Responsive Design: Mobile-first approach
- React 18
- Vite
- Tailwind CSS
- Framer Motion
- React Icons
- Node.js
- Express.js
- MongoDB
- UI Consistency: The UI remains simple.
- Data Flow: Frontend components fetch data from the backend API instead of using hardcoded data.
- Image Handling: Images are still served from the frontend assets, but paths are mapped from API responses.
- Error Handling: The frontend gracefully handles API errors and falls back to empty states.
Build the frontend for production:
npm run buildThe built files will be in client/dist/ directory.
This project is private and for portfolio purposes.