Skip to content

Latest commit

Β 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—οΈ SmartInfra GIS Platform

A Full-Stack GIS-Based Infrastructure Management System built using React, TypeScript, Node.js, PostgreSQL, Prisma, and PostGIS.

SmartInfra helps government agencies, municipalities, and organizations manage infrastructure assets, maintenance operations, complaints, and service workflows through an interactive GIS dashboard.

Live demo: smartinfra-gis-client.onrender.com


πŸš€ Features

πŸ‘€ Authentication & Authorization

  • JWT Authentication
  • Secure Login/Register
  • Role-Based Access Control

Roles

  • Admin
  • Engineer
  • Citizen

πŸ—ΊοΈ GIS Asset Management

  • Create Assets
  • Update Assets
  • Delete Assets
  • View Asset Details
  • Real PostGIS spatial location (geometry(Point, 4326)), auto-synced from lat/lng on create & update
  • Proximity search β€” find assets within a radius using ST_DWithin + ST_Distance (accurate, Earth-curvature-aware, via geography cast)
  • GeoJSON export of assets
  • Asset Categorization
  • Asset Status Monitoring

πŸ“Š Asset Health Monitoring

  • Health Score Tracking
  • Health History Timeline
  • Maintenance History
  • Asset Activity Timeline

πŸ› οΈ Maintenance Management

  • Create Maintenance Tickets
  • Assign Engineers
  • Update Ticket Status
  • Ticket Tracking
  • Maintenance Logs

πŸ“ Complaint Management

  • Create Complaints
  • Complaint Tracking
  • Assign Complaint to Engineer
  • Resolve Complaints
  • Complaint Timeline

πŸ”” Notifications

  • Real-Time Notification System
  • Complaint Updates
  • Ticket Updates
  • Asset Updates

πŸ“ˆ Dashboard

Admin Dashboard

  • Asset Overview
  • Complaint Overview
  • Maintenance Overview
  • System Statistics

Engineer Dashboard

  • Assigned Complaints
  • Assigned Tickets
  • Asset Monitoring

Citizen Dashboard

  • Complaint Tracking
  • Complaint Status Monitoring

Screenshots

Screenshot 2026-07-31 185506 Screenshot 2026-07-31 190048 Screenshot 2026-07-31 185613

πŸ—ΊοΈ PostGIS / Spatial Layer

This is the part that makes SmartInfra a GIS platform rather than just a dashboard with coordinates attached:

  • Asset carries a real PostGIS geometry(Point, 4326) column (location), alongside the original latitude/longitude fields.
  • location is kept in sync automatically whenever an asset is created or updated β€” no manual step required.
  • GET /api/assets/nearby runs a real spatial query (ST_DWithin) directly in Postgres, filtering by radius efficiently instead of loading every row and comparing coordinates in JavaScript.
  • Distance is computed with ST_Distance on a geography cast, so it reflects real-world distance on a curved Earth rather than flat-plane approximation.
  • A GiST spatial index on location keeps proximity queries fast as the dataset grows.
  • Since Prisma has no native geometry support, spatial columns are marked Unsupported(...) in the schema and queried via $queryRaw/$executeRaw.

Next up: the same pattern for Complaint, and an interactive map (Leaflet/MapLibre) rendering these spatial queries visually instead of raw JSON.


πŸ› οΈ Tech Stack

Frontend

  • React
  • TypeScript
  • Tailwind CSS
  • React Router DOM
  • Axios

Backend

  • Node.js
  • Express.js
  • TypeScript

Database

  • PostgreSQL
  • Prisma ORM
  • PostGIS (real spatial queries β€” see section above)

Authentication

  • JWT
  • bcrypt

πŸ“‚ Project Structure

smartinfra-gis/
β”‚
β”œβ”€β”€ client/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── context/
β”‚
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ repositories/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── prisma/
β”‚
└── README.md

πŸ—„οΈ Database Models

User

  • Authentication
  • Roles
  • Profile Management

Asset

  • Infrastructure Assets
  • Health Monitoring
  • Real PostGIS spatial location (geometry(Point, 4326))

Ticket

  • Maintenance Workflow
  • Engineer Assignment

Complaint

  • Complaint Lifecycle
  • Engineer Assignment
  • Resolution Tracking

MaintenanceLog

  • Maintenance Records
  • Audit History

ComplaintTimeline

  • Complaint Activity Tracking

Notification

  • User Notifications

βš™οΈ Installation

Clone Repository

git clone https://github.com/withaman69/SmartInfra-GIS.git
cd SmartInfra-GIS

Backend Setup

cd server

Install dependencies

npm install

Create .env file

DATABASE_URL="postgresql://username:password@localhost:5432/smartinfra_gis"

JWT_SECRET="your_secret_key"

PORT=5000

Enable PostGIS on your database (one-time, per database):

CREATE EXTENSION IF NOT EXISTS postgis;

Run Prisma

npx prisma generate
npx prisma migrate dev

Start Server

npm run dev

Frontend Setup

cd client

Install dependencies

npm install

Start frontend

npm run dev

πŸ” Environment Variables

Backend

DATABASE_URL=
JWT_SECRET=
PORT=

πŸ“‘ Main API Routes

Auth

POST /api/auth/register
POST /api/auth/login
GET /api/auth/me

Assets

GET /api/assets
GET /api/assets/:id
POST /api/assets
PUT /api/assets/:id
DELETE /api/assets/:id
GET /api/assets/nearby?latitude=&longitude=&radius=   # PostGIS ST_DWithin proximity search
GET /api/assets/geojson                                # GeoJSON export of all assets

Tickets

GET /api/tickets
POST /api/tickets
PATCH /api/tickets/:id

Complaints

GET /api/complaints
POST /api/complaints
PATCH /api/complaints/:id/assign
PATCH /api/complaints/:id/resolve

Maintenance Logs

GET /api/maintenance-logs
POST /api/maintenance-logs

🎯 Key Highlights

  • GIS-Based Infrastructure Monitoring with real PostGIS spatial queries
  • Role-Based Access Control
  • Complaint Lifecycle Management
  • Maintenance Workflow Automation
  • Infrastructure Health Tracking
  • PostgreSQL + PostGIS Integration (spatial columns, GiST index, ST_DWithin/ST_Distance proximity search)
  • Full TypeScript Stack
  • Actively developed β€” see PostGIS / Spatial Layer section for what's built vs. planned

πŸ‘¨β€πŸ’» Developer

Aman Kumar Singh Civil Engineering Student, NIT Goa Contributing to OSGeo's PostGIS/pgRouting projects as part of open-source work leading up to Google Summer of Code 2027.


πŸ“„ License

This project is for educational, research, and portfolio purposes.

About

No description, website, or topics provided.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages