Under Construction This DApp is in development

Running a Local Dev Environment

This guide walks you through spinning up the entire OmniSocial stack locally for development.

It includes smart contract deployment, subgraph indexing, and launching the frontend interface with live data.

πŸ›  Prerequisites

Make sure you have the following installed:

  • Node.js β‰₯ v18

  • Yarn (or npm)

  • Docker & Docker Compose

  • Hardhat

  • Graph CLI (npm install -g @graphprotocol/graph-cli)

  • Foundry (optional, for contract fuzzing/tests)

πŸ“ Project Structure

Assuming the monorepo layout:

omnisocial/
β”œβ”€β”€ contracts/             # Hardhat smart contracts
β”œβ”€β”€ subgraph/              # The Graph subgraph definitions
β”œβ”€β”€ apps/                  
β”‚   └── frontend/          # Next.js frontend app
β”œβ”€β”€ scripts/               # Deployment & helper scripts
└── .env.example           # Environment variables template

βš™οΈ Step 1: Launch Hardhat Node

Start a local blockchain with in-memory state.

cd contracts
npx hardhat node

Keep this running in a dedicated terminal window.

πŸš€ Step 2: Deploy Contracts

In a new terminal, deploy to the local network:

npx hardhat run scripts/deployAll.ts --network localhost

βœ… This will deploy:

  • OmniWalletFactory

  • PersonaNFT

  • RepModule

  • DAOFactory

  • Supporting modules (e.g., Recovery, Tip, EditionDrop)

πŸ” Step 3: Run The Graph Indexer

Spin up the Graph Node stack:

cd subgraph
docker-compose up

Then generate and deploy the subgraph:

yarn codegen
yarn build
yarn create-local
yarn deploy-local

Make sure your subgraph is pointing to http://localhost:8545 and syncing properly.

πŸ’» Step 4: Launch Frontend

Start the Next.js frontend:

cd apps/frontend
cp .env.example .env.local
# Fill in addresses, subgraph URL, etc.
yarn install
yarn dev

Then open your browser to:

http://localhost:3000

πŸ“ˆ Test Workflow

  1. Create a wallet via the UI or script

  2. Mint a PersonaNFT

  3. Post or tip content

  4. Create a DAO

  5. Vote on proposals

  6. View results via subgraph queries

πŸ§ͺ Optional: Run Tests

cd contracts
npx hardhat test

🧰 Troubleshooting Tips

Issue
Fix

Graph node doesn't start

Check Docker memory limit; it needs ~2–4 GB

Subgraph not indexing

Ensure contracts are deployed and addresses match in config

Frontend errors on GraphQL requests

Double-check .env.local for correct subgraph endpoint

Last updated

Was this helpful?