mxllv/stellar_Earn

Turn every task into an achievement. Work, level up, and unlock your earning potential.

โ˜… 0Forks 0GitHub โ†—Compare

README

StellarEarn

A quest-based earning platform that turns work into achievements on the Stellar blockchain

Overview

StellarEarn is a quest-based earning platform where teams define tasks ("quests"), contributors complete them, and rewards are distributed on-chain via Stellar smart contracts (Soroban). Users level up by completing quests, building an on-chain reputation trail and unlocking higher-value opportunities.

What It Does

  • Create & manage quests with criteria, rewards, deadlines, and proof requirements
  • Complete & verify quests with off-chain signals (API, GitHub webhooks, form attestations) and on-chain validation
  • Distribute rewards programmatically to contributors via Stellar assets
  • Track reputation and progress with XP and badges captured through contract state

Goals

  • Provide a trust-minimized, low-fee, and fast-settlement reward system
  • Align incentives for open-source projects, DAOs, and distributed teams
  • Leverage Stellar's strengths in payments, asset issuance, and on/off-ramps

Why Stellar?

Payments-first chain: Stellar was designed for fast, low-cost asset transfers and global remittances, making it ideal for frequent micro-reward payouts.

Asset issuance & compliance-friendly design: Projects can issue reward tokens or use existing assets with built-in trustlines and anchors to access real-world on/off-ramps.

Soroban smart contracts: Modern, Rust-based contracts bring programmability to Stellar, enabling verifiable task completion, escrow, and conditional payouts with deterministic execution and safety-focused tooling.

Learn more: Stellar Developers | Soroban Documentation

Who Is It For?

  • Open-source communities & maintainers who want to reward contributors transparently
  • DAOs & Web3 communities running bounty boards or seasonal quests
  • Startups & product teams incentivizing internal milestones or growth tasks
  • Education & talent platforms that issue credentials and micro-grants for verifiable learning

Key Features

  • ๐Ÿงญ Quest management โ€” create, assign, and track task progress
  • ๐Ÿงฉ Flexible verification โ€” off-chain attestations, API checks, or multi-sig approvals
  • ๐Ÿ’ธ On-chain payouts โ€” rewards via Stellar assets (stablecoins or project tokens)
  • ๐Ÿ›ก๏ธ Escrow & conditions โ€” release rewards only when criteria are met
  • โญ Reputation & levels โ€” XP, badges, and a provable on-chain record
  • ๐ŸŒ Multi-network support โ€” local sandbox, testnet, or mainnet-ready configs

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  FrontEnd/my-app โ”‚      โ”‚   BackEnd        โ”‚      โ”‚  contracts/      โ”‚
โ”‚  Next.js         โ”‚โ—„โ”€โ”€โ”€โ”€โ–บโ”‚   NestJS         โ”‚โ—„โ”€โ”€โ”€โ”€โ–บโ”‚  earn-quest      โ”‚
โ”‚  (App Router)    โ”‚      โ”‚  (REST + TypeORM)โ”‚      โ”‚  Soroban (Rust)  โ”‚
โ”‚ โ€ข Dashboard      โ”‚      โ”‚ โ€ข Auth & RBAC    โ”‚      โ”‚ โ€ข Quest registry โ”‚
โ”‚ โ€ข Quest browser  โ”‚      โ”‚ โ€ข Quest/Payout   โ”‚      โ”‚ โ€ข Escrow/Payout  โ”‚
โ”‚ โ€ข Submissions    โ”‚      โ”‚ โ€ข Webhooks/Jobs  โ”‚      โ”‚ โ€ข Reputation     โ”‚
โ”‚ โ€ข Wallet connect โ”‚      โ”‚ โ€ข Postgres+Redis โ”‚      โ”‚ โ€ข Dispute/Oracle โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • FrontEnd/my-app โ€” Next.js (App Router) web client; wallet connect, quest browsing, submissions, dashboards. Tested with Vitest + Playwright (a11y).
  • BackEnd โ€” NestJS API using TypeORM (PostgreSQL) and Redis/BullMQ for background jobs; auth, quests, submissions, payouts, webhooks, notifications, moderation, analytics, etc. Tested with Jest.
  • contracts/earn-quest โ€” the Soroban (Rust) smart contract: quest registry, escrow, payout, reputation, disputes, oracle. Tested with cargo test.

High-Level Flow

  1. An admin creates a quest (the API persists off-chain metadata; the contract registers the reward logic and escrow).
  2. A contributor submits proof; the API verifies it (webhooks / API checks) and invokes the contract.
  3. The contract validates, transitions state, and releases the payout in Stellar assets.
  4. The UI reflects on-chain state + off-chain metadata; the contributor's reputation/XP updates.

Repository Structure

stellar_Earn/
โ”œโ”€โ”€ BackEnd/                     # NestJS API (TypeORM + PostgreSQL + Redis/BullMQ)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ main.ts
โ”‚   โ”‚   โ”œโ”€โ”€ app.module.ts
โ”‚   โ”‚   โ”œโ”€โ”€ common/             # logger, tracing, guards, interceptors, filters
โ”‚   โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ data-source.ts  # TypeORM DataSource (migrations CLI target)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ migrations/     # TypeORM migrations
โ”‚   โ”‚   โ””โ”€โ”€ modules/            # auth, quests, submissions, payouts, stellar,
โ”‚   โ”‚                           # webhooks, notifications, moderation, jobs, ...
โ”‚   โ”œโ”€โ”€ test/                   # e2e / integration Jest configs
โ”‚   โ”œโ”€โ”€ docker-compose.yml      # local Postgres 15 + Redis 7
โ”‚   โ””โ”€โ”€ .env.example
โ”œโ”€โ”€ FrontEnd/my-app/            # Next.js (App Router) web client
โ”‚   โ”œโ”€โ”€ app/                    # routes (locale-aware)
โ”‚   โ”œโ”€โ”€ components/             # quest, submission, rewards, admin, wallet, ...
โ”‚   โ”œโ”€โ”€ context/  lib/  store/  # wallet context, API client, hooks, state
โ”‚   โ””โ”€โ”€ .env.example
โ”œโ”€โ”€ contracts/earn-quest/       # Soroban / Rust smart contract
โ”‚   โ”œโ”€โ”€ src/                    # lib.rs, escrow.rs, payout.rs, dispute.rs, ...
โ”‚   โ”œโ”€โ”€ tests/                  # integration tests
โ”‚   โ”œโ”€โ”€ Makefile / Justfile     # build / test / deploy helpers
โ”‚   โ””โ”€โ”€ Cargo.toml
โ”œโ”€โ”€ docs/                       # architecture, security, testing, API notes
โ”œโ”€โ”€ scripts/                    # repo-level scripts
โ”œโ”€โ”€ subgraph/                   # indexer
โ””โ”€โ”€ .github/                    # CI workflows, issue/PR templates, CODEOWNERS

Getting Started

Prerequisites

  • Node.js โ‰ฅ 20 (CI uses Node 20)
  • Bun โ‰ฅ 1.1 โ€” the backend's TypeORM/migration scripts invoke bun run โ€ฆ
  • Rust (stable) + the wasm32-unknown-unknown target, and the Stellar CLI (stellar) for the contract
  • Docker (for local PostgreSQL + Redis) and Git

Package-manager note: the BackEnd currently contains multiple lockfiles (bun.lock, package-lock.json, pnpm-lock.yaml); its scripts standardize on Bun. The FrontEnd uses npm/pnpm. Consolidating to a single package manager per app is a tracked cleanup task.

Quickstart

# 1. Clone
git clone https://github.com/EarnQuestOne/stellar_Earn.git
cd stellar_Earn

# 2. Start local infrastructure (PostgreSQL :5432, Redis :6379)
docker compose -f BackEnd/docker-compose.yml up -d

# 3. Backend  โ†’  http://localhost:3001
cd BackEnd
cp .env.example .env             # set DATABASE_URL to the compose Postgres
bun install                      # (npm ci also works for install)
bun run migration:run            # apply TypeORM migrations
bun run start:dev

# 4. Frontend  โ†’  http://localhost:3000   (in a new terminal)
cd FrontEnd/my-app
cp .env.example .env.local       # set NEXT_PUBLIC_API_BASE_URL=http://localhost:3001
npm install
npm run dev

# 5. Contract (in a new terminal)
cd contracts/earn-quest
cargo test                       # run the contract test suite
stellar contract build           # build the wasm  (or: just build / make build)

These commands are derived from the projects' own package.json scripts, docker-compose.yml, and contract Makefile/Justfile. If a command drifts, those files are the source of truth โ€” please open a PR to fix this section.

Environment Variables

Each app ships an .env.example that is the authoritative list โ€” copy it and fill in values.

Backend (BackEnd/.env from BackEnd/.env.example) โ€” key variables:

NODE_ENV=development
PORT=3001
DATABASE_URL=postgres://user:password@localhost:5432/stellar_earn   # matches BackEnd/docker-compose.yml
# plus optional: LOG_*, TRACING_* (OpenTelemetry), DB_POOL_*, FF_* feature flags

Frontend (FrontEnd/my-app/.env.local from FrontEnd/my-app/.env.example) โ€” key variables:

NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
NEXT_PUBLIC_CONTRACT_ID=<deployed-contract-id>
NEXT_PUBLIC_API_BASE_URL=http://localhost:3001
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# optional: NEXT_PUBLIC_SENTRY_DSN, NEXT_PUBLIC_ANALYTICS_ID

Smart Contract

The Soroban contract lives in contracts/earn-quest/. Its authoritative public interface is contracts/earn-quest/src/lib.rs (quest registration, submission, approval, claim/payout, reputation, disputes, oracle) โ€” see contracts/earn-quest/docs/ for details.

cd contracts/earn-quest
cargo test                                   # tests
cargo fmt --all -- --check                   # format check (CI-enforced)
cargo clippy --all-targets --all-features -- -D warnings   # lints (CI-enforced)
stellar contract build                       # build release wasm

# Deploy to testnet (requires funded key + RPC configured)
stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/earn_quest.wasm \
  --source <account> --network testnet

Makefile / Justfile provide build, test, and deploy shortcuts.

API

The backend exposes a REST API documented via OpenAPI/Swagger (generated in CI by the OpenAPI Generation Check workflow). Run the backend and browse the Swagger UI, or consult the generated OpenAPI spec, for the authoritative, always-current endpoint list โ€” routes are intentionally not hardcoded here to avoid drift.

Testing

# Backend (Jest)
cd BackEnd && bun run test           # unit
bun run test:integration             # integration (needs Postgres/Redis)
bun run test:e2e                     # e2e

# Frontend (Vitest + Playwright)
cd FrontEnd/my-app && npm run test   # unit/integration
npm run typecheck                    # tsc --noEmit
npm run test:a11y                    # accessibility (Playwright + axe)

# Contract (Rust)
cd contracts/earn-quest && cargo test

Continuous Integration

GitHub Actions gate every PR (see .github/workflows/):

  • backend-ci / backend-lint / backend-integration โ€” build, lint, and integration tests for BackEnd
  • backend-changelog โ€” enforces per-module CHANGELOG.md updates
  • frontend-ci / frontend-vitest-cache / accessibility โ€” build, unit, and a11y tests for FrontEnd/my-app
  • contract-ci โ€” cargo build/test, fmt --check, clippy -D warnings, and wasm build on Ubuntu + Windows
  • secret-scan โ€” scans for committed secrets
  • testnet-canary-deployment โ€” contract canary deploy to testnet

Contributing

We welcome contributions. Please read CONTRIBUTING.md and use the issue and pull-request templates:

Guidelines:

  1. Fork and create a feature branch: git checkout -b feat/<short-name>
  2. Follow Conventional Commits (feat:, fix:, docs:, refactor:, test:, chore:)
  3. Add/keep tests passing and update the relevant module CHANGELOG.md
  4. Lint, typecheck, and run the affected app's test suite before opening a PR

Security

Please report vulnerabilities privately โ€” see SECURITY.md. Do not open public issues for security problems and never commit secrets or key material.

Resources

License

Released under the MIT License.

Contributors

RUKAYAT-CODERJosue19-08sublime247walexjnrNimatstarsolomonadzape95Meet-hybridmemplethee-labmillicentogalanyaMerlinTheWhizdot-ennypope-hyusuftomilolaakargiKevinMB0220collinsezedikemijinummiwumibalsAgbasimereshamoo53Emelie-Devshogun444Adedayo-DatamfteeAdeyemi-cmdykargeee-bit0xDeonrabsqueengabito1451AbdulmujibOladayo

Issues