Skip to content

Srijan3412/CivicChain.02

Repository files navigation

CivicChain: Municipal Budget & Citizen Engagement Portal

CivicChain is a modern, transparent web application designed to bridge the gap between local governments and citizens. It empowers communities by offering clear, interactive visualizations of municipal budgets, AI-powered financial insights, and a streamlined channel for submitting and tracking civic feedback and local reports.


🚀 Key Features

  • 📊 Interactive Budget Explorer: Filter, search, and visualize ward-level budgets by department and year using intuitive summary cards, interactive tables, and charts (Recharts).
  • 🧠 AI-Powered Insights: Get citizen-friendly budget summaries, anomaly detection, and cost optimization recommendations powered by AI model queries.
  • 📢 Citizen Engagement & Feedback: Report local community issues (e.g., road maintenance, lighting, waste management) with optional image/photo uploads.
  • 💾 CSV Budget Importer: Municipal administrators can easily upload new budget sheets via a standard CSV template to keep data up-to-date.
  • 🌐 Multi-Language Support: Localized navigation and content support in English, Hindi, Tamil, Telugu, Kannada, and Marathi.
  • 🔌 Transparent Offline Fallback: Functions entirely offline out-of-the-box (using simulated database states in localStorage) if a live database connection is not configured.

🛠️ Technology Stack

  • Frontend Framework: React 18, Vite, TypeScript
  • Styling & UI: Tailwind CSS, Shadcn UI, Radix UI, Lucide Icons
  • Data Visualization: Recharts
  • Database & API: Supabase (PostgreSQL, Edge Functions, Row Level Security, Storage buckets)
  • State Management & Querying: TanStack React Query

📥 Getting Started

Prerequisites

Ensure you have Node.js (v18+) and npm installed on your machine.

Installation

  1. Clone the repository or open the project folder.
  2. Install dependencies:
    npm install

Running Locally

To launch the local development server:

npm run dev

Open http://localhost:5173 in your browser.

You can log in with the pre-seeded account citizen@example.com and password password123, or sign up for a new account.

Production Build

To compile a minified production bundle:

npm run build

🗄️ Database & Fallback Architecture

To make installation effortless, CivicChain features a dual-mode database client implemented in src/integrations/supabase/client.ts:

  1. Offline Sandbox Mode (Default): Runs completely locally. Database queries, authentication states, uploads, and edge functions are simulated inside localStorage. No database setup, Docker, or external keys are required.
  2. Live Production Mode: Connects to a real, hosted Supabase instance once environment variables are detected.

Connecting to a Hosted Database

  1. Copy the environment template file:
    cp .env.example .env
  2. Open .env and fill in your Supabase project parameters:
    VITE_SUPABASE_URL=https://your-project-ref.supabase.co
    VITE_SUPABASE_ANON_KEY=your-publishable-anon-key
  3. Restart the local development server (npm run dev) to apply the connection.

📊 Database Schema

If you connect to a live Supabase database, run the SQL migrations located in supabase/migrations/ to create the required tables. The primary table structures are as follows:

1. Municipal Budget Table (municipal_budget)

Tracks allocated and used funds per ward department.

CREATE TABLE public.municipal_budget (
  id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
  account TEXT NOT NULL,             -- Department name (e.g. Public Works Department)
  account_budget_a TEXT NOT NULL,    -- Category description (e.g. Road Repair)
  glcode TEXT NOT NULL,              -- Financial Year (e.g. 2024)
  used_amt NUMERIC NOT NULL,         -- Used funds
  remaining_amt NUMERIC NOT NULL,    -- Remaining funds
  budget_a NUMERIC,                  -- Total allocated funds
  file_id UUID REFERENCES public.budget_files(id),
  user_id UUID REFERENCES auth.users(id),
  created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
);

2. Citizen Reports Table (citizen_reports)

Stores community feedback and reports submitted by citizens.

CREATE TABLE public.citizen_reports (
  id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
  description TEXT NOT NULL,
  category TEXT NOT NULL,
  image_urls TEXT[] DEFAULT '{}',
  user_id UUID REFERENCES auth.users(id),
  created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
);

3. CSV Import Format

When importing new budget data via the dashboard, upload a .csv file with the following headers:

Ward,Year,Category,Amount
Public Works Department (PWD),2024,Main Road Asphaltation,25000000
Education & Literacy,2024,School Infrastructure,11000000

📤 Push Updates to GitHub

To update your repository at https://github.com/Srijan3412/CivicChain.02.git:

  1. Stage and commit your changes:
    git add .
    git commit -m "docs: restructure README to focus on CivicChain features and architecture"
  2. Push to the main branch:
    git push -u origin main

About

A React + Supabase app that converts municipal budget data into transparent, citizen-friendly dashboards using Edge Functions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages