A standalone Hono-powered API for Farcaster community voting and member management. Originally extracted from a Next.js application to enable reuse across multiple applications and AI agents.
- Bun runtime
- PostgreSQL database
- Neynar API key
# Install dependencies
bun install
# Set up environment
cp .env.example .env
# Edit .env with your configuration
# Start database
bun run db:up
# Run migrations
bun run db:migrate
# Start development server
bun run devServer starts at: http://localhost:3000
src/
├── index.ts # Main Hono app
├── routes/ # API route handlers
│ ├── health.ts # Health check endpoint
│ ├── users.ts # User management
│ ├── members.ts # Community members
│ ├── proposals.ts # Proposal CRUD
│ ├── votes.ts # Voting system
│ └── activity.ts # Activity feeds
├── middleware/
│ └── auth.ts # Multi-modal authentication
├── lib/
│ ├── db.ts # VotingService integration
│ └── neynar.ts # Neynar API client
└── db/
├── connection.ts # Database connection
├── voting-schema.ts # Database schema
└── services/ # Business logic
└── voting-service.ts
GET /health- Health check
GET /users/me- Current user infoPOST /users/lookup- Username/FID lookupGET /users/verifications- User verificationsGET /members- List community membersGET /members/status- Member status checkGET /proposals- List proposalsPOST /proposals- Submit proposalGET /proposals/:id- Proposal detailsGET /proposals/current-user- User's assigned votesPOST /votes- Cast voteGET /votes/current-user- User's voting historyGET /activity- Recent activity feed
This API supports three authentication methods for different client types:
- Frame SDK Tokens (Next.js Mini App users)
- API Keys (Eliza agents, external services)
- Service Tokens (MCP servers, internal services)
- Status: ✅ Seamless migration from embedded API routes
- Auth: Frame SDK tokens (
Bearer <token>) - Usage: Real users voting and proposing via Farcaster
- Status: ✅ Service key authentication
- Auth: Bearer tokens (
Bearer <secret>) - Usage: Agents submitting proposals on behalf of users
- Status: ✅ Internal service tokens
- Auth: Service tokens (
Service <secret>) - Usage: AI context and comprehensive data access
# Development
bun run dev # Start dev server with hot reload
# Database
bun run db:up # Start PostgreSQL container
bun run db:down # Stop PostgreSQL container
bun run db:generate # Generate Drizzle migrations
bun run db:migrate # Run migrations
bun run db:studio # Open Drizzle Studio
# Production
bun run build # Build for production
bun run start # Start production server- Runtime: Bun
- Framework: Hono (Web Standards)
- Database: PostgreSQL with pgvector
- ORM: Drizzle ORM
- Validation: Zod
- Authentication: Multi-modal (Frame SDK, Bearer tokens for services)
- Member Management: Add, remove, opt-out community members
- Proposal System: Submit and vote on member proposals
- Voting Mechanics: 3-of-5 subgroup voting with time limits
- Activity Tracking: Comprehensive audit trail
- Multi-Client Support: Works with web apps, AI agents, and MCP servers
- Performance: Fast Hono routing with connection pooling
- Type Safety: Full TypeScript coverage
Key environment variables:
DATABASE_URL=postgresql://postgres:postgres@localhost:5555/postgres
NEYNAR_API_KEY=your-neynar-api-key
ELIZA_AGENT_SECRET=your-eliza-secret
MCP_SERVICE_SECRET=your-mcp-secretThis API can be deployed to multiple platforms:
- Node.js servers
- Cloudflare Workers
- AWS Lambda
- Vercel/Netlify
- Any platform supporting Web Standards
If migrating from the embedded Next.js version:
- Update
API_URLin your client applications - Implement Frame SDK token verification in
src/middleware/auth.ts - Set up authentication secrets for agents/MCP servers
All existing client code should work unchanged!
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT