The backend API powering Deen Bridge - a modern platform empowering Muslims with authentic Islamic education through courses, books, spaces, and mentorship.
- User Authentication: Secure JWT-based authentication with refresh tokens
- Course Management: Create, manage, and enroll in Islamic courses
- Digital Library: Upload, purchase, and read Islamic books
- Stellar Blockchain Integration: USDC payments on Stellar network for courses and books
- Wallet Management: Connect Stellar wallets (Freighter, xBull, Albedo) for creator payments
- Review System: Rate and review courses and books
- User Profiles: Customizable profiles with avatar uploads
- Role-based Access: Student, mentor, and admin roles
| Technology | Description |
|---|---|
| Node.js | JavaScript runtime |
| Express.js | Web framework |
| MongoDB | Database |
| Mongoose | ODM for MongoDB |
| JWT | Authentication tokens |
| Stellar SDK | Blockchain integration |
| Multer | File uploads |
| Winston | Logging |
- Node.js 18+
- MongoDB (local or Atlas)
- npm or yarn
# Clone the repository
git clone git@github.com:Deen-Bridge/dnb-backend.git
cd dnb-backend
# Install dependencies
npm installCreate a .env file with the following variables:
# Server
PORT=5000
NODE_ENV=development
# Database
MONGO_URI=mongodb://localhost:27017/deenbridge
# Authentication
JWT_SECRET=your-super-secret-key-minimum-32-characters
JWT_EXPIRES_IN=7d
REFRESH_TOKEN_SECRET=your-refresh-token-secret
# Stellar (for payments)
STELLAR_NETWORK=testnet# Development mode
npm run dev
# Production mode
npm startYou should see:
Environment variables validated successfully
MongoDB connected successfully
DeenBridge API running on port 5000
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/refresh- Refresh access tokenPOST /api/auth/logout- Logout user
GET /api/courses- List all coursesGET /api/courses/:id- Get course detailsPOST /api/courses- Create course (mentor/admin)PUT /api/courses/:id- Update courseDELETE /api/courses/:id- Delete course
GET /api/library- List all booksGET /api/library/:id- Get book detailsPOST /api/library- Upload book (mentor/admin)PUT /api/library/:id- Update bookDELETE /api/library/:id- Delete book
POST /api/stellar/wallet/connect- Connect Stellar walletDELETE /api/stellar/wallet/disconnect- Disconnect walletGET /api/stellar/wallet/me- Get connected wallet infoGET /api/stellar/wallet/balance/:publicKey- Check wallet balance
POST /api/stellar/payment/initialize- Initialize payment transactionPOST /api/stellar/payment/submit- Submit signed transactionGET /api/stellar/payment/transactions- Get transaction history
GET /api/users/me- Get current userPUT /api/users/me- Update profileGET /api/users/:id- Get user profile
Deen Bridge uses the Stellar blockchain for creator payments:
- Currency: USDC on Stellar
- Networks: Testnet (development), Mainnet (production)
- Wallets Supported: Freighter, xBull, Albedo
- Flow: Buyer signs transaction in wallet -> Backend verifies on-chain -> Access granted
- Connect your Stellar wallet in account settings
- Receive USDC directly when users purchase your content
- View transaction history in your dashboard
- Connect your Stellar wallet
- Ensure you have USDC and a USDC trustline
- Purchase courses/books with one-click payments
# Run tests
npm test
# Health check
curl http://localhost:5000/pingdnb-backend/
├── src/
│ ├── controllers/ # Route handlers
│ ├── middleware/ # Auth, validation, etc.
│ ├── models/ # Mongoose schemas
│ ├── routes/ # API routes
│ └── services/ # Business logic
├── services/ # External services (Stellar)
├── logs/ # Application logs
├── app.js # Express app setup
└── server.js # Server entry point
We welcome contributions! Please see our Contributing Guidelines for details.
This repository participates in the Stellar Drips Wave bounty program. Look for issues labeled with point values:
wave:1- Small tasks (1 point)wave:2- Medium tasks (2 points)wave:3- Large tasks (3 points)wave:4- Complex tasks (4 points)
This project is licensed under the MIT License - see the LICENSE file for details.