Event-Driven Logistics SaaS Platform
Real-time order tracking and automated customer notifications for e-commerce businesses.
My Order Fellow is a B2B SaaS backend that serves as the "Tracking Logic Layer" for e-commerce stores. Instead of building their own tracking systems, companies connect their store (Shopify, WooCommerce, Custom) to our API via Webhooks.
When an order is created or updated on the store's end, My Order Fellow automatically:
- Ingests the Event securely via signed webhooks.
- Processes the Data (Normalizes status, updates history).
- Notifies the Customer via beautiful, templated emails.
- Updates the Tracking Page instantly.
- 🔐 Secure Authentication: JWT-based auth with Refresh Tokens and Email OTP verification.
- 🏢 Company Onboarding & KYC: Companies must submit KYC documents. Only Admin-approved companies receive API keys (Webhook Secrets).
- 🪝 Event-Driven Webhooks: Secure webhook listener (HMAC-SHA256 signature verification) that accepts
order.createdandorder.updatedevents. - 📧 Automated Notification Engine: "Fire-and-forget" email system using EJS Templates (Transactional emails for OTPs, Tracking Updates).
- 🔍 Public Tracking API: Rate-limited public endpoint for end-customers to view their package journey without logging in.
- 🛡️ Role-Based Access Control (RBAC): Distinct roles for
COMPANYandADMIN(Separate Admin Portal).
- Language: TypeScript
- Runtime: Node.js (Express)
- Database: PostgreSQL
- ORM: Prisma
- Validation: Zod
- Email: Nodemailer + EJS (Gmail SMTP)
- Security: Helmet, CORS, Express-Rate-Limit, BCrypt
- Node.js (v18+)
- PostgreSQL (Local or Cloud)
git clone https://github.com/brainiacerudite/my_order_fellow.git
cd my_order_fellow
npm installCreate a .env file in the root directory. You can copy from the example file:
cp .env.example .envThen update the values in .env:
Run the migrations to create the tables:
npx prisma migrate dev --name init# Development Mode (Hot Reload)
npm run dev
# Build & Start Production
npm run build
npm startSince this is an event-driven system, you cannot easily test the "Order Reception" flow with just a browser. So a simulation script is provided to mimic an external e-commerce store sending data to the API.
- Register a Company and get your Webhook Secret from the dashboard.
- Open
scripts/simulate-webhook.ts. - Update the
COMPANY_IDandWEBHOOK_SECRETconstants. - Run the simulation:
npx ts-node scripts/simulate-webhook.tsYou should see a success message, and a real email should land in your inbox!
Run the comprehensive test suite (Unit + Integration).
npm test- Unit Tests:
npm run test:unit(Fast, logic-only) - Integration Tests:
npm run test:int(Full API flow with Test DB)
The API documentation for this project is available in two formats:
-
Postman Collection: You can import the Postman collection file directly into your Postman application to test and explore the API endpoints interactively.
-
Online Documentation: Access the complete API documentation through the Postman web viewer at the URL provided below. This includes detailed information about:
- Available endpoints
- Request parameters
- Response formats
- Authentication requirements
- Example requests and responses
Documentation URL: https://documenter.getpostman.com/view/39386408/2sBXc8nhfX
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/v1/auth/register |
Register new company | Public |
| POST | /api/v1/companies/kyc |
Submit KYC Docs | Bearer |
| GET | /api/v1/tracking/:id |
Public Order Tracking | Public (Rate Limited) |
| POST | /api/v1/webhooks/incoming |
Ingest Order Events | HMAC Signature |
| POST | /api/v1/admin/kyc/:id/approve |
Approve Company & Gen Key | Admin Bearer |
src/
├── config/ # Environment config & Constants
├── modules/ # Feature-based Modules (Controller, Service, Routes)
│ ├── auth/ # Login/Register/OTP
│ ├── company/ # Profile & KYC
│ ├── order/ # Order Logic
│ ├── webhook/ # Event Listener & Validation
│ ├── admin/ # Admin Approval Logic
│ └── notification/ # Email Service
├── shared/
│ ├── database/ # Prisma Client
│ ├── middlewares/ # Auth, Error, RateLimit, WebhookParser
│ ├── templates/ # EJS Email Templates
│ ├── types/ # TypeScript types
│ └── utils/ # Logger, Hashing, WebhookSignature
└── app.ts # App Entry Point
This project is licensed under the MIT License.