B2B Restaurant Community Support Connect. Request. Fulfill. Together.
SupplyBridge is a real-time collaboration platform designed exclusively for restaurant owners and food service vendors. It enables instant Pings (urgent supply requests), secure Connections, and Live Chat to keep kitchens running smoothly.
Full API reference with request/response examples available on Postman.
- Core Features
- Tech Stack
- System Architecture
- Prerequisites
- Environment Variables
- Installation & Local Setup
- Database Setup (Prisma + MongoDB)
- Running the Application
- WebSocket Events (Real-time Chat)
- Background Jobs (BullMQ)
- Project Structure
- API Documentation
- Deployment
- Contributing
- License
| Module | Description |
|---|---|
| π Ping System | Geolocation-based urgent supply requests. Filter by radius, category, and urgency level (Emergency, Moderate, General). |
| π€ Connection Management | LinkedIn-style connection flow (Send Request β Accept/Reject β Trusted Network). |
| π¬ Real-time Chat | WebSocket powered P2P messaging with Redis caching. Supports text, images, and file sharing. |
| π₯ User Profiles | Dual-role support (Vendor/Restaurant). Multi-step registration with email OTP verification. |
| π Auth & Security | JWT authentication, Social Login (Google/Apple), Bcrypt password hashing, and Role-Based Access Control (RBAC). |
| π¬ Notifications | Multi-channel support: In-App DB notifications + Push Notifications (Firebase Cloud Messaging). |
| βοΈ Background Workers | Asynchronous processing for Emails, Image Uploads, and Bulk Notifications via BullMQ + Redis. |
| Category | Technology | Purpose |
|---|---|---|
| Runtime | Node.js (v18+) | JavaScript Runtime |
| Language | TypeScript | Static Typing |
| Framework | Express.js | REST API Layer |
| Realtime | WebSocket (ws) | Live Chat & Connection Events |
| Database | MongoDB | Primary Data Store |
| ORM | Prisma | Type-safe Database Queries |
| Cache | Redis | OTP Storage, Chat Cache, Queue Backend |
| Queue | BullMQ | Email & Notification Workers |
| Storage | AWS S3 / DigitalOcean Spaces | User Avatars & Chat Media |
| Push Notif | Firebase Admin SDK | Multi-device Push Notifications |
| Payments | Stripe | (Planned) Premium Features |
[Client App]
β
βββ REST (Express) βββββββ> Prisma ORM βββββββ> MongoDB
β β
β βββ BullMQ ββββββ> Redis ββββββ> Workers (Email, Image, Notify)
β
βββ WebSocket (ws) ββββββββ> Redis (Chat Cache)
Ensure you have the following installed on your system:
- Node.js
v18.xor later - npm or bun (project uses
bun.lockbalongsidepackage-lock.json) - MongoDB (Local or Atlas URI)
- Redis (Local or Cloud)
Create a .env file in the root directory. Copy the contents of .env.example (create one if missing) and fill in the values.
# ------------------------------
# Server
# ------------------------------
PORT=5000
NODE_ENV=development
# ------------------------------
# Database
# ------------------------------
DATABASE_URL="mongodb+srv://<user>:<pass>@cluster.mongodb.net/SupplyBridge"
# ------------------------------
# JWT & Security
# ------------------------------
JWT_SECRET="your-super-secret-jwt-key"
JWT_EXPIRES_IN="30d"
BCRYPT_SALT_ROUNDS=12
# ------------------------------
# Redis
# ------------------------------
REDIS_HOST="127.0.0.1"
REDIS_PORT=6379
REDIS_PASSWORD="optional_redis_password"
# ------------------------------
# Email (Nodemailer)
# ------------------------------
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"
# ------------------------------
# Firebase (Push Notifications)
# ------------------------------
FIREBASE_PROJECT_ID="supplybridge-xxxx"
FIREBASE_CLIENT_EMAIL="firebase-adminsdk@....iam.gserviceaccount.com"
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n..."
# ------------------------------
# Storage (AWS S3 / Spaces)
# ------------------------------
SPACES_ENDPOINT="nyc3.digitaloceanspaces.com"
SPACES_KEY="ACCESS_KEY"
SPACES_SECRET="SECRET_KEY"
SPACES_BUCKET="supplybridge-media"
# ------------------------------
# Stripe (Optional)
# ------------------------------
STRIPE_SECRET_KEY="sk_test_..."1. Clone the repository
git clone https://github.com/your-org/supplybridge-backend.git
cd supplybridge-backend2. Install dependencies
npm install
# or if you use bun
bun install3. Set up environment variables
cp .env.example .env
# Edit .env with your local credentials (Database URL, Redis, etc.)1. Generate Prisma Client
npx prisma generate2. Push Schema to Database
Note:
prisma db pushis recommended for development. For production, useprisma migrate deploy.
npx prisma db push3. (Optional) Seed the Database
# Create a seed script in prisma/seed.ts and run:
npx prisma db seedSupplyBridge uses Concurrently to run the main server and three background workers in a single terminal window.
Development Mode (Hot Reload):
npm run devThis starts:
- π’ API Server (
src/server.ts) - π΅ Email Worker (
src/jobs/workers/emailWorker.ts) - π‘ Notification Worker
- π£ Image Upload Worker
Production Build:
npm run build
npm run startThe WebSocket server runs on the same HTTP port as Express (/ws path or native upgrade).
| Event | Direction | Description |
|---|---|---|
subscribe-room |
Client β Server | Join a specific chat room. |
send-message |
Client β Server | Send text or file URL to a room. |
new-message |
Server β Client | Broadcasted message to all room members. |
typing |
Bidirectional | Typing indicator events. |
conversations |
Server β Client | Initial payload with recent chat list. |
Connection Header:
token: <JWT_ACCESS_TOKEN>(required)
We utilize Bull Board for monitoring queues in development.
- URL:
http://localhost:5000/admin/queues - Queues:
EmailQueueβ Account verification, password reset.NotificationQueueβ Sending push notifications to FCM.ImageQueueβ Processing and uploading profile/business images to cloud storage.
src/
βββ app/
β βββ middlewares/ # Auth, Validation, Error Handling
β βββ modules/ # Feature-based modules (User, Ping, Chat, Connection)
βββ config/ # App configuration & Service Accounts
βββ errors/ # Custom error classes & Handlers
βββ helpers/ # Reusable utilities (JWT, Bcrypt, FileUploader)
βββ jobs/ # BullMQ Queues, Workers, and BullBoard UI
βββ shared/ # Prisma Client, Redis Client, Logger, Pagination Helpers
βββ app.ts # Express App Initialization
βββ server.ts # Entry Point (Starts HTTP & WebSocket Server)Once the server is running locally, you can access the detailed API documentation via Postman or the .http files inside each module folder.
Postman Collection: Import the collection from
src/app/middlewares/postman.tsor use the generated OpenAPI spec.
Base URL
http://localhost:5000/api/v1
Core Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST |
/auth/login |
Email/Password Login |
POST |
/user/create |
Register Pending User (Sends OTP) |
GET |
/ping |
Get nearby active pings (Geo-filtered) |
POST |
/ping/create |
Create a new supply request |
GET |
/connection/my |
List my trusted vendors |
GET |
/chat/conversations |
Get recent chat history |
Recommended Stack
- Hosting: AWS EC2 / DigitalOcean Droplet / Railway
- Database: MongoDB Atlas
- Redis: Upstash / Redis Labs
- Process Manager: PM2
PM2 Deployment Script
An ecosystem.config.js is included in the root.
# Install PM2 globally
npm install pm2 -g
# Build the project
npm run build
# Start in production cluster mode
pm2 start ecosystem.config.js --env productionWe welcome contributions! Please follow the standard Git Flow.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Code Style: Ensure you run
npm run buildlocally to check for TypeScript errors before committing.
Distributed under the ISC License. See LICENSE for more information.
Built with β€οΈ for the restaurant community. Got questions? Reach out to the backend team lead.
| π Detail | π Value |
|---|---|
| π GitHub URL | https://github.com/shahjalal-labs/supply_bridge_backend |
| π Live Site | postman api document |
| π» Portfolio GitHub | https://github.com/shahjalal-labs/shahjalal-portfolio-v2 |
| π Portfolio Live | http://shahjalal-labs.surge.sh |
| π Created On | 09/04/2026 04:30 PM Thu GMT+6 |
| π Location | Sharifpur, Gazipur, Dhaka |
| πΌ LinkedIn | https://www.linkedin.com/in/shahjalal-labs/ |
| π Facebook | https://www.facebook.com/shahjalal.labs |
| https://x.com/shahjalal_labs | |
| π Visibility | Public π |

