Project Info
Inspiration
Every. Single. Individual. Is impacted by policy—yet fewer than 0.1% of constituents in the U.S. provide feedback on the very legislation that shapes every aspect of our lives. Our team brings experience across local, state, and federal policymaking, and we've seen firsthand how the current system perpetuates a cycle of bias and inaccessibility. Those who do reach out to lawmakers are often those with the most extreme viewpoints, creating a feedback loop that reflects only a narrow slice of public opinion. This is a textbook case of self-selection bias—and it’s not limited to direct outreach. The same pattern shows up in surveys, public comment periods, and other engagement attempts. As a result, a small, unrepresentative group ends up having a disproportionate influence on the laws and policies that govern us all.
What it does
At its core, Replicant is a digital, AI-powered platform that generates constituent personas using live data from the U.S. Census Bureau. These personas are designed to reflect the 99.9% of the population and help drive more equitable and inclusive policy making. Users can interact with each persona through an integrated chat feature, allowing for deeper exploration and iterative feedback based on evolving policy questions.
How we built it
We developed the frontend using React, enabling a smooth and responsive user experience. The backend is powered by Node.js with Express, and we use Supabase to manage authentication, and data storage. For AI integration, we relied on two key models: Claude and Groq. Claude was chosen for its advanced reasoning capabilities, which we use to generate rich and logically consistent constituent profiles that reference census data. This reasoning is crucial to ensuring each persona accurately reflects the complex identities and needs of real constituents. To power the live chat experience, we integrated Groq, which offers up to 10x faster response times for large language models. This speed enhancement makes real-time interaction with constituent personas seamless and scalable. Together, this tech stack allows Replicant to deliver a meaningful, data-informed, and dynamic experience that can bring underrepresented voices into the heart of policymaking.
Accomplishments we're proud of
We’re proud that we built something both functional and impactful in a short amount of time. The creativity behind Replicant—from concept to execution—reflects our team’s passion for solving meaningful problems with technology. We took on a complex challenge and delivered a product that has the potential to reshape how policymakers understand and engage with their communities.
What we learned
We learned the importance of thinking beyond surface-level functionality. It’s not enough for a product to seem like it works, rather real functionality means accounting for edge cases and avoiding hard coded shortcuts. By building with real users in mind, we were pushed to write cleaner, more adaptable code. Challenges Faced One of the main challenges we faced was ensuring that each constituent profile was grounded in real Census data rather than being entirely hallucinated by the AI—we were committed to preserving the integrity and authenticity of every persona
What's next
We’re just getting started. Our next major goal is to expand Replicant beyond the United States and begin supporting international regions. Policy challenges—like inequality, climate change, and health disparities—are global in scope, and the need for representative, data-informed decision-making exists in every country. We're exploring integrations with global data sources such as the United Nations, Eurostat, and national statistical agencies to generate accurate constituent personas across different geopolitical contexts. In addition, we plan to enhance the platform’s flexibility by allowing users to upload custom datasets. This feature will empower organizations—whether NGOs, governments, or academic institutions—to generate personas based on their own localized or issue-specific data. By broadening our data inputs and geographic reach, Replicant will become a truly global tool for inclusive policymaking. Ultimately, our mission is to help every policymaker in the world understand and engage with the full spectrum of people their policies affect—not just the loudest voices.
Replicant 🏛️
AI-powered policy impact analysis for congressmen and legislative staff
Replicant uses artificial intelligence and Census data to simulate how policies affect real constituents. Upload a bill, meet digital twins, and get actionable feedback before implementation.
✨ Features
- 🔐 Secure Authentication - JWT-based authentication with Supabase backend
- 📄 Policy Upload & Analysis - Upload documents or paste text for AI analysis
- 👥 Digital Twin Generation - Create realistic constituents based on Census data
- 💬 Interactive Chat - Talk with digital twins about policy impact
- 📊 Impact Analysis - Get detailed reports and improvement suggestions
- 🏛️ Personalized Dashboard - District-specific insights and quick actions
🚀 Quick Start
Prerequisites
- Node.js 18+
- npm or yarn
- Supabase account and project
Installation
-
Clone the repository
git clone https://github.com/syedahibahasan/civic-twin.git cd civic-twin -
Frontend Setup
# Install dependencies npm install # Set up environment variables cp .env.example .envAdd your API configuration to
.env:VITE_API_URL=http://localhost:3001/api VITE_OPENAI_API_KEY=your_openai_api_key_here -
Backend Setup
# Navigate to backend directory cd backend # Run setup script (Linux/Mac) chmod +x setup.sh ./setup.sh # Or manually install dependencies npm install # Configure environment variables cp env.example .envEdit
backend/.envwith your Supabase credentials:SUPABASE_URL=your_supabase_project_url SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key JWT_SECRET=your_jwt_secret_key_here PORT=3001 NODE_ENV=development CORS_ORIGIN=http://localhost:5173 -
Database Setup
Create a
userstable in your Supabase database:CREATE TABLE users ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, email VARCHAR(255) UNIQUE NOT NULL, password_hash VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, state VARCHAR(100), district VARCHAR(50), party VARCHAR(100), phone VARCHAR(50), committee TEXT, avatar TEXT, term_start DATE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); CREATE INDEX idx_users_email ON users(email); ALTER TABLE users ENABLE ROW LEVEL SECURITY; -
Start the Servers
# Terminal 1: Start backend cd backend npm run dev # Terminal 2: Start frontend cd .. npm run dev -
Open your browser Navigate to
http://localhost:5173
🔑 Authentication
The application now uses secure JWT-based authentication with Supabase:
- Registration: Create new accounts with email, password, and profile information
- Login: Authenticate with email and password
- Profile Management: Update personal information and change passwords
- Secure Routes: Protected pages require authentication
- Token Persistence: Automatic login with stored tokens
🏗️ Architecture
Frontend
- React 18 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- React Router for navigation
- Context API for state management
Backend
- Node.js with Express
- Supabase for database and authentication
- JWT for secure token-based authentication
- bcrypt for password hashing
- CORS and security middleware
AI Integration
- OpenAI GPT-3.5-turbo for policy analysis
- Fallback analysis when API is unavailable
- Rate limiting protection with exponential backoff
Key Components
AuthContext- Authentication state managementauthService- Backend API integrationAppContext- Application state managementaiService- AI-powered analysis functionscensusApi- Demographic data integration
📁 Project Structure
civic-twin/
├── src/ # Frontend source code
│ ├── components/ # React components
│ ├── context/ # React context providers
│ ├── pages/ # Page components
│ ├── services/ # API services
│ └── types/ # TypeScript type definitions
├── backend/ # Backend API
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── middleware/ # Express middleware
│ │ ├── routes/ # API routes
│ │ └── index.js # Main server file
│ ├── package.json # Backend dependencies
│ └── README.md # Backend documentation
├── package.json # Frontend dependencies
└── README.md # This file
🔧 Development
Available Scripts
Frontend
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
Backend
cd backend && npm run dev- Start backend with auto-restartcd backend && npm start- Start production backend
API Endpoints
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profilePUT /api/auth/change-password- Change passwordPOST /api/auth/logout- Logout userGET /health- Server status
For detailed API documentation, see backend/README.md
Adding New Features
- New Pages: Add to
src/pages/and update routing inApp.tsx - New Components: Add to
src/components/for reusable UI - New Services: Add to
src/services/for external integrations - New API Routes: Add to
backend/src/routes/for backend endpoints - New Types: Add to
src/types/index.tsfor TypeScript definitions
🔒 Security Features
- Password Hashing: All passwords are hashed using bcrypt with 12 salt rounds
- JWT Tokens: Secure token-based authentication with 7-day expiration
- CORS Protection: Configured to allow only specified origins
- Rate Limiting: 100 requests per 15 minutes per IP
- Security Headers: Helmet middleware for protection against common vulnerabilities
- Input Validation: Request body validation for all endpoints
🚀 Deployment
Frontend Deployment
The frontend can be deployed to any static hosting service:
- Vercel
- Netlify
- GitHub Pages
- AWS S3 + CloudFront
Backend Deployment
The backend can be deployed to:
- Heroku
- Railway
- DigitalOcean App Platform
- AWS EC2
- Google Cloud Run
Remember to:
- Set
NODE_ENV=production - Configure all environment variables
- Set up proper CORS origins
- Use a process manager like PM2 for production
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- OpenAI for AI capabilities
- Supabase for database and authentication
- US Census Bureau for demographic data
- React Team for the amazing framework
- Tailwind CSS for the utility-first CSS framework
📞 Support
For support, email support@civictwin.com or open an issue on GitHub.
Built with ❤️ for better policy making
Analysis
View
Metric
- 24
- 10
- 8
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- CSSIn code
- ExpressIn code
- HTMLIn code
- JavaScriptIn code
- OpenAIIn code
- ReactIn code
- SQLIn code
- SupabaseIn code
- Tailwind CSSIn code
- TypeScriptIn code
- Node.jsClaimed
11 of 12 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
341 KB
Source files
57
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
syedahibahasan/Replicant
70 files · 1.8 MB · @ d34e729
Structure
Interface
13 files · 19%Screens, components and styles rendered to the user.
API & routing
5 files · 7%Request entry points: routes, handlers and controllers.
Application logic
32 files · 46%Domain rules, services and shared utilities.
+5 moreData & schema
5 files · 7%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript71%
- JavaScript20%
- Markdown5%
- SQL3%
- Shell0%
- HTML0%
- Other (1)0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
package.json
npm · 24- chart.js
- congressional-districts
- isomorphic-unfetch
- lucide-react
- openai
- react
- react-chartjs-2
- react-dom
- react-router-dom
- unfetch
- +14 more
backend/package.json
npm · 11- @anthropic-ai/sdk
- @supabase/supabase-js
- bcryptjs
- cors
- csv-parser
- dotenv
- express
- express-rate-limit
- helmet
- jsonwebtoken
- +1 more
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.