Skip to content
 
 

Repository files navigation

🕌 Deen Bridge — Backend API

The REST API powering Deen Bridge: authentication, courses, library, community, and USDC payments on Stellar.

CI License: MIT PRs Welcome Stellar

Live API · Web App · Report a Bug · Contribute


About

This is the API service for Deen Bridge, a platform for authentic Islamic education. It handles users and roles, courses, the digital book library, community spaces, reels, notifications, and — at its core — non-custodial USDC payments on the Stellar network: the API builds an unsigned payment transaction, the buyer signs it in their own wallet, and the API verifies the payment on-chain before granting access. Creators receive USDC directly to their wallets.

The platform is composed of three services:

Repository Role Live
dnb-frontend Next.js web application dnb-frontend.vercel.app
dnb-backend (this repo) REST API — auth, content, Stellar payments dnb-backend-api.onrender.com
dnb-ai FastAPI service for the AI assistant dnb-ai.onrender.com

✨ Features

  • 🔐 JWT Authentication — access + refresh tokens, role-based access (student / mentor / admin)
  • 🎓 Course Management — create, enroll, review, and track courses
  • 📚 Digital Library — upload, purchase, and read Islamic books
  • Stellar Payments — USDC payment initialize → sign → submit → on-chain verify flow
  • 👛 Wallet Management — connect Freighter, xBull, or Albedo; balance and trustline checks
  • 💬 Real-time — Socket.io messaging and notifications
  • ☁️ Media — Cloudinary uploads for avatars, covers, books, and reels
  • 🛡️ Hardened — helmet, rate limiting, sanitization (mongo-sanitize, hpp, xss), CORS

🛠️ Tech Stack

Layer Technology
Runtime Node.js 20 · Express 5 (ESM)
Database MongoDB · Mongoose 8 · Redis (caching)
Blockchain @stellar/stellar-sdk v16 · Horizon
Auth JWT (access + refresh)
Media & Realtime Cloudinary · Multer · Socket.io
Observability Winston logging

🚀 Getting Started

Prerequisites

  • Node.js 20+
  • MongoDB (local or Atlas)
  • Redis (optional, for caching)

Setup

git clone https://github.com/Deen-Bridge/dnb-backend.git
cd dnb-backend
npm install
cp .env.example .env   # then fill in your values
npm run dev

The API runs at http://localhost:5000.

Key Environment Variables

Variable Description
PORT Server port (default 5000)
MONGO_URI MongoDB connection string
JWT_SECRET Secret for signing tokens (32+ chars)
STELLAR_NETWORK testnet or mainnet
CLOUDINARY_* Cloudinary credentials for media uploads

See .env.example for the full list.

Scripts

Command Purpose
npm run dev Start with hot reload
npm start Start in production mode
npm test Run the Jest + Supertest suite
npm run seed Seed sample data

🔗 API Overview

Area Base Route
Auth & Users /api/auth, /api/users
Courses & Books /api/courses, /api/books
Spaces & Reels /api/spaces, /api/reels
Stellar Wallet /api/stellar/wallet/*
Stellar Payments /api/stellar/payment/*

🌊 Contributing & Drips Wave

This repository participates in the Stellar Drips Wave bounty program — contributors earn Points (and real rewards) for resolving this repo's issues during a Wave, with complexity tiers set in the Drips Wave app.

  • All pull requests target the dev branch (main is releases only)
  • CI (tests) must pass before review
  • One contributor per issue — comment to claim it first

Read CONTRIBUTING.md for the full workflow, coding standards, and Wave rules.

📜 License

MIT © Deen Bridge

🔗 Links

Releases

Packages

Contributors

Languages