This guide explains how to set up and run the backend and frontend services for the City Digital Twin project in a local development environment.
Make sure you have the following installed:
- Node.js (v16 or higher recommended)
- npm (Node Package Manager)
- Git
city-digital-twin/
├── backend/
│ ├── .env
│ └── (source code)
└── frontend/
├── .env
└── (source code)
Before running the project, you need to create .env files for both backend and frontend.
Create backend/.env:
ENDPOINT_URL=http://your-graphdb-endpoint-url
Replace http://your-graphdb-endpoint-url with your actual GraphDB endpoint.
Create frontend/.env:
REACT_APP_API_URL=http://localhost:3000
This tells the frontend where to send API requests. (It should points to the backend address)
You can use the provided script to automatically install dependencies and start both services.
On Windows: Run the run_windowns.bat script.
On Mac: Run the run_shell script.
Step to run backend (run backend first)
cd backend/
npm install
npx nodemon index.js &
Step to run frontend
cd frontend
npm install
npm run dev-start- The backend server (API) will start on port
3000. - The frontend React development server will start on port
3001or3000(depending on configuration). - When you stop the frontend (CTRL+C), the backend server will also be stopped automatically.
- Make sure to update the
.envfiles with your actual API endpoints. - This script is intended for development only — for production use Docker-based deployment.
- If you modify the backend code,
nodemonwill auto-restart the server.