π CivicTwin AI Getting Started Guide
"From theory to practice β Deploy CivicTwin AI today"
π System Requirementsβ
Prerequisitesβ
- Node.js: v16+
- npm or yarn: v7+
- PostgreSQL: v12+
- PostGIS: v3.0+ (PostgreSQL extension)
- Docker (optional, but recommended)
Environmentβ
- OS: Linux, macOS, or Windows (WSL2)
- RAM: Minimum 8GB
- Disk: 20GB (for data and models)
π§ Quick Setup (5 minutes)β
Step 1: Clone Repositoryβ
git clone https://github.com/asean-ai/civic-twin.git
cd civic-twin
Step 2: Install Dependenciesβ
npm install
# or
yarn install
Step 3: Configure Environmentβ
Create a .env file in the root directory:
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/civic_twin
POSTGIS_ENABLED=true
# AI Core
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
# API
PORT=3000
NODE_ENV=development
# Maps
MAPBOX_TOKEN=your_mapbox_token
Step 4: Initialize Databaseβ
npm run migrate
npm run seed # (if sample data is needed)
Step 5: Run the Applicationβ
npm start
The application will run at http://localhost:3000
π³ Setup with Docker (Recommended)β
Step 1: Build Docker Imageβ
docker-compose build
Step 2: Start Containersβ
docker-compose up -d
Step 3: Check Statusβ
docker-compose ps
All services will be running:
- API Backend: http://localhost:3000
- Frontend: http://localhost:5173
- PostgreSQL: localhost:5432
- Redis (cache): localhost:6379
π Project Structureβ
civic-twin/
βββ src/
β βββ services/ # Microservices
β β βββ DigitalTwin/ # Digital Twin engine
β β βββ Prediction/ # AI prediction
β β βββ Simulation/ # What-If scenario
β β βββ Dashboard/ # Decision support
β βββ pages/ # Frontend pages
β βββ css/ # Styling
β βββ api/ # API routes
βββ docs/ # Documentation
βββ docker-compose.yml # Docker configuration
βββ package.json
βββ README.md
β Verify Installationβ
1. Check APIβ
curl http://localhost:3000/api/health
# Result: {"status": "ok", "timestamp": "2026-03-31T..."}
2. Access Frontendβ
Open browser: http://localhost:5173
3. Create a Test Projectβ
- Log in with demo account
- Select "Create New Scenario"
- Draw a road on the map
- View prediction results
π¨ Troubleshootingβ
Error: "Connection refused" (PostgreSQL)β
# Check if PostgreSQL is running
sudo service postgresql status
# Or if using Docker
docker-compose ps postgres
Error: "Port 3000 already in use"β
# Find process using port 3000
lsof -i :3000
# Or specify a different port
PORT=3001 npm start
Error: "AWS credentials not found"β
Check that the .env file contains AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Or configure AWS CLI:
aws configure
π Next Stepsβ
- System Architecture β Understand the detailed design
- Build Without Docker β If you prefer not to use Docker
- Services β Learn about each microservice
- API Documentation β List of API endpoints
π‘ Development Tipsβ
Hot Reload Frontendβ
npm run dev # Automatically reloads when code changes
Debug Backendβ
DEBUG=* npm start # View detailed logs
Reset Databaseβ
npm run migrate:reset
npm run seed
π Need Help?β
- π See System Architecture for more design details
- π Report bugs: GitHub Issues
- π¬ Discussions: GitHub Discussions
π Licenseβ
This project is distributed under the GNU General Public License v3.0. See the LICENSE file for details.
Β© 2025 CivicTwin AI β Developed with β€οΈ by the ASEAN-AI-DZ Team