This guide walks you through setting up and running the frontend application on your local machine.
Before you begin, ensure you have the following installed:
- Node.js v18 or higher (Download)
- npm or yarn package manager
- Bash terminal (Git Bash on Windows, native terminal on Linux/macOS)
- Backend API running (Backend Repository)
The start.sh script automatically handles dependency installation, environment setup, and development server startup.
git clone https://github.com/fraidakis/software-engineering-2-frontend.git
cd software-engineering-2-frontendRun the start script in a Bash terminal:
bash start.shThe script will:
- ✅ Install dependencies (
npm install) - ✅ Create
.envfile from.env.exampleif it doesn't exist - ✅ Start the development server on
http://localhost:3000
Once the server is running:
- Frontend:
http://localhost:3000 - Backend API: Must be running on
http://localhost:3001
If you prefer manual setup or need more control:
npm installOr using yarn:
yarn installCreate a .env file in the root directory:
cp .env.example .envEdit .env with your configuration:
# Port number for the development server
PORT=3000
# Backend API URL
REACT_APP_API_URL=http://localhost:3001npm startOr using yarn:
yarn startThe application will open automatically in your browser at http://localhost:3000.
The frontend requires the backend API to be running. Follow these steps:
# In a separate terminal window
git clone https://github.com/fraidakis/software-engineering-2-backend.git
cd software-engineering-2-backend
bash start.sh📖 For detailed backend setup, see: Backend Getting Started Guide
Check the backend health endpoint:
curl http://localhost:3001/healthExpected response:
{
"status": "healthy",
"timestamp": "2025-12-05T10:30:00.000Z"
}| Variable | Description | Default | Required |
|---|---|---|---|
PORT |
Development server port | 3000 |
No |
REACT_APP_API_URL |
Backend API base URL | http://localhost:3001 |
Yes |
Note: All custom environment variables must be prefixed with REACT_APP_ to be accessible in React.
-
Start Backend (in terminal 1):
cd software-engineering-2-backend npm start -
Start Frontend (in terminal 2):
cd software-engineering-2-frontend npm start -
Open Browser: Navigate to
http://localhost:3000 -
Make Changes: Edit files in
src/- hot module replacement will automatically refresh -
Test Changes: Use the application or run tests
Open your browser and navigate to http://localhost:3000. You should see the homepage with:
- Header with navigation
- Featured places
- Login/Signup buttons
- Click "Sign Up" and create a test account
- Login with your credentials
- Access protected pages (Recommendations, Profile, etc.)
Open browser console (F12) and check for:
- ✅ No CORS errors
- ✅ Successful API responses
- ✅ Authentication tokens being sent
Run tests in interactive mode:
npm run cypress:openRun tests in headless mode:
npm run cypress:runRun specific test file:
npx cypress run --spec "cypress/e2e/auth_happy_unhappy.cy.js"The E2E test suite includes:
- 15+ Authentication tests - Login, signup, logout flows
- 30+ Happy path tests - Complete user journeys
- 20+ Unhappy path tests - Error handling and validation
📖 For detailed testing documentation, see: ../cypress/README.md
Error: Something is already running on port 3000
Solution 1: Change the port in .env:
PORT=3001Solution 2: Kill the process using the port:
# On Linux/macOS
lsof -ti:3000 | xargs kill
# On Windows
netstat -ano | findstr :3000
taskkill /PID <PID> /FError: Network Error or CORS policy errors
Solutions:
- Verify backend is running:
curl http://localhost:3001/health - Check
REACT_APP_API_URLin.envmatches backend URL - Ensure backend CORS is configured to allow frontend origin
- Check backend
.envhas:CORS_ORIGIN=http://localhost:3000
Error: 401 Unauthorized or 403 Forbidden
Solutions:
- Clear browser localStorage:
localStorage.clear() - Log out and log back in to get fresh token
- Check token expiration in backend JWT_SECRET
- Verify authentication token in browser DevTools → Application → Local Storage
Error: undefined when accessing process.env.REACT_APP_*
Solutions:
- Ensure variable name starts with
REACT_APP_ - Restart development server after changing
.env - Clear cache:
npm startor deletenode_modules/.cache
Error: Module not found or dependency errors
Solutions:
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install
# Or using yarn
rm -rf node_modules yarn.lock
yarn installError: Tests timeout or fail unexpectedly
Solutions:
- Ensure backend is running with test data
- Clear browser data in Cypress
- Check
cypress.config.jsbase URL matches your setup - Run tests individually to isolate issues
npm run buildThis creates an optimized production build in the build/ directory.
# Install serve globally
npm install -g serve
# Serve the build
serve -s build -l 3000The production build includes:
- ✅ Minified JavaScript and CSS
- ✅ Optimized images
- ✅ Code splitting
- ✅ Tree shaking
- ✅ Source maps for debugging
The application supports:
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
Minimum versions:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
- ES7+ React/Redux/React-Native snippets - Code snippets
- ESLint - Code quality
- Prettier - Code formatting
- Auto Rename Tag - HTML tag editing
- Path Intellisense - File path autocomplete
- React Developer Tools - Component inspection
- Redux DevTools - State management debugging (if applicable)
Now that your frontend is running:
- 🏗️ Explore the Architecture - Understand the codebase structure
- 🧪 Run the Tests - Learn about E2E testing
- 🔌 Backend API Docs - Understand the API
- 🌐 Try the App - Start exploring features
- Architecture: See Architecture Guide
- Testing: See Cypress E2E README
- CI/CD: See GitHub Workflows README
- Backend Issues: See Backend Docs
- API Reference: Visit
http://localhost:3001/api-docswhen backend is running