Skip to content

Latest commit

Β 

History

1,973 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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.

About

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

Resources

Contributing

Security policy

Stars

36 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages