Single source of truth for onboarding and local development across all monorepo workspaces.
Fund-My-Cause is a monorepo consisting of Soroban smart contracts, a Next.js frontend, Node.js microservices, Python scoring engines, and shared TypeScript libraries. This guide covers environment configuration, installation, contract compilation, and service startup for all components.
- Monorepo Architecture Overview
- Prerequisites
- Quickstart (5-Minute Setup)
- Workspace Setup & Execution
- Environment Variables Reference
- Docker & Containerized Stack
- Testing & Quality Checks
- Troubleshooting Guide
Fund-My-Cause/
├── apps/
│ ├── interface/ # Next.js 16 App Router UI (Tailwind CSS, Freighter)
│ └── components-lib/ # Shared UI React component library
├── backend/
│ ├── fraud_detection/ # Python pipeline for Sybil & donation fraud detection
│ └── recommendations/ # Python campaign ranking & scoring engine
├── contracts/
│ ├── crowdfund/ # Core crowdfunding Soroban smart contract (Rust)
│ ├── registry/ # Campaign registry & discovery contract (Rust)
│ └── achievements/ # Gamification / NFT badges contract (Rust)
├── packages/
│ ├── shared-utils/ # Cross-package utility functions & logging helpers
│ └── types/ # Shared TypeScript data models & schemas
├── sdks/
│ └── js/ # JavaScript/TypeScript SDK for contract interaction
├── services/
│ ├── graphql-api/ # Apollo Server 4 GraphQL API with Redis caching & WS
│ ├── indexer/ # Soroban RPC event listener & ingestion daemon
│ └── monitoring-service/ # APM, metrics exporter, and health monitoring
└── docker-compose.yml # Local infra (PostgreSQL, Redis)
Ensure the following tools are installed on your machine:
| Tool | Version | Purpose | Installation |
|---|---|---|---|
| Node.js | 20.x or higher | Frontend, services, SDKs | nodejs.org or nvm install 20 |
| npm | 9.x or higher | Monorepo package management | Included with Node.js |
| Rust & Cargo | 1.70+ | Smart contract compilation | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
| wasm32 target | Latest | WebAssembly contract target | rustup target add wasm32-unknown-unknown |
| Stellar CLI | 21.0+ | Contract deployment & RPC | cargo install --locked stellar-cli --features opt |
| Python | 3.10+ | Backend fraud & recommendation | python.org |
| Docker & Compose | Latest | PostgreSQL & Redis services | docker.com |
| Freighter Wallet | Latest | Browser extension for Stellar auth | freighter.app |
For contributors wanting to get up and running immediately with mock data:
# 1. Clone the repository
git clone https://github.com/Fund-My-Cause/Fund-My-Cause.git
cd Fund-My-Cause
# 2. Install monorepo dependencies
npm install
# 3. Build smart contracts into WASM
npm run contracts:build
# 4. Generate local test fixtures
npm run fixtures:generate
# 5. Start the frontend
npm run devVisit http://localhost:3000 to interact with the UI using local mock data.
Contracts are written in Rust for the Stellar Soroban runtime.
# Build all contracts via root script
npm run contracts:build
# Or build manually using cargo
cargo build --release --target wasm32-unknown-unknownWASM artifacts are generated in target/wasm32-unknown-unknown/release/.
# Run unit & integration tests across all Rust crates
npm run contracts:test# Generate a testnet account and fund it via Friendbot
stellar keys generate --network testnet --name dev-deployer
stellar keys address dev-deployer
# Set credentials
export CREATOR=$(stellar keys address dev-deployer)
export TOKEN="CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC"
# Seed testnet with sample campaigns and generate apps/interface/.env.local
./scripts/seed-testnet.sh --creator "$CREATOR" --token "$TOKEN"Next.js 16 application with Tailwind CSS and Stellar Freighter wallet integration.
cp apps/interface/.env.example apps/interface/.env.localKey .env.local variables:
NEXT_PUBLIC_NETWORK=testnet
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
NEXT_PUBLIC_REGISTRY_ID=C... # Generated by seed script or deploy.sh
NEXT_PUBLIC_GRAPHQL_URL=http://localhost:4000/graphql# From monorepo root
npm run dev
# Or directly in workspace
npm run dev --workspace=apps/interfaceAccess at http://localhost:3000.
Apollo Server 4 / Express service providing query aggregation, Redis caching, and WebSocket subscriptions.
Start Redis:
docker compose up -d rediscp services/graphql-api/.env.example services/graphql-api/.envEnsure JWT_SECRET is at least 32 characters long and not a default value:
PORT=4000
NODE_ENV=development
REDIS_URL=redis://localhost:6379
RPC_URL=https://soroban-testnet.stellar.org
CONTRACT_NETWORK=testnet
JWT_SECRET=your_super_secret_jwt_key_at_least_32_characters_long_12345
CORS_ORIGIN=http://localhost:3000,http://localhost:5173# Start in development mode
npm run dev --workspace=services/graphql-apiGraphQL Playground / Endpoint: http://localhost:4000/graphql
Health check: http://localhost:4000/health
npm run docs:generate --workspace=services/graphql-apiEvent listener and ingestion daemon that scans Soroban contract events and syncs state to PostgreSQL.
Start PostgreSQL:
docker compose up -d postgrescp services/indexer/.env.example services/indexer/.envPORT=3001
DATABASE_URL=postgresql://fundmycause:fundmycause123@localhost:5432/fundmycause
STELLAR_RPC_URL=https://soroban-testnet.stellar.org
NETWORK=testnet
POLL_INTERVAL_MS=3000npm run dev --workspace=services/indexerMetrics aggregator, health monitor, and OpenTelemetry / Prometheus APM exporter.
cp services/monitoring-service/.env.example services/monitoring-service/.env
npm run dev --workspace=services/monitoring-serviceMetrics endpoint: http://localhost:9090/metrics
Python modules for fraud detection and quadratic funding / campaign recommendation scoring.
# Create and activate Python virtual environment
python3 -m venv venv
source venv/bin/activate # Windows: .\venv\Scripts\activate
# Install dependencies
pip install -r backend/fraud_detection/requirements.txt
pip install -r backend/recommendations/requirements.txtpython backend/recommendations/service.pypytest backend/fraud_detection/
pytest backend/recommendations/When modifying @fund-my-cause/sdk, @fund-my-cause/types, or @fund-my-cause/shared-utils:
# Build shared types
cd packages/types && npm run build
# Build shared utilities
cd packages/shared-utils && npm run build
# Build JavaScript SDK
cd sdks/js && npm run build| Workspace | File | Key Variables | Description |
|---|---|---|---|
| Root | .env |
DATABASE_URL, REDIS_URL, COMPOSE_PROJECT_NAME |
Global Docker Compose and infrastructure config |
apps/interface |
.env.local |
NEXT_PUBLIC_SOROBAN_RPC_URL, NEXT_PUBLIC_REGISTRY_ID, NEXT_PUBLIC_NETWORK |
Frontend contract IDs, network selectors, API URLs |
services/graphql-api |
.env |
PORT, REDIS_URL, RPC_URL, JWT_SECRET (>=32 chars), CORS_ORIGIN |
GraphQL Apollo server configuration |
services/indexer |
.env |
DATABASE_URL, STELLAR_RPC_URL, NETWORK, POLL_INTERVAL_MS |
Blockchain event ingestion parameters |
services/monitoring-service |
.env |
PORT, LOG_LEVEL, METRICS_PORT |
Prometheus and APM monitoring flags |
You can launch the complete local stack (Postgres, Redis, GraphQL API, Indexer, Frontend) using Docker Compose:
# Start all backing services (PostgreSQL, Redis)
docker compose up -d postgres redis
# Or start the full stack including containers
docker compose -f docker-compose.full.yml up --buildRun the following checks before committing code:
# 1. Smart Contract Tests
npm run contracts:test
# 2. Frontend Linting & Typecheck
npm run lint --workspace=apps/interface
# 3. End-to-End Tests (Playwright)
npm run test:e2e
# 4. Secret Scan & Git Hooks
npx lint-staged- Cause: The Stellar CLI binary is not in your system
$PATH. - Solution: Install via Cargo:
Ensure
cargo install --locked stellar-cli --features opt
~/.cargo/binis in yourPATH(export PATH="$HOME/.cargo/bin:$PATH").
- Cause: WebAssembly compilation target is missing in your Rust toolchain.
- Solution:
rustup target add wasm32-unknown-unknown
- Cause:
services/graphql-apivalidatesJWT_SECRETon startup and rejects empty, short (<32 chars), or example default keys. - Solution: Generate a strong 32+ character key in
services/graphql-api/.env:openssl rand -hex 32
- Cause: Redis server is not running.
- Solution: Start Redis using Docker Compose:
Note:
docker compose up -d redis
services/graphql-apiwill automatically fall back to an in-memory rate limiter ifREDIS_URLis omitted.
- Cause:
.env.localcontains placeholder contract IDs or testnet contracts were not deployed. - Solution:
- For mock UI development: Run
npm run fixtures:generate - For real testnet interaction: Run
./scripts/seed-testnet.shto populate fresh testnet contract IDs intoapps/interface/.env.local.
- For mock UI development: Run
- Cause: Stellar Friendbot rate limiting or network congestion.
- Solution: Visit
https://friendbot.stellar.org/?addr=<YOUR_STELLAR_ADDRESS>in your browser or retry after a few seconds.