tpt-smartcity

JavaScript

Open-source smart city management platform — real-time traffic, energy grid, water utility, public safety, environmental monitoring, 3D digital twin & AI cross-domain orchestration. Self-hostable. MIT licensed.

0 stars0 forks0 watchersMIT License
digital-twindockerenergy-managementiotjavascriptopen-sourcepublic-safetypwasmart-citytraffic-managementwater-utility

Languages

JavaScript65.6%HTML29.7%PLpgSQL3.2%HCL1.0%Dockerfile0.4%CSS0.0%
README

TPT Smart City Platform

Enterprise grade open source smart city management platform. A complete modular system for operating an entire modern city with real-time monitoring, automation, and cross-domain optimization.


🚀 Quick Start

# Clone repository
git clone https://github.com/PhillipC05/TPT-SmartCity.git
cd TPT-SmartCity

# Install dependencies
npm install
npm run services:install

# Copy environment configuration
cp .env.example .env

# Generate JWT keys (RS256)
mkdir -p keys
openssl genrsa -out keys/private.pem 2048
openssl rsa -in keys/private.pem -pubout -out keys/public.pem

# Initialize database
npm run db:init

# Start development environment
npm run dev

Access the platform at:

  • Dashboard: http://localhost:8080
  • API Gateway: http://localhost:3000
  • Digital Twin: http://localhost:8081

Verification

# Run integration tests
npm test

# Run security audit
node deployment/security-audit.js

# Run load tests
npm --prefix simulation run test:load

✅ Features

| Module | Status | |---|---| | Traffic Management & Intelligent Transportation | ✅ Ready | | Energy Monitoring & Grid Optimization | ✅ Ready | | Public Utility Management (Water, Waste, Lighting) | ✅ Ready | | Citizen Engagement & Service Request Portal | ✅ Ready | | Public Safety & Emergency Management | ✅ Ready | | Environmental Monitoring | ✅ Ready | | 3D City Digital Twin | ✅ Ready | | Cross-Domain AI Orchestration Engine | ✅ Ready | | Predictive Failure Prevention | ✅ Ready | | Equity & Fairness Auditing | ✅ Ready | | Privacy First Zero Trust Architecture | ✅ Ready | | Prometheus Metrics & Grafana Dashboards | ✅ Ready | | Structured Error Tracking (Sentry) | ✅ Ready |


📦 Installation Options

| Method | Instructions | |--------|--------------| | Local Development | Getting Started Guide | | Docker Deployment | docker compose up -d | | Production | Production Deployment Guide | | Cloud AWS/Azure/GCP | Cloud Deployment Guide | | Kubernetes / Helm | Deployment Guide |


Project Structure

tpt-smart-city/
├── docs/                 # Architecture & Design Documents
├── frontend/             # Administration Dashboard & Citizen Portal
├── backend/              # Core API Gateway
├── services/
│   ├── traffic-service/   # Traffic management & intelligent transportation
│   ├── energy-service/    # Energy monitoring & grid optimization
│   ├── environment-service/ # Environmental monitoring (air quality, weather, noise)
│   ├── safety-service/    # Public safety & emergency management
│   ├── water-service/     # Water quality & consumption monitoring
│   └── orchestrator/      # Cross-Domain AI Orchestration Engine
├── citizen-portal/       # Citizen engagement & service request portal
├── digital-twin/         # 3D City Digital Twin Engine
├── simulation/           # City Systems Simulator & Load Testing
├── shared/               # Shared middleware, DB connection, health checks, metrics
├── database/             # Schema, partitioning, data retention scripts
├── deployment/           # Docker, Kubernetes, Helm, Terraform, Monitoring
└── tests/                # Integration & end-to-end tests

📚 Documentation

User Guides

Deployment

Architecture

Project


🛡️ Security

  • Authentication: RS256 asymmetric JWT with RSA 2048-bit keys
  • Authorization: JWT-based auth middleware on all microservices
  • Rate Limiting: express-rate-limit on gateway and all services
  • Input Validation: Joi schema validation on all POST/PUT endpoints
  • Error Handling: Centralized error handler — no database error code leakage
  • SQL Injection Prevention: Parameterized queries throughout
  • Data Privacy: No sensitive data exposure in API responses
  • Security Audit: node deployment/security-audit.js

🔍 Monitoring & Observability

| Tool | Purpose | Access | |------|---------|--------| | Prometheus | Metrics collection (all services expose /metrics) | http://localhost:9090 | | Grafana | Dashboards & visualization (auto-provisioned) | http://localhost:3001 | | Sentry | Error tracking (opt-in via SENTRY_DSN) | External | | Health Endpoints | /health, /health/live, /health/ready on all services | Per service |


🤝 Contributing


📄 License

This project is licensed under the MIT License — see the LICENSE file for details.


☁️ Deployment Infrastructure

  • Containers: Docker Compose (dev), Docker Swarm / Kubernetes (prod)
  • Kubernetes: Manifests under deployment/kubernetes/
  • Helm: Chart under deployment/helm/
  • Terraform: Infrastructure-as-Code under deployment/terraform/
  • Database: PostgreSQL with monthly partitioning, automated retention
  • Caching: Redis (optional, configured via REDIS_URL)