Skip to content

Repository files navigation

Orivex Backend

The API that powers learn-to-earn on the Stellar network.

License: MIT Node.js pnpm TypeScript Stellar PRs Welcome

Anywhere. Anyone. Learn freely. Earn provably. Orivex turns financial literacy and digital skills into portable, on-chain credentials β€” built mobile-first for emerging markets.

🌐 Website Β· πŸ“š Docs Β· πŸ› Report Bug Β· ✨ Request Feature Β· πŸ’¬ Discord


✨ Why Orivex?

Behind every credential, every reward, and every learner profile sits this repo: a stateless, JSON-first API that talks to PostgreSQL and the Stellar ledger with equal ease.

πŸͺ Decentralised by default Credentials and payouts settle on Stellar β€” no central authority can revoke or forge them.
πŸ“± Mobile-first ergonomics Designed for low-bandwidth PWAs running on entry-level Android handsets.
πŸ” Privacy-preserving ZK-proof friendly data shapes; selective disclosure comes standard.
πŸ’Ό B2B-ready Verified-talent search API for employers β€” paid feature, built in.

🌌 Ecosystem

Orivex Backend is one of three repos. Together they form the full stack.

Repo Role Stack
Orivex-Backend ← you are here API, identity, rewards, credentials Node.js Β· Express Β· PostgreSQL Β· Prisma
Orivex-App Mobile-first PWA frontend React Β· Next.js Β· TypeScript Β· Tailwind
Orivex-Contracts Soroban smart contracts for credential issuance Rust Β· Soroban SDK

🧭 Feature Map

πŸ›οΈ Core Platform

  • πŸ” Authentication & Sessions β€” JWT issuance, password bcrypt, role-aware middleware, and token rotation.
  • πŸ“š Modules & Progress β€” Catalogue, completion submission, offline sync, idempotent ingestion.
  • 🎁 Rewards Engine β€” Stellar-based payouts with reconcilable memos and dispute handling.
  • πŸŽ“ Verifiable Credentials β€” Mint, fetch, and publicly verify credentials by on-chain ID.
  • 🀝 Referrals β€” Multi-tier tracking, capped rewards, anti-abuse heuristics.

βš™οΈ Operations & Integrations

  • πŸ”” Push Notifications β€” Firebase Cloud Messaging with topic targeting, per-device tokens.
  • πŸ“¨ Webhooks Out β€” HMAC-signed (X-Orivex-Signature) deliveries with retry and DLQ semantics.
  • 🧱 Employer Search β€” Talent-pool query API for verified learners with consent gating.
  • πŸ›‘οΈ Rate Limiting & Validation β€” Redis-backed counters and Zod schemas on every entry point.

πŸ—οΈ Architecture at a Glance

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Orivex PWA (mobile web)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚ HTTPS Β· JWT Β· /api/v1
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       Orivex Backend (this repo)              β”‚
β”‚                                                                β”‚
β”‚  [ Auth ]──[ Modules ]──[ Rewards ]──[ Credentials ]──[ Search ]β”‚
β”‚       Express Β· Zod Β· Winston Β· Helmet Β· Rate-Limit            β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
     β”‚                           β”‚                          β”‚
     β”‚                           β”‚                          β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PostgreSQL   β”‚         β”‚ Stellar Ledger β”‚         β”‚ Soroban RPC   β”‚
β”‚  (Prisma ORM) β”‚         β”‚  Horizon Β·     β”‚         β”‚  Credential   β”‚
β”‚  Users Β· Mods β”‚         β”‚  Assets Β· Memosβ”‚         β”‚  Contracts    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Layered internals: routes (HTTP framing) β†’ middleware (auth, validation, rate-limit) β†’ controllers (request orchestration) β†’ services (business logic) β†’ Prisma / Stellar RPC (persistence and settlement).

For the full system design, see docs/ARCHITECTURE.md.


πŸš€ Quick Start

Prerequisites

  • Node.js 20 or newer
  • pnpm 10 or newer
  • PostgreSQL 14 or newer (or Docker)
  • Optional: Redis for distributed rate-limiting
  • Optional: Rust toolchain if you'll be hacking on linked Soroban contracts

Install & Run

# 1. Clone
git clone https://github.com/Kqirox/Orivex-Backend.git
cd Orivex-Backend

# 2. Install
pnpm install

# 3. Configure
cp .env.example .env
# edit .env with your DATABASE_URL and Stellar testnet secrets

# 4. Provision the database
pnpm db:migrate
pnpm db:seed       # optional: load demo modules / sample users

# 5. Run
pnpm dev           # starts Express + nodemon on the configured PORT

The API will be live at http://localhost:<PORT>/api/v1. Swagger UI is mounted in dev mode β€” see docs/API.md for the canonical endpoint reference.

πŸ“¦ Detailed database instructions live in prisma/SETUP.md.

Everyday Commands

Script What it does
pnpm dev Run the API with hot reload (nodemon + ts-node)
pnpm build Compile TypeScript to dist/
pnpm start Boot the compiled build (production)
pnpm test Run the Vitest suite (unit + integration)
pnpm test:coverage Generate coverage report
pnpm lint ESLint over src/ and tests/
pnpm db:migrate Apply Prisma migrations
pnpm db:seed Load demo data
pnpm db:studio Open Prisma Studio

🌐 API Surface (skim)

POST   /api/v1/auth/register         sign up
POST   /api/v1/auth/login            sign in
GET    /api/v1/modules               list catalogue
POST   /api/v1/modules/:id/complete  submit progress (idempotent)
GET    /api/v1/credentials           list my credentials
GET    /api/v1/credentials/verify/:id   public verification (no auth)
GET    /api/v1/employer/search       talent pool query
POST   /api/v1/referrals             register a referral

Full schemas, error envelopes, and example payloads: docs/API.md.


πŸ› οΈ Tech Stack

Layer Choice
Runtime Node.js 20 LTS
Language TypeScript (strict)
HTTP Express 5
ORM / DB Prisma Β· PostgreSQL 14+
Validation Zod
Auth JWT Β· bcrypt
Blockchain @stellar/stellar-sdk Β· Soroban RPC
Notifications Firebase Cloud Messaging
Testing Vitest Β· Supertest
Tooling ESLint Β· Prettier Β· Swagger UI Β· nodemon

πŸ“š Documentation

Every operational concern is documented.

Doc Purpose
docs/API.md Endpoint reference and request/response schemas
docs/ARCHITECTURE.md System design, layers, deployment topology
docs/DEVELOPING.md Local setup, coding conventions, test strategy
docs/OPERATIONS.md Deploying, scaling, logging, observability
docs/ERROR_HANDLING.md AppError hierarchy, HTTP mapping, troubleshooting
docs/SECURITY.md Threat model, secrets, reporting vulnerabilities
docs/ROADMAP.md Current quarter priorities and later bets
docs/CHANGELOG.md Notable versioned changes

🀝 Contributing

We welcome PRs of every shape: bug fixes, features, docs, tests, examples.

  1. Skim docs/CONTRIBUTING.md for workflow and style.
  2. Read docs/CODE_OF_CONDUCT.md β€” be kind, stay constructive.
  3. Pick an open issue or propose one via RFC. Tag-heavy work? Check docs/ROADMAP.md first.
  4. Open a PR. CI will run lint, typecheck, and the test suite.

Conventional Commits are encouraged. Tags follow Semantic Versioning. Releases are cut from main.


πŸ›‘οΈ Security

If you discover a vulnerability, do not open a public issue. Follow the disclosure process in docs/SECURITY.md and we'll respond within 72 hours.


πŸ“œ License

This project is licensed under the MIT License β€” see LICENSE.


🌟 Acknowledgements

  • Stellar Development Foundation β€” for the rails our payouts run on.
  • Every contributor who has shipped a PR, filed a thoughtful issue, or helped a learner onboard.
  • The Orivex community β€” testers, educators, and learners in equal measure.

βœ‰οΈ Contact

Built with care by the Orivex team β€” and a lot of β˜•

About

Backend API powering Orivex's learn-to-earn platform with authentication, rewards, verifiable credentials, and Stellar blockchain integration.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages