This document explains Patchwork at a very low level, covering:
- Frontend architecture
- Backend architecture
- Async systems
- Chat system
- Smart contracts (Stellar / Soroban)
- Data flow
- Security & trust model
This is meant for engineering alignment, not marketing.
Patchwork is a multi-ecosystem infrastructure that:
- connects open-source developers with open-source projects
- tracks verifiable contributions (PRs, issues, commits)
- locks rewards on-chain
- automatically pays contributors on successful merges
- builds reputation and rankings
- enables direct dev ↔ maintainer communication
Patchwork is not a chain.
Patchwork is a coordination + verification layer.
flowchart TB
FE["Frontend<br>Next.js"]
API["Backend API<br>Go + Fiber"]
BUS[NATS Event Bus]
WORKERS[Async Workers]
DB[(PostgreSQL)]
REDIS[(Redis)]
GH[GitHub API / Webhooks]
IPFS[(IPFS)]
CHAIN["Blockchain<br>Stellar (Soroban)"]
FE --> API
GH --> API
API --> DB
API --> REDIS
API --> BUS
BUS --> WORKERS
WORKERS --> DB
WORKERS --> IPFS
WORKERS --> CHAIN
- Next.js (App Router)
- TypeScript
- Tailwind CSS
- Wallet SDKs (Stellar)
- WebSockets (chat)
- REST + SSE
The frontend is thin.
All trust logic lives in the backend.
Frontend handles:
- wallet connection
- GitHub OAuth flow
- data visualization
- chat UI
- transaction signing
- user interactions
/app
├── auth
├── dashboard
├── projects
├── bounties
├── submissions
├── patchquest
├── leaderboard
├── chat
└── admin
- User connects wallet
- Signs nonce
- Sends signature to backend
- Receives JWT
- All requests authenticated via JWT
- WebSocket connection
- Room-based subscriptions
- Optimistic UI updates
- Messages persisted only after backend ACK
| Layer | Technology |
|---|---|
| Language | Go 1.22+ |
| HTTP | Fiber (fasthttp) |
| DB | PostgreSQL |
| DB Driver | pgx |
| Cache | Redis |
| Event Bus | NATS |
| Storage | IPFS |
| Auth | Wallet + GitHub OAuth |
- HTTP APIs must be fast and predictable
- No external calls in request path
- All heavy work is async
- Database is source of truth
- Blockchain is settlement layer
api-gateway
├── auth
├── projects
├── bounties
├── submissions
├── chat
├── reputation
├── leaderboard
└── admin
workers
├── github-sync
├── verifier
├── payout
├── reputation
└── notifications
Postgres stores truthful state only.
Core tables:
- users
- projects
- bounties
- submissions
- payouts
- reputation_events
- chat_rooms
- chat_messages
Redis is used for:
- rate limiting
- webhook deduplication
- leaderboards (sorted sets)
- hot reads (project pages)
- chat pub/sub
Redis is never the source of truth.
flowchart LR
API -->|emit| NATS
NATS --> VERIFIER
NATS --> PAYOUT
NATS --> REPUTATION
API only emits events.
Workers process events independently.
Subscribed events:
- issues
- pull_request
- pull_request_review
- push
- Validate signature
- Deduplicate via Redis
- Emit event to NATS
- Return 200 OK
- Never process GitHub logic inline
sequenceDiagram
participant Dev
participant FE
participant API
participant GH
participant BUS
participant VER
participant PAY
participant CHAIN
Dev->>FE: Submit PR
GH-->>API: PR merged webhook
API->>BUS: PR_MERGED
BUS->>VER: Verify PR
VER->>GH: Fetch commits
VER->>VER: Generate proof
VER->>BUS: VERIFIED
BUS->>PAY: Release payout
PAY->>CHAIN: Execute tx
Smart contracts are:
- minimal
- deterministic
- dumb by design
All logic stays off-chain.
Escrow Contract
Responsibilities:
- lock funds
- release funds to contributor
- allow refunds on timeout
Data:
- project_id
- bounty_id
- contributor_address
- amount
Used for:
- escrow releases
- automated settlement
Flow:
- backend emits payout intent
- Soroban transaction executes
- tx confirmation sent back
Verification includes:
- PR merge check
- commit author check
- issue mapping
- optional test execution
Proof format:
- JSON
- hashed
- stored on IPFS
Reputation is:
- calculated off-chain
- optionally anchored on-chain
- immutable history
Factors:
- bounty value
- project reputation
- PatchQuest weight
PatchQuest is:
- a time-boxed contribution window
- leaderboard snapshot
- reward pool allocator
Backend responsibilities:
- cycle start/end
- scoring
- ranking freeze
- payout triggers
Purpose
- clarify requirements
- negotiate scope
- avoid PR rejection
Backend Chat Model
flowchart LR
WS[WebSocket]
CHAT_API
REDIS
DB
WS --> CHAT_API
CHAT_API --> DB
CHAT_API --> REDIS
REDIS --> WS
Features:
- wallet-authenticated messages
- project-scoped rooms
- bounty threads
- moderation flags
- Wallet signature auth
- Webhook signature validation
- Idempotent workers
- Replay protection
- Role-based permissions
- Audit logs
- Optional KYC hooks (admin)
- Low latency APIs (1–5ms)
- Massive concurrency (goroutines)
- No RPC blocking
- Chain-agnostic
- Hackathon + production ready
- Trust minimized
- Future-proof
- AI PR review
- AI contributor matching
- milestone-based grants
- DAO voting
- zk-proof verification
- cross-chain identity
Patchwork is:
- not a marketplace
- not a DAO
- not a chain
Patchwork is:
an open-source contribution coordination layer with verifiable payouts.