How arunkumar30102006/shareholder-voting-platform works
Purpose and runtime
Vote India Secure is a Vite/React TypeScript single-page e-voting platform for Indian listed companies. It serves public marketing/compliance pages plus separate company-admin and shareholder voting portals. Browser entry is src/main.tsx; application composition and route registry are src/App.tsx; Vercel is the intended frontend host (vercel.json).
Frontend application shell and routing
src/App.tsx connects routed pages for public, company, shareholder, voting, analytics, and legal experiences. Shared navigation, SEO, error containment, and theme/UI layers are centered in:
• src/components/layout/Navbar.tsx
• src/components/layout/GlobalErrorBoundary.tsx
• src/components/layout/SEO.tsx
Marketing pages are distinct from authenticated workflows, providing a clear public-to-portal boundary:
• src/pages/Index.tsx
• src/pages/CompanyLogin.tsx
• src/pages/ShareholderLogin.tsx
Identity, roles, and tenant isolation
Supabase provides authentication and PostgreSQL persistence. The company-admin route guard enforces portal access before protected admin workflows:
• src/components/auth/ProtectedAdminRoute.tsx
• src/integrations/supabase/client.ts
• supabase/migrations/20260302000000_security_advisor_fixes.sql
Database RLS is a primary security boundary between companies, their administrators, and shareholders. Vote-specific RLS and secured summary behavior are represented by:
• supabase/migrations/20251221125500_fix_votes_rls.sql
• supabase/migrations/20260225141500_secure_vote_summary.sql
Company voting lifecycle
Company users register and authenticate, then manage voting events, resolutions, shareholders, and results through dedicated page-level workflows:
• src/pages/CompanyRegister.tsx
• src/pages/CompanyDashboard.tsx
• src/pages/VotingManagement.tsx
The data model evolves through SQL migrations for sessions, meeting dates, weighted voting, and vote aggregation:
• supabase/migrations/20260121000000_add_meeting_dates.sql
• supabase/migrations/20260328000000_weighted_voting_system.sql
• supabase/migrations/20260224060000_fix_votes_aggregation.sql
Shareholder ballot and audit flow
Shareholders log in, receive/verify OTP credentials, view their active ballot/dashboard, and submit votes through the frontend voting API. The vote path and integrity-oriented utilities are:
• src/pages/VotingDashboard.tsx
• src/components/voting/VotingCard.tsx
• src/services/api/voting.ts
Cryptographic/verification concepts are isolated in client libraries and supporting database optimization scripts:
• src/lib/merkle.ts
• src/lib/blockchain.ts
• supabase/merkle_storage.sql
Email OTP dispatch and validation occur server-side through Supabase Edge Functions, keeping provider secrets outside the browser:
• supabase/functions/send-email-otp/index.ts
• supabase/functions/verify-email-otp/index.ts
• supabase/functions/send-shareholder-otp-email/index.ts
Analytics, feedback, and AI services
Administrative and shareholder reporting use dashboard components; feedback is captured for sentiment analysis:
• src/components/company/AdminVotingResults.tsx
• src/components/dashboard/VotingAnalytics.tsx
• src/components/ai/ShareholderFeedbackForm.tsx
AI requests cross a browser-to-Edge-Function boundary. ai-ops integrates Groq/Gemini-backed summarization, chat, and sentiment capabilities; translation is separately exposed:
• src/components/ai/DocumentSummarizer.tsx
• src/components/ai/VoteAssistant.tsx
• supabase/functions/ai-ops/index.ts
• supabase/functions/translate-text/index.ts
External integrations and operational functions
Supabase Edge Functions are the backend execution layer (Deno), handling AI, transactional email through Resend, contact/feedback delivery, invitations, account deletion, and payment order creation. Cashfree payment UI connects to its server-side order function:
• src/components/payment/CashfreeGateway.tsx
• supabase/functions/create-payment-order/index.ts
• supabase/functions/send-contact-message/index.ts
Localization is client-side i18next, with translation content and a resolution-translation persistence layer:
• src/i18n/config.ts
• src/i18n/locales/en.json
• supabase/migrations/20260304192000_create_resolution_translations.sql
Main entry points: App.tsx App routes · 20251221125500_fix_votes_rls.sql Voting records and summaries · ProtectedAdminRoute.tsx Company portal access · ShareholderLogin.tsx Shareholder login
Components 20
React frontend
Vite single-page application running in the browser.
- Browser entry
src/main.tsx - App routes · Composes public, company, shareholder, voting, analytics, and legal routes.
src/App.tsx - Shared app shell · Navigation, SEO, error containment, and UI layers.
src/components/layout/Navbar.tsx - Public marketing · Public site boundary before portal authentication.
src/pages/Index.tsx - Company portal access · Company registration, login, and protected-admin access.
src/components/auth/ProtectedAdminRoute.tsx - Company voting management · Manages voting events, resolutions, shareholders, and results.
src/pages/VotingManagement.tsx - Shareholder login
src/pages/ShareholderLogin.tsx - Voting ballot · Displays active ballots and submits votes.
src/pages/VotingDashboard.tsx - Voting API
src/services/api/voting.ts - Vote integrity utilities · Client-side cryptographic and verification concepts.
src/lib/merkle.ts - Results and analytics · Administrative and shareholder voting reporting.
src/components/company/AdminVotingResults.tsx - AI and feedback UI · Summarization, vote assistance, and shareholder feedback.
src/components/ai/VoteAssistant.tsx - Cashfree payment UI
src/components/payment/CashfreeGateway.tsx - Client localization · Client translation content and language configuration.
src/i18n/config.ts
Supabase data boundary
Authentication, PostgreSQL, RLS, and persisted voting records.
- Supabase client · Browser connection to Supabase authentication and data.
src/integrations/supabase/client.ts - Auth and tenant database · Tenant-isolated company, administrator, and shareholder records.
supabase/migrations/20260302000000_security_advisor_fixes.sql - Voting records and summaries · RLS-protected votes, weighted aggregation, sessions, and meeting data.
supabase/migrations/20251221125500_fix_votes_rls.sql
Edge Functions
Deno backend operations that keep secrets off the client.
- OTP functions · Server-side OTP dispatch and verification.
supabase/functions/verify-email-otp/index.ts - AI operations · Groq/Gemini summarization, chat, sentiment, and translation boundary.
supabase/functions/ai-ops/index.ts - Operational functions · Payment orders plus transactional contact, invitation, and account workflows.
supabase/functions/create-payment-order/index.ts
Connections 20
- Browser entry → App routes: mounts
- App routes → Shared app shell: wraps routes
- App routes → Public marketing: serves
- App routes → Company portal access: routes to
- App routes → Shareholder login: routes to
- Company portal access → Company voting management: guards access to
- Shareholder login → OTP functions: requests verification
- OTP functions → Auth and tenant database: validates identity
- Company portal access → Supabase client: authenticates via
- Shareholder login → Supabase client: authenticates via
- Supabase client → Auth and tenant database: uses Auth and data
- Company voting management → Voting records and summaries: manages voting data
- Voting ballot → Voting API: submits through
- Voting API → Voting records and summaries: reads and records votes
- Voting ballot → Vote integrity utilities: uses verification
- Results and analytics → Voting records and summaries: reads secured summaries
- AI and feedback UI → AI operations: invokes
- Cashfree payment UI → Operational functions: creates payment order
- Client localization → App routes: localizes
- AI operations → Voting records and summaries: persists feedback context