MMR Burwan (Marriage Registrar Burwan) is a comprehensive, enterprise-grade digital platform designed to digitize and streamline the marriage registration process for the region of Burwan. It replaces legacy manual paperwork with a secure, transparent, and automated digital workflow, serving both citizens (applicants) and government officials (administrators).
- Project Overview
- System Architecture
- Key Features & Workflows
- Database Schema & Data Model
- Security & Privacy
- Folder Structure
- Getting Started & Deployment
The platform serves two primary user groups with distinct interfaces and permissions:
- Digital Application: A guided, multi-step wizard to submit marriage details (Groom, Bride, Witnesses).
- Document Vault: Secure upload and management of ID proofs (Aadhaar, Voter ID, etc.).
- Appointment Booking: Real-time slot booking for physical verification at the registrar's office.
- Status Tracking: Live updates on application status (Draft โ Submitted โ Verified/Rejected).
- Certificate Access: Instant download of digitally signed marriage certificates.
- Command Center: A dashboard view of all applications with filtering and sorting.
- Proxy Applications: Ability to create accounts and applications on behalf of citizens (Walk-in applicants).
- Verification Suite: Tools to view documents side-by-side with application data for verification.
- Rejection Management: Granular rejection system with automated email notifications explaining the reason.
- Certificate Issuance:
- One-click generation of unique, traceable certificate numbers.
- Automatic PDF generation with QR codes.
- Strict duplicate prevention and history management.
The project follows a Modern Serverless Architecture leveraging the Supabase ecosystem. This ensures high availability, scalability, and zero server management overhead.
- Frontend:
- Framework: React 18 (Vite) for high performance.
- Language: TypeScript for type safety.
- Styling: Tailwind CSS for responsive, utility-first design.
- State Management: React Context API.
- PDF Generation:
@react-pdf/rendererfor client-side certificate generation. - Internationalization:
react-i18next(English & Bengali). - Testing:
VitestandReact Testing Library.
- Backend (BaaS):
- Supabase: Provides Auth, Database, Storage, and Realtime subscriptions.
- Compute (Serverless):
- Supabase Edge Functions: Deno-based serverless functions for backend logic (Email sending, Proxy user creation).
- Communication:
- Resend.com: Transactional email API for reliable delivery.
graph TD
%% Styles
classDef user fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
classDef admin fill:#fbe9e7,stroke:#bf360c,stroke-width:2px;
classDef app fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
classDef cloud fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,stroke-dasharray: 5 5;
classDef db fill:#fff3e0,stroke:#e65100,stroke-width:2px;
classDef ext fill:#eceff1,stroke:#455a64,stroke-width:1px,stroke-dasharray: 5 5;
%% External Users
User([๐ค Applicant]):::user
Admin([๐ฎ Administrator]):::admin
%% Frontend Applications
subgraph Frontend["๐ฅ๏ธ Frontend Application (React/Vite)"]
ClientApp[Client Portal]:::app
AdminApp[Admin Dashboard]:::app
end
%% Network Connections
User ==>|HTTPS| ClientApp
Admin ==>|HTTPS| AdminApp
%% Backend Services (Supabase)
subgraph Supabase["โก Supabase Backend Services"]
direction TB
Auth[๐ Auth & Security]:::cloud
Realtime[๐ก Realtime Subscriptions]:::cloud
Storage[๐ Object Storage]:::cloud
subgraph Data["๐พ Data Persistence"]
DB[(PostgreSQL Database)]:::db
end
end
%% Connections to Supabase
ClientApp <-->|REST / WSS| Supabase
AdminApp <-->|REST / WSS| Supabase
%% Detailed Data Flow
ClientApp -->|Uploads| Storage
AdminApp -->|Verifies| Storage
%% Edge Functions & Webhooks
DB -.->|Database Webhook| EdgeFn
subgraph Serverless["โ๏ธ Serverless Compute (Edge Functions)"]
EdgeFn{{โก Edge Logic}}:::cloud
Notify[๐ง Notification Service]:::cloud
Proxy[๐ ๏ธ Admin Tools]:::cloud
end
EdgeFn --> Notify
EdgeFn --> Proxy
%% External Services
subgraph External["๐ External Ecosystem"]
Resend[๐ง Resend Email API]:::ext
end
Notify -->|API Call| Resend
Resend -.->|SMTP| User
Resend -.->|SMTP| Admin
%% Click Interactions
click ClientApp "https://mmr-burwan.vercel.app" "Go to Client Portal"
- Drafting: Users start an application. Data is validated strictly using
Zodschemas. - Submission: Once submitted, the application is locked and moves to the Admin queue.
- Review: Admins review the data.
- Rejection: Status reverts, user is notified via email to correct specific errors.
- Verification: Status becomes
verified. Certificate is generated.
We utilize an Event-Driven Architecture to decouple the frontend from side effects.
- Mechanism:
- Admin performs an action (e.g., rejects a document).
- Frontend inserts a record into the
notificationstable. - Database Webhook triggers an Edge Function.
- Email is sent via Resend.
- Benefit: Ensures reliability even if the client-side session is interrupted.
- Generation: Certificates are generated as PDF files with unique serial numbers.
- Synchronization: Updating a certificate number automatically regenerates the PDF and updates database records, ensuring consistency.
- Security: Old certificate files are automatically deleted to prevent data leaks.
The core data model is built on PostgreSQL. Key tables include:
| Table Name | Description | Key Relationships |
|---|---|---|
users |
Extends Supabase Auth with app-specific profile data. | id references auth.users |
applications |
The central record for a marriage registration. | user_id references users |
certificates |
Stores issued certificate metadata and file URLs. | application_id references applications |
documents |
Metadata for uploaded files. | belongs_to references applications |
appointments |
Booking slots and status. | user_id references users |
notifications |
System alerts and email trigger logs. | user_id references users |
-
Row Level Security (RLS):
- Applicants can ONLY access their own data (
auth.uid() = user_id). - Admins have elevated privileges via a custom
is_admin()function.
- Applicants can ONLY access their own data (
-
Secure Storage:
- Documents are stored in private Supabase Storage buckets (
applications,certificates). - Accessed only via short-lived Signed URLs.
- Documents are stored in private Supabase Storage buckets (
-
Validation:
- Strict backend validation prevents duplicate certificate numbers.
mmr-burwan/
โโโ src/
โ โโโ components/ # Reusable UI components
โ โ โโโ admin/ # Admin-specific components (tables, modals)
โ โ โโโ application/ # Application form steps
โ โ โโโ ui/ # Generic UI elements (Buttons, Inputs)
โ โโโ contexts/ # Global state (Auth, Notifications)
โ โโโ data/ # Static data (Districts, Options)
โ โโโ hooks/ # Custom React hooks
โ โโโ pages/ # Route components
โ โ โโโ admin/ # Admin pages (Dashboard, Verification)
โ โ โโโ dashboard/ # User dashboard
โ โโโ services/ # API service layer (admin.ts, certificates.ts)
โ โโโ types/ # TypeScript interfaces
โ โโโ utils/ # Helpers (certificateGenerator.ts)
โโโ supabase/
โ โโโ functions/ # Deno Edge Functions
โ โโโ migrations/ # SQL migration files
โโโ public/ # Static assets
- Node.js (v18+)
- Supabase CLI
-
Clone the repository
git clone https://github.com/yourusername/mmr-burwan.git cd mmr-burwan -
Install dependencies
npm install
-
Environment Setup Create a
.envfile:VITE_SUPABASE_URL=your_project_url VITE_SUPABASE_ANON_KEY=your_anon_key
-
Run Locally
npm run dev
-
Run Tests
npm run test
- Frontend: Deploy to Vercel, Netlify, or any static host.
- Backend:
- Link your local project to your Supabase project:
supabase link --project-ref your-project-id
- Push database migrations:
supabase db push
- Deploy Edge Functions:
supabase functions deploy
- Link your local project to your Supabase project:
This project is licensed under the MIT License.