tpt-infrastructure-engineer

TypeScript

Open-source infrastructure engineering platform for civil engineers & project managers — 2D/3D drawing board, AI design generation, materials database, cost estimator, CPM scheduler & regulatory report builder.

3 stars0 forks3 watchers
aicivil-engineeringcost-estimationfastapiinfrastructureopen-sourcepostgresqlproject-managementpythonreact

Languages

TypeScript54.9%Python41.3%PLpgSQL1.9%CSS0.7%JavaScript0.3%HTML0.3%Shell0.2%Dockerfile0.2%Batchfile0.2%Mako0.1%
README

TPT Infrastructure Engineer

An end-to-end infrastructure engineering platform for project management, cost estimation, scheduling, CAD/BIM workflows, and real-time collaboration. Built for civil engineers, project managers, quantity surveyors, and contractors.

CI License: Apache 2.0


Features

ModuleDescription
Project WorkspaceCRUD, version control, activity feed, file attachments, commenting
2D Drawing BoardFabric.js canvas with snapping, dimensioning, layers, annotations
3D Scene ViewerThree.js + web-ifc viewer with orbit controls and IFC/BIM model support
AI Design GeneratorParametric templates with scored structural alternatives
Design ComparisonSide-by-side cost, structural and carbon comparison
DXF / IFC ImporterImport AutoCAD DXF drawings and IFC BIM models
Materials DatabaseAS/NZS-rated library with regional pricing, supplier info, carbon tracking
Cost EstimatorQuantity take-off, overhead/profit, contingency, escalation
CPM SchedulerGantt chart, critical path, resource levelling, milestone tracking
Feasibility EngineGeotechnical, environmental, hydrological, traffic analysis
Risk AnalysisRisk register, Monte Carlo simulation, mitigation planning
Report GeneratorPDF/Excel/Word export with approval workflow
ProcurementBOM, tender packages, purchase orders, supplier comparison
Carbon DashboardScope 1/2/3 emissions breakdown and benchmark comparison
Compliance CheckerValidate designs against AS/NZS structural and environmental standards
AI AssistantRule-based Q&A; LLM-powered when AI_ENABLED=true
Real-time CollaborationWebSocket presence, live cursors, document locking
Role-based AccessOwner, Engineer, PM, Surveyor, Draftsman, Contractor, Supplier, Viewer
Audit TrailFull create/update/delete audit log per organisation
i18nEnglish and Māori (te reo) translations

Tech Stack

LayerTechnology
FrontendReact 19, TypeScript, Tailwind CSS v4, Vite
DrawingFabric.js v7
3D / BIMThree.js r170 + web-ifc-three
ChartsRecharts
StateZustand + TanStack Query
BackendFastAPI, Python 3.12
DatabasePostgreSQL 16 + PostGIS 3.4
ORMSQLAlchemy 2 + GeoAlchemy2
AuthJWT HS256 (python-jose) + bcrypt
CalculationsNumPy + SciPy
GISGeoPandas + Shapely
ContainersDocker + docker-compose
CI/CDGitHub Actions

Quick Start

Prerequisites

  • Python 3.12+
  • Node.js 20+
  • PostgreSQL 16 with PostGIS 3.4

1. Clone and configure

git clone https://github.com/PhillipC05/tpt-infrastructure-engineer.git
cd tpt-infrastructure-engineer
cp backend/.env.example backend/.env
# Edit backend/.env — set SECRET_KEY to a random 64-char hex string:
# python -c "import secrets; print(secrets.token_hex(32))"

2. Database setup

# Create the database
psql -U postgres -c "CREATE DATABASE tpt_infrastructure;"
psql -U postgres -c "CREATE EXTENSION postgis;" -d tpt_infrastructure

# Apply migrations
cd backend
alembic upgrade head

3. Backend

cd backend
pip install -r requirements.txt
uvicorn main:app --reload

API: http://localhost:8000 — Interactive docs: http://localhost:8000/docs

4. Frontend

cd frontend
npm install
npm run dev

App: http://localhost:5173

5. Docker (full stack)

cp backend/.env.example backend/.env   # fill in credentials
docker-compose up --build

Project Structure

tpt-infrastructure-engineer/
├── backend/
│   ├── main.py              API endpoints + WebSocket
│   ├── auth.py              JWT authentication
│   ├── models.py            SQLAlchemy ORM models
│   ├── schemas.py           Pydantic request/response schemas
│   ├── database.py          DB engine + session factory
│   ├── audit_logger.py      Audit trail
│   ├── websocket_manager.py Real-time connection manager
│   ├── compliance.py        AS/NZS compliance rules
│   ├── anomaly.py           Cost anomaly detection
│   ├── integrations.py      AI + GIS + IoT integrations
│   ├── estimation.py        Cost estimation engine
│   ├── feasibility.py       Feasibility assessment engine
│   ├── scheduling.py        CPM scheduler (NetworkX)
│   ├── procurement.py       Procurement workflow
│   ├── reporting.py         Report generator
│   ├── materials.py         Materials database
│   └── middleware/          Security, logging, transaction middleware
├── frontend/src/
│   ├── App.tsx              Routes + layout
│   ├── pages/               Feature pages (Dashboard, Projects, etc.)
│   ├── components/          Shared UI + drawing/3D components
│   ├── store/               Zustand auth store
│   ├── lib/                 API client, i18n, utilities
│   └── providers/           React context providers
├── tests/                   pytest test suite (SQLite in-memory)
├── alembic/                 Database migrations
├── docs/                    Deployment and runbook docs
├── docker-compose.yml
└── Dockerfile

Environment Variables

Copy backend/.env.example to backend/.env and configure:

VariableRequiredDescription
SECRET_KEYYes64-char random hex for JWT signing
DATABASE_URLNoPostgreSQL connection string (default: localhost)
TPT_TOKEN_EXPIRE_MINUTESNoJWT expiry in minutes (default: 480)
CORS_ORIGINSNoComma-separated allowed origins
ALLOWED_HOSTSNoComma-separated trusted hosts
AI_ENABLEDNotrue to enable LLM-powered assistant
SMTP_HOSTNoSMTP server for email notifications

For the frontend, copy frontend/.env.example to frontend/.env:

VariableRequiredDescription
VITE_API_URLNoBackend URL (default: http://localhost:8000)

Running Tests

cd backend
python -m pytest ../tests/ -v

# Load testing
cd tests/load_testing
locust -f locustfile.py

API Documentation

FastAPI generates interactive Swagger UI at /docs and ReDoc at /redoc automatically when the backend is running.


Innovative Roadmap

Planned for future releases:

  • PWA / Offline Mode — service worker so field engineers can annotate without connectivity
  • Live Materials Pricing — supplier price feed integration for real-time unit rates
  • Drone Survey Import — LAS/LAZ point cloud to 3D mesh pipeline
  • Digital Twin Sync — push design changes to IoT sensor networks
  • QR Site Signs — one-click printable QR-coded project information boards

Contributing

See CONTRIBUTING.md for development workflow, code standards, and PR process.

Changelog

See CHANGELOG.md for release history.

License

Apache 2.0 © 2026 TPT Solutions