A decentralized Web3 application for collaborative contribution management and peer-based validation. FairSharing enables teams to transparently track, validate, and fairly distribute rewards for collaborative work contributions through blockchain-based authentication and democratic voting mechanisms.
- Multi-Contributor Support: Track contributions from multiple team members with individual hour/point allocation
- Rich Content Support: Comprehensive contribution descriptions with file attachments
- Versioned History: Soft-delete architecture preserves complete contribution history
- Flexible Tracking: Support for time-based and point-based contribution metrics
- Democratic Voting: Peer-based validation through PASS/FAIL/SKIP voting mechanisms
- Configurable Strategies: Project-specific validation rules (specific members vs. all members)
- Transparent Process: Complete audit trail of validation decisions
- Anti-Gaming Measures: Built-in safeguards against validation manipulation
- Hybrid Authentication: Combined JWT and wallet signature authentication
- Multi-Wallet Support: ConnectKit integration for seamless wallet connectivity
- Blockchain Security: Server-side signature validation using Viem
- Decentralized Identity: ENS name resolution and wallet-based profiles
- Role-Based Access: Configurable member roles and permissions
- Submission Control: Flexible contribution submission strategies
- Team Collaboration: Member invitation and management system
- Project Analytics: Contribution tracking and validation metrics
- Next.js 15.3.3 - React framework with App Router
- TypeScript 5 - Strict type safety throughout
- Mantine UI 8.1.0 - Component library
- PostgreSQL - Primary database
- Prisma ORM 6.9.0 - Type-safe database access
- tRPC 11.4.1 - End-to-end type-safe APIs
- React Query 5.80.7 - Server state management
- Wagmi 2.15.6 - React hooks for Ethereum
- ConnectKit 1.9.1 - Wallet connection UI
- Viem 2.31.2 - Ethereum interactions
- Ethers 6.14.4 - Blockchain utilities
- JSON Web Tokens - Session management
- Cloudflare R2 - File storage and uploads
- Zod - Runtime type validation
- React Hook Form - Form state management
- Node.js 18+ and npm
- PostgreSQL 12+ database
- Web3 Wallet (MetaMask, WalletConnect, etc.)
- Cloudflare R2 (for file uploads)
- WalletConnect Project ID (for wallet connectivity)
git clone <repository-url>
cd fairsharing
npm installCreate .env.local with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/fairsharing"
# Authentication
JWT_SECRET="your-jwt-secret-key"
# Cloudflare R2 (for file uploads)
CLOUDFLARE_R2_ENDPOINT="your-r2-endpoint-url"
CLOUDFLARE_R2_ACCESS_KEY_ID="your-r2-access-key"
CLOUDFLARE_R2_SECRET_ACCESS_KEY="your-r2-secret-key"
# Web3 Configuration
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID="your-walletconnect-project-id"
# App Configuration
NEXT_PUBLIC_APP_URL="http://localhost:3100"# Generate Prisma client
npm run db:generate
# Push schema to database
npm run db:push
# Seed with sample data
npm run db:seednpm run devVisit http://localhost:3100 to access the application.
npm run dev- Start development server with Turbopack on port 3100npm run build- Build production app (includes Prisma generation)npm run start- Start production servernpm run lint- Run ESLint for code quality
npm run db:generate- Generate Prisma client after schema changesnpm run db:push- Push schema changes to database in development phasenpm run db:studio- Open Prisma Studio for database GUInpm run db:seed- Populate database with comprehensive sample datanpm run db:seed-simple- Run minimal database seedingnpm run db:reset- Reset database and reseed with sample data
TODO add commands for production env
FairSharing implements a hybrid authentication system combining traditional JWT tokens with Web3 wallet signatures:
- Wallet Connection: Users connect via ConnectKit/Wagmi
- Signature Request: Backend generates a nonce for signing
- Signature Verification: Server validates signature using Viem
- JWT Issuance: Successful validation issues JWT for session management
- Protected Routes: Middleware validates JWT for API access
The application uses a sophisticated relational schema with soft deletes:
- Users: Wallet-based identity with ENS integration
- Projects: Team workspaces with configurable validation rules
- Contributions: Multi-contributor work records with versioning
- Votes: Peer validation records (PASS/FAIL/SKIP)
- Junction Tables: Many-to-many relationships for contributors and project members
tRPC provides end-to-end type safety with domain-organized routers:
- User Router: Profile management and authentication
- Project Router: Project CRUD and member management
- Contribution Router: Contribution tracking and updates
- Vote Router: Validation and voting mechanisms
- Upload Router: File handling and Cloudflare R2 integration
- Contributors create detailed work records with comprehensive descriptions
- Multiple contributors can be assigned with individual hour/point allocations
- Files and supporting documentation can be attached
- Submissions support date ranges and categorization
- Eligible validators receive notifications for new contributions
- Validators review contributions and cast PASS/FAIL/SKIP votes
- Configurable approval thresholds determine validation outcomes
- Complete audit trail maintains transparency
VALIDATING β PASSED/FAILED β ON_CHAIN
- VALIDATING: Under peer review
- PASSED/FAILED: Validation complete
- ON_CHAIN: Ready for blockchain rewards distribution
Ensure all environment variables are configured for production:
- Database connection strings
- JWT secrets with strong entropy
- Cloudflare R2 credentials for file storage
- WalletConnect Project ID for wallet connectivity
- Proper CORS and security headers
npm run build
npm start- Configure supported networks and RPC endpoints
- Ensure wallet connection works across target networks
- Test signature validation with production wallet providers
- Implement proper error handling for Web3 interactions
- Study the Codebase: Review CLAUDE.md for development guidelines
- Follow Conventions: Use existing patterns for components and APIs
- Test Thoroughly: Ensure all builds pass and tests succeed
- Lint Clean: Run
npm run lintbefore submitting changes - Type Safety: Maintain strict TypeScript compliance
- Implement soft deletes instead of hard deletes
- Use tRPC for all API endpoints
- Follow the established authentication patterns
- Maintain database referential integrity
- Document any new Web3 integration patterns
TODO
FairSharing - Building transparent, fair collaboration through Web3 technology.