Skip to content

postqcoin/OrbitChain-API

 
 

Repository files navigation

OrbitChain API

Decentralized Fundraising & Campaign Management API
Built on NestJS · Powered by Stellar · Backed by PostgreSQL

NestJS Stellar PostgreSQL


Overview

OrbitChain is a decentralized fundraising platform API that enables transparent, blockchain-verified campaign creation, donation processing, and milestone-based fund releases on the Stellar network. Designed for NGOs, community organizers, and individual fundraisers who demand trustless accountability.

Key Capabilities

  • 🔐 Stellar Wallet Authentication — Sign-in with Stellar key-based challenge-response
  • 📋 Campaign Lifecycle Management — Draft → Approval → Active → Completion
  • 💰 Blockchain-Verified Donations — On-chain transaction tracking and confirmation
  • 🎯 Milestone-Based Fund Releases — Smart contract-governed milestone unlocking
  • 🔔 Real-Time Notifications — WebSocket + email notifications for all campaign events
  • 📊 Analytics & Export — Campaign stats, donation history, CSV exports
  • 🛡️ Admin Dashboard — User management, KYC verification, dispute resolution
  • 📝 Audit Trail — Immutable audit logs for compliance and transparency

Tech Stack

Layer Technology
Runtime Node.js + TypeScript
Framework NestJS (Express adapter)
Database PostgreSQL + Prisma ORM
Cache / Queue Redis + Bull
Blockchain Stellar SDK + Soroban Smart Contracts
Real-Time Socket.IO WebSockets
Monitoring Sentry error tracking
Email Nodemailer (SMTP)
API Docs Swagger / OpenAPI

Project Setup

Prerequisites

  • Node.js >= 18
  • PostgreSQL >= 14
  • Redis >= 6
  • npm or yarn

Installation

# Clone the repository
git clone <repository-url>
cd orbitchain-api

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your database, Redis, and Stellar configuration

Configuration

Update the .env file with your credentials:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/orbitchain?schema=public"

# Redis
REDIS_URL="redis://localhost:6379"

# JWT
JWT_SECRET=your-secure-secret-here

# Email (optional — console fallback in development)
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=your-user
SMTP_PASS=your-password
EMAIL_FROM=noreply@orbitchain.io

Database Migrations

# Generate Prisma client
npx prisma generate

# Run migrations
npx prisma migrate dev --name init

# (Optional) Open Prisma Studio
npx prisma studio

Running the Application

# Development (hot reload)
npm run start:dev

# Production
npm run build
npm run start:prod

# Debug mode
npm run start:debug

The API will be available at http://localhost:3000 and Swagger docs at http://localhost:3000/api/docs.


Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Test coverage
npm run test:cov

API Modules

Module Description Endpoints
Auth Stellar wallet challenge-response auth /auth/*
Users Profile, KYC, notification preferences /users/*
Campaigns CRUD, stats, fund release requests /campaigns/*
Donations Donation creation, history, admin tips /donations/*
Milestones Campaign milestone tracking /milestones/*
Contracts Soroban smart contract management /contracts/*
Notifications WebSocket gateway + REST endpoints /notifications/*
Admin User moderation, campaign suspension /admin/*
Health Health checks (DB, Redis) /health
API Keys Programmatic API key management /api-keys/*

Project Structure

src/
├── admin/              # Admin dashboard & moderation
├── api-keys/           # API key management
├── audit/              # Audit log entities
├── auth/               # Stellar wallet authentication
├── campaigns/          # Campaign CRUD & lifecycle
├── common/             # Shared guards, decorators, middleware
├── contracts/          # Soroban smart contract services
├── donations/          # Donation processing & admin tips
├── health/             # Health check endpoints
├── milestones/         # Milestone tracking & fund release
├── notifications/      # Email, WebSocket, notification prefs
├── platform/           # Platform tip processing
├── prisma/             # Prisma ORM service & module
├── queue/              # Bull queue configuration
├── redis/              # Redis module
├── stellar/            # Stellar SDK, Soroban, event services
├── throttler/          # Rate limiting
├── users/              # User profiles, KYC, exports
├── app.controller.ts   # Root controller
├── app.module.ts       # Root module
├── app.service.ts      # Root service
└── main.ts             # Application bootstrap & Swagger

Deployment

For production deployment:

# Build the application
npm run build

# Run with Node.js
node dist/main

# Or use a process manager
pm2 start dist/main.js --name orbitchain-api

Resources


License

UNLICENSED — Proprietary. All rights reserved.

About

NestJS API for decentralized fundraising and campaign management on the Stellar blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 99.5%
  • JavaScript 0.5%