FairFund is a blockchain-based platform for community-driven funding.
Users can deploy funding vaults, deposit funds, vote on proposals, and distribute funds in a decentralized manner.
- Introduction
- Technology Stack
- Architecture
- Run Locally
- Usage Guide
- Smart Contract Documentation
- Deployment
- Future Improvements
- Contributing
- Community
FairFund is a blockchain-based platform for community-driven funding.
Users can:
- Deploy funding vaults
- Deposit and lock funds
- Create proposals
- Vote and determine fund distribution
- Withdraw results transparently
The platform uses a decentralized voting mechanism to decide which proposals receive funding.
- Frontend: Next.js, TailwindCSS, ShadCN UI
- Backend: Next.js API Routes, Prisma ORM, NextAuth, SIWE, Web3Modal
- Blockchain: Foundry, Solidity
- Database: PostgreSQL
- Tools: Wagmi, Viem, React Hook Form
-
Foundry Setup
Install using: https://getfoundry.sh/ -
Node.js Setup
Guide: https://nodejs.org/en/learn/getting-started/introduction-to-nodejs -
Docker Setup
Guide: https://docs.docker.com/get-started/introduction/
-
Navigate to the Blockchain Directory:
cd app/blockchain -
Install Dependencies:
forge install
-
Run Tests:
forge test -
Run Local Anvil Chain:
anvil
-
Deploy Mock Smart Contracts:
make mock-all
Note: This will automatically update relevant contract addresses and ABIs for smart contract in web-app folder.
-
Deploy to the Testnet: (Optional)
- Ensure you have a
.envfile set up. You can use.env.exampleas a template. - Load the environment variables:
source .env- Deploy the contract:
make deploy-sepolia
- Ensure you have a
-
Navigate to the Web App Directory:
cd app/web-app -
Install Dependencies:
npm install
-
Update the environment variables: Create a
.envfile in theweb-appdirectory and add all the values. You can use.env.exampleas a template.PostgreSQL:
- If using Docker (with the provided docker-compose.yml), the defaults provided for
POSTGRES_PRISMA_URLandPOSTGRES_URL_NON_POOLINGprovided in .env.example will work. - If using a local instance of PostgreSQL, update the
POSTGRES_PRISMA_URLandPOSTGRES_URL_NON_POOLINGwith the correct connection url for the local postgreSQL.
NextAuth:
- Generate a secure
NEXTAUTH_SECRETby running the following command in the terminal
openssl rand -base64 32
- For local development
NEXTAUTH_URLwill behttp://localhost:3000
- If using Docker (with the provided docker-compose.yml), the defaults provided for
-
To start local instance of postgreSQL database (with docker):
- Start docker desktop
- Run
docker compose up
-
Run the Development Server:
npm run dev
-
Access the Web App:
- Open your browser and navigate to
http://localhost:3000.
- Open your browser and navigate to
Our platform supports three types of users: Vault Creators, Proposal Creators, and Voters/Community Members. Here's how each user type can navigate and use the application:
Vault.Creator.mp4
-
Getting Started
- On the landing page, click "Get Started" to access the dashboard
- Connect your wallet and sign in with Ethereum
-
Creating a Vault
- Click the "Create" button and select "Vault" from the dropdown
- Choose a space for your vault (multiple vaults can exist in one space)
- Enter the vault description, token configurations, and funding parameters
- Review and submit the proposal (requires a wallet transaction)
-
Optional: Add Funds
- After creation, you can immediately add funds to your vault
-
Vault Management
- You'll be redirected to the vault page to view all details
Proposal.Creator.mp4
-
Getting Started
- On the landing page, click "Get Started" to access the dashboard
- Connect your wallet and sign in with Ethereum
-
Creating a Proposal
- Click the "Create" button and select "Proposal" from the dropdown
- Search and select the vault you want to create a proposal for
- Enter the proposal description, minimum and maximum request amounts, and recipient address
- Review the information and submit
-
Tracking Proposals
- View your created proposals in the "My Activity" page or on the vault details page
Community.Member.small.mp4
-
Accessing Vaults
- On the landing page, click "Get Started" to access the dashboard
- Click "Spaces" in the navbar to view available spaces
- Select a space and then choose a vault within that space
-
Participating in a Vault
- On the vault page, register to vote
- Deposit tokens for distribution
- Create new proposals (if desired)
- After the tally date, withdraw remaining funds (if applicable)
-
Viewing Results
- After the tally date, results page will be accessible to view the distribution statistics and other vault-related information
Smart contract documentation can be found here.
- Smart Contract:
- Mainnets
- Testnets
- Frontend: FairFund
- Add support for multiple blockchains
- Audit smart contracts
- Refactor smart contracts for better readability and extensibility. detailed issue
- Implement functionality to sponser gas for voting and proposal creation
- Optimize smart contracts further
- Add comments functionality on proposals page
- Enable editing of space, proposal, and vault descriptions
- Implement moderation functionality for spaces (control who can create vaults and proposals)
- Add ability to delegate moderation functionality to users other than creator of the space
- Implement various fund distribution mechanisms
We welcome additional suggestions! Join our Discord: Discord Link
- Create an issue on GitHub
- Discuss your ideas on our project's Discord channel
(#fairfund)in Stability Nexus Server (if required). - Wait for the issue to be assigned to you
- Fork the repository
- Set up the project locally using this Run Locally Guide
- Create a new branch following this format:
type/brief-description- Types:
fix,feat,chore,perf, orrefactor - Example:
feat/add-space-moderation-functionality
- Types:
- Switch to the new branch
- Make your changes
- Commit your changes
- Decide on the scope of the change:
- Small changes (minor fixes, documentation updates, small UI tweaks) → Make a pull request directly to
main - Big changes (new features, major refactors) → Make a pull request to
developbranch
- Provide a detailed description of your changes in the PR, including videos and images for visible UI changes.
- Take your time to create high-quality PRs - do not commit code hastily
- Ensure all changes are thoroughly tested before submission
- Avoid introducing code smells
- Do not submit untested code as it complicates the review process
- Only include code in the commit that is intentional. Avoid using
git add .to prevent unintended changes from being committed.
- Small frontend changes (< 20 lines) or documentation updates can be submitted without prior assignment
- Unassigned PRs will be closed without review
- Check existing issues and PRs to avoid duplicating efforts
- Tag the maintainer if your PR is unattended for:
- 1 week for small contributions
- 2 weeks for larger contributions
- Issues should be completed within:
- 5 days for small tasks
- 15 days for complex tasks
- Provide regular progress updates in issue/PR comments if work extends beyond expected timeline
- Issues may be reassigned if not completed within the specified timeframe
If you have questions or need clarification, please ask on Discord.
© 2025 The Stable Order
