The World Republic is an open-source platform for global representative democracy.
It provides the building blocks for political party formation, secure voting, and a self-sustaining economic engine at a planetary scale. This repository contains the core Next.js implementation used to power the platform and the Raised by Humanity campaign.
- Political parties — Discover and create global political parties
- Citizen verification — Get verified privately via Self
- Voting — Participate in test elections
- Digital wallet — Monitor and manage internal rewards and onchain transfers
- Internationalization — 50+ languages supported
The platform uses a hybrid setup to align incentives through its digital currency, the world drachma (WDD).
- Centralized database: Internal rewards are tracked offchain (PostgreSQL).
- Onchain transfers: Citizens can withdraw their WDD to a crypto account and interact with the savings account onchain.
- Party subsidies: Funding political parties in proportion to their electoral performance.
- Savings account: Citizens earn real-time interest on their deposited WDD with no lock-up period.
- Ambassador Program: Rewarding community members for inviting successful party leaders.
This repository contains the UI and server logic to interact with the WDD ecosystem. If you are forking this project:
- Token contract: You must deploy your own ERC-20 contract (the production app uses Base and World Chain).
- Treasury: You will need to fund a treasury wallet to fulfill onchain withdrawal requests.
- Configuration: Ensure you update the contract addresses and chain IDs in the server actions and UI components.
- Framework: Next.js 16 (App Router), React 19
- Database: PostgreSQL (Neon) with Drizzle ORM
- Auth: NextAuth.js v5 (Google OAuth, WebAuthn)
- Identity: Self (zero-knowledge verification)
- Blockchain: thirdweb (WDD transactions)
- UI: Worldcoin Mini Apps UI Kit, Tailwind CSS
- Code quality: Biome (linting/formatting)
-
Install dependencies
pnpm install
-
Copy environment variables
cp .env.example .env.local
-
Configure environment variables:
DATABASE_URL_LOCAL_DEV— direct (non-pooled) Postgres URL for local dev — https://console.neon.tech/DATABASE_URL— pooler Postgres URL (used in production) — https://console.neon.tech/NEXTAUTH_SECRET— secret for NextAuth (generate withopenssl rand -base64 32)NEXTAUTH_URL— optional canonical app URL (e.g., http://localhost:3000)AUTH_GOOGLE_ID/AUTH_GOOGLE_SECRET— Google OAuth credentials — https://console.cloud.google.com/apis/credentialsAUTH_WEBAUTHN_RP_NAME— passkey display nameAUTH_WEBAUTHN_RP_ID— primary passkey RPID for the NextAuth passkey providerAUTH_WEBAUTHN_ALLOWED_HOSTS— comma-separated hosts allowed for custom passkey auth (for multi-domain passkey support)THIRDWEB_SECRET_KEY— thirdweb secret key — https://thirdweb.com/dashboard
-
Run the app
pnpm dev
Then open
http://localhost:3000
pnpm dev— Start development server with Turbopackpnpm build— Build for productionpnpm start— Start production serverpnpm lint— Run Biome linterpnpm lint:fix— Auto-fix linting issuespnpm format— Format code with Biome
- Migrations: Schema is managed with Drizzle ORM (see
drizzle/directory) - Distribute election subsidies (admin): Run directly when needed:
Use
pnpm tsx scripts/distribute.ts <electionId> [--dry-run]
--dry-runto preview without committing. RequiresDATABASE_URLin env.
AGPL-3.0 — See LICENSE file for details.
We welcome contributions! Please see our Contributing Guide and Code of Conduct for more details.