Full-stack portfolio website with separate frontend and backend.
portfolio/
├── frontend/ # React + Vite frontend
│ ├── src/
│ │ ├── assets/ # Images and static files
│ │ ├── components/ # React components
│ │ │ ├── layout/ # Navbar, Footer
│ │ │ ├── ui/ # Reusable UI components
│ │ │ └── features/ # Feature-specific components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API service layer
│ │ ├── constants/ # App constants
│ │ └── styles/ # Global styles
│ ├── public/ # Public assets
│ └── package.json
│
├── backend/ # Node.js + Express backend
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # Request handlers
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Express middleware
│ │ ├── data/ # Static data
│ │ └── utils/ # Helper functions
│ ├── server.js # Entry point
│ └── package.json
│
└── package.json # Root package.json for scripts
- React 19 - UI library
- Vite - Build tool
- React Router - Routing
- Tailwind CSS - Styling
- Framer Motion - Animations
- Node.js - Runtime
- Express - Web framework
- Nodemailer - Email service
- CORS - Cross-origin support
- Node.js (v18 or higher)
- npm or yarn
- Clone the repository
git clone <your-repo-url>
cd portfolio- Install all dependencies
npm run install:allOr install manually:
# Install root dependencies
npm install
# Install frontend dependencies
cd frontend
npm install
# Install backend dependencies
cd ../backend
npm install- Configure environment variables
Frontend (frontend/.env):
VITE_API_URL=http://localhost:3001/apiBackend (backend/.env):
PORT=3001
NODE_ENV=development
CORS_ORIGIN=http://localhost:5173
# Email Configuration (Gmail SMTP)
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
CONTACT_TO_EMAIL=your-email@gmail.comRun both frontend and backend:
npm run devRun separately:
# Frontend only (from root)
npm run dev:frontend
# Backend only (from root)
npm run dev:backendOr run from individual folders:
# Frontend
cd frontend
npm run dev
# Backend
cd backend
npm run dev- Frontend: http://localhost:5173
- Backend: http://localhost:3001
npm run buildThis builds the frontend for production in frontend/dist/
# Start backend
npm run start:backend
# Serve frontend build with a static server
cd frontend/dist
npx serveGET /api/portfolio- Get all portfolio dataGET /api/portfolio/personal- Personal informationGET /api/portfolio/hero- Hero section dataGET /api/portfolio/about- About sectionGET /api/portfolio/experience- Work experienceGET /api/portfolio/skills- Skills and technologiesGET /api/portfolio/projects- Project showcaseGET /api/portfolio/contact- Contact information
POST /api/contact- Submit contact form{ "name": "John Doe", "email": "john@example.com", "message": "Hello!" }
GET /api/health- Server health status
- ✅ Responsive design with Tailwind CSS
- ✅ Smooth animations with Framer Motion
- ✅ Custom React hooks for API calls
- ✅ Centralized API service layer
- ✅ Component-based architecture
- ✅ Clean folder structure
- ✅ RESTful API design
- ✅ MVC architecture
- ✅ Email integration with Nodemailer
- ✅ Error handling middleware
- ✅ Request logging
- ✅ CORS configuration
- ✅ Environment-based configuration
- Scalable - Easy to add new features
- Maintainable - Clear organization
- Reusable - Shared components and hooks
- Testable - Isolated components
- Modular - Separated concerns
- Clean - MVC pattern
- Extensible - Easy to add routes/controllers
- Professional - Industry standards
-
Frontend Development
- Components are in
frontend/src/components/ - Use the
useApihook for API calls - Add new pages in
frontend/src/pages/ - Update routes in your router configuration
- Components are in
-
Backend Development
- Add new routes in
backend/src/routes/ - Create controllers in
backend/src/controllers/ - Business logic goes in
backend/src/services/ - Update portfolio data in
backend/src/data/portfolio.data.js
- Add new routes in
-
Styling
- Use Tailwind utility classes
- Global styles in
frontend/src/styles/ - Component-specific styles inline or in CSS modules
npm run dev- Run both frontend and backendnpm run dev:frontend- Run frontend onlynpm run dev:backend- Run backend onlynpm run install:all- Install all dependenciesnpm run build- Build frontend for productionnpm run start:backend- Start backend in production
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
npm run dev- Start with auto-reloadnpm start- Start production server
| Variable | Description | Default |
|---|---|---|
VITE_API_URL |
Backend API URL | http://localhost:3001/api |
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3001 |
NODE_ENV |
Environment | development |
CORS_ORIGIN |
Allowed origin | * |
SMTP_USER |
Gmail address | - |
SMTP_PASS |
Gmail app password | - |
CONTACT_TO_EMAIL |
Recipient email | Same as SMTP_USER |
- Build command:
npm run build - Output directory:
dist - Set environment variable:
VITE_API_URL
- Root directory:
backend - Start command:
npm start - Set all backend environment variables
Port already in use:
# Kill process on port 3001 (backend)
npx kill-port 3001
# Kill process on port 5173 (frontend)
npx kill-port 5173Module not found:
# Reinstall dependencies
npm run install:allCORS errors:
- Check
CORS_ORIGINin backend.env - Ensure frontend URL matches
MIT
Smitraj Makvana
- GitHub: @Smitraj24
- LinkedIn: smitrajmakvana