Public village showcase and authenticated Gram Panchayat worker portal for Morgaon Digras (Buldhana District, Maharashtra), built with React, TypeScript, Vite, Tailwind CSS, and Supabase (PostgreSQL + Supabase Auth).
-
Public Village Showcase (
/) — Read-only portal accessible to all visitors:- Demographics & Household Statistics: Live census metrics (
population,households,male,femaledistribution) fetched from Supabasevillage_stats. - Gram Panchayat Leadership: Elected Sarpanch and Administrative Gram Sevak profiles.
- Plastic-Free Village Mission (CEP 01): Live cumulative waste segregation metrics (Wet, Dry, Plastic in kg) and dynamic SVG Plastic Waste bar chart computed from Supabase
waste_logs. - Sustainable Low-Cost Housing (CEP 02): Showcase of CSEB blocks, treated bamboo roof trusses, lime-mud thermal plaster, and rainwater harvesting.
- Interactive Satellite Map: Embedded Google Maps satellite view centered on Morgaon Digras (
20.811684° N, 76.557083° E).
- Demographics & Household Statistics: Live census metrics (
-
Panchayat Login (
/login):- Email and password sign-in powered by
supabase.auth.signInWithPassword. - Password visibility toggle, loading spinner, inline error handling, and Forgot Password reset email flow (
supabase.auth.resetPasswordForEmail). - Invite-only access: no public sign-up button or hardcoded demo credentials.
- Email and password sign-in powered by
-
Protected Panchayat Portal (
/panchayat):- Accessible only to authenticated Panchayat workers (unauthenticated users are automatically redirected to
/login). - Daily Waste Logger: Add, edit, delete, and filter daily waste collection logs by date range and waste type (
Wet,Dry,Plastic), with optional notes and non-negative validation. - Village Statistics Editor: Update official village demographics and leadership (
id = 1invillage_stats) with strict validation ensuringMale + Female = Total Population.
- Accessible only to authenticated Panchayat workers (unauthenticated users are automatically redirected to
-
Install dependencies:
npm install
-
Configure environment variables: Copy
.env.exampleto.envand fill in your Supabase project credentials (found in Supabase Dashboard → Project Settings → API):VITE_SUPABASE_URL="https://your-project-id.supabase.co" VITE_SUPABASE_ANON_KEY="your-public-anon-key"
Security Note: Only use the public
anonkey inVITE_SUPABASE_ANON_KEY. Never expose yourservice_rolesecret key in frontend code. -
Start the development server:
npm run dev
The app expects two existing tables in your Supabase PostgreSQL database with Row Level Security (RLS) enabled (Public SELECT, Authenticated INSERT/UPDATE/DELETE):
-
village_stats:id(int / bigint, primary key — single row withid = 1)population(integer)households(integer)male(integer)female(integer)sarpanch(text)gram_sevak(text)updated_at(timestamptz)
-
waste_logs:id(uuid, primary key, defaultgen_random_uuid())log_date(date)wet_kg(numeric)dry_kg(numeric)plastic_kg(numeric)notes(text, nullable)created_by(uuid, nullable)created_at(timestamptz, defaultnow())
Because public sign-up is disabled for security, new Panchayat staff accounts are created by the administrator directly in Supabase:
- Open your project in the Supabase Dashboard.
- In the left sidebar, click Authentication → Users.
- Click the Add user button (top right) and select Create new user (or Send invitation).
- Enter the Panchayat worker's Email Address and a strong Password.
- Ensure Auto Confirm User is checked so they can sign in immediately.
- Click Create user. The worker can now log in at
/loginon the portal.
- Push this repository to GitHub/GitLab/Bitbucket and import it into Vercel.
- In your Vercel project dashboard, go to Settings → Environment Variables.
- Add the following two variables for Production, Preview, and Development environments:
VITE_SUPABASE_URL=https://your-project-id.supabase.coVITE_SUPABASE_ANON_KEY=your-public-anon-key
- Click Save and trigger a Redeploy from the Deployments tab.
- The included
vercel.jsonfile automatically configures SPA rewrites so refreshing/loginor/panchayatworks seamlessly without 404 errors.