The official web interface for Algorand's xGov program, a decentralized public goods funding mechanism on Algorand, enabling community-driven proposal submission and voting.
- Proposal Management: Create, edit, and submit governance proposals
- Voting System: Participate in proposal voting with weighted voting power
- xGov Registration: Register and manage xGov status
- Council Management: Admin tools for council members
- Wallet Integration: Support for multiple Algorand wallets (Pera, Defly, Lute, WalletConnect)
- Real-time Updates: Live proposal status and voting progress
- PWA Support: Progressive Web App for mobile-first experience
- Dark Mode: Full dark mode support with system preference detection
| Repository | Description |
|---|---|
| xgov-beta-sc | Smart contracts written in Algorand Python |
| xgov-beta-ts | TypeScript SDK with typed clients & SDK for the smart contracts |
- Framework: Astro with Server-Side Rendering
- UI Library: React with TypeScript
- Styling: Tailwind CSS with custom design system
- State Management: Nanostores with React bindings
- Data Fetching: TanStack Query (React Query)
- Form Handling: React Hook Form with Zod validation
- Blockchain: Algorand SDK v3
- Wallet Connection: use-wallet-react v4
- Deployment: Cloudflare Pages
- Testing: Storybook with Chromatic
Before you begin, ensure you have the following installed:
git clone https://github.com/algorandfoundation/xgov-beta-web.git
cd xgov-beta-webnpm installFor local development, the recommended path is to run npm run mock-init, which will bootstrap local configuration (including generating a .env.development based on the template) and deploy/initialize the xGov Registry on LocalNet.
If you prefer to configure manually, copy .env.template to .env.development and fill in values as needed.
# Algorand Node Configuration
PUBLIC_ALGOD_SERVER=http://localhost
PUBLIC_ALGOD_PORT=4001
PUBLIC_ALGOD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PUBLIC_INDEXER_SERVER=http://localhost
PUBLIC_INDEXER_PORT=8980
PUBLIC_INDEXER_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PUBLIC_KMD_SERVER=http://localhost
PUBLIC_KMD_PORT=4002
# xGov Registry Application ID (set after deployment)
PUBLIC_REGISTRY_APP_ID=
# Optional: Daemon configuration for voter assignment
XGOV_DAEMON_MNEMONIC=
COMMITTEE_API_URL=
MAX_CONCURRENT_PROPOSALS=5
MAX_REQUESTS_PER_PROPOSAL=5algokit localnet startThe fastest way to set up a local development environment:
# Replace YOUR_ALGORAND_ADDRESS with your test wallet address
npm run mock-init -- --council-address YOUR_ALGORAND_ADDRESSOr using the short alias:
npm run mock-init -- -c YOUR_ALGORAND_ADDRESSThis script will:
- Deploy the xGov Registry smart contract
- Fund the contract
- Set up committee management
- Configure your address as a council member
npm devOpen http://localhost:4321 in your browser.
xgov-beta-web/
├── public/ # Static assets
│ └── committees/ # Committee data JSON files
├── src/
│ ├── api/ # API utilities and Algorand interactions
│ │ ├── algorand/ # Algorand client configuration
│ │ ├── discourse/ # Forum integration
│ │ ├── nfd/ # NFD (Non-Fungible Domains) integration
│ │ └── types/ # TypeScript type definitions
│ ├── components/ # React components
│ │ ├── ui/ # Base UI components (shadcn/ui)
│ │ └── ... # Feature-specific components
│ ├── functions/ # Utility functions
│ ├── hooks/ # React hooks
│ │ └── ... # Feature hooks
│ ├── layouts/ # Astro layout components
│ ├── pages/ # Astro pages and API routes
│ │ └── api/ # API endpoints
│ ├── recipes/ # Component composition patterns
│ ├── stores/ # Nanostores state management
│ ├── styles/ # Global styles and Tailwind config
│ └── utils/ # General utilities
├── __fixtures__/ # Test fixtures
├── scripts/ # Utility scripts
├── .storybook/ # Storybook configuration
├── astro.config.mjs # Astro configuration
├── tailwind.config.mjs # Tailwind CSS configuration
├── wrangler.jsonc # Cloudflare Workers configuration
└── package.json
| Command | Description |
|---|---|
npm dev |
Start development server |
npm build |
Build for production |
npm preview |
Preview production build locally (via Wrangler) |
npm lint |
Run ESLint |
npm prettier |
Check code formatting |
npm storybook |
Start Storybook development server |
npm build-storybook |
Build Storybook for deployment |
npm test |
Run Storybook tests |
npm coverage |
Run tests with coverage |
npm mock-init |
Initialize local development environment |
npm mock-init-assign |
Initialize with mock voter assignment data |
The application includes a POST endpoint at /api/assign for automated voter assignment:
curl -X POST https://your-domain/api/assign \
-H "Content-Type: application/json" \
-d '{"proposalIds": [123, 456]}'Request Options:
proposalIds(optional): Array of specific proposal IDs to process
Response:
{
"message": "Processed 10 proposals in 5.25s using parallel processing",
"results": {
"success": 8,
"failed": 2,
"details": [...]
},
"processingDetails": {
"concurrencyLevel": 10,
"executionTimeSeconds": 5.25
}
}Committee JSON files should follow this structure:
{
"xGovs": [
{
"address": "ALGORAND_ADDRESS",
"votes": 1000
}
]
}This project uses GitHub Actions for automated deployments to Cloudflare Pages.
| Branch | Environment | Description |
|---|---|---|
main |
Testnet | Staging environment for testing |
mainnet |
Mainnet | Production environment |
CLOUDFLARE_API_TOKEN # Cloudflare API token
CF_ACCOUNT_ID # Cloudflare account ID
CF_PROJECT_NAME_TESTNET # Cloudflare project name for testnet
CF_PROJECT_NAME_MAINNET # Cloudflare project name for mainnet
.env.testnet- Testnet configuration.env.mainnet- Mainnet configuration
If you prefer manual setup via Lora:
- Get the arc32.json artifact
- Navigate to Lora (
algokit localnet explore) - Connect your wallet (Localnet + KMD)
- App Lab → Create App Interface → Deploy New App
- Upload arc32.json and deploy
- Fund the contract from Lora → Fund
- Call
set_committee_manager,set_xgov_daemon, anddeclare_committee
We welcome contributions. Please see our Contributing Guidelines for details on:
- Development workflow
- Pull request process
- Coding standards
For security vulnerabilities, please see our Security Policy.
Do not report security vulnerabilities through public GitHub issues.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
See the LICENSE file for details.
- You can use, modify, and distribute this software
- You can use it for commercial purposes
- You must disclose your source code when distributing
- Network use counts as distribution (AGPL requirement)
- You must use the same license for derivative works
- You must state changes made to the code
- Algorand Foundation for supporting the xGov program
- The Algorand developer community
- All contributors to this project
- Documentation: xGov Beta Docs
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Architecture: ARCHITECTURE.md
- Security policy: SECURITY.md