Loading repository data…
Loading repository data…
Kavish0001 / repository
Veltrix is a full-stack subscription management platform for recurring billing businesses. It combines an admin backoffice, a customer-facing portal, subscription lifecycle workflows, invoicing, taxes, discounts, Razorpay payment integration, transactional emails, and reporting — all in a single scalable TypeScript monorepo.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Veltrix is a full-stack subscription management platform for recurring billing businesses. It combines an admin backoffice, a customer-facing portal, subscription lifecycle workflows, invoicing, taxes, discounts, Razorpay payment integration, transactional emails, and reporting — all in a single scalable TypeScript monorepo.
Built for the Subscription Management System hackathon problem statement, structured like a production-grade modular monolith.
admin, internal_user, portal_userdraft → quotation_sent → confirmed → active → paused → closed / cancelleddraft → confirmed → paid / cancelled| Layer | Technology |
|---|---|
| Language | TypeScript (strict) |
| Package Manager | pnpm workspaces |
| API | Express 5, Zod, Prisma ORM |
| Frontend | Vite, React 19, React Router 7, Tailwind CSS 4, TanStack Query |
| Auth | JWT (access + refresh), Argon2 password hashing |
| Database | PostgreSQL 16 |
| Cache / Queue | Redis 7, BullMQ |
| Payments | Razorpay (order creation + HMAC signature verification) |
| Nodemailer (SMTP / MailHog for local dev) | |
| Client-side PDF generation for invoices and orders | |
| Testing | Vitest |
| Linting | ESLint, Prettier, Husky, lint-staged |
| CI/CD | GitHub Actions |
| Infra (local) | Docker Compose (Postgres, Redis, MailHog) |
flowchart LR
User[Portal User] --> Web[apps/web - Vite React + Tailwind]
Staff[Admin / Internal User] --> Web
Web --> API[apps/api - Express REST API]
API --> DB[(PostgreSQL)]
API --> Redis[(Redis)]
API --> Razorpay[Razorpay API]
API --> SMTP[SMTP / MailHog]
API --> Shared[packages/shared]
Worker[apps/worker - BullMQ Worker] --> Redis
Worker --> API
API --> Prisma[Prisma ORM]
Prisma --> DB
flowchart TD
A[Admin seeds system] --> B[Create products & plans]
B --> C[Create taxes, discounts & quotation templates]
F[Portal user signup] --> G[OTP email verification]
G --> H[Browse product catalog]
H --> I[Select product + recurring plan]
I --> J[Add to cart]
J --> K[Checkout: address]
K --> L[Checkout: Razorpay payment]
L --> M{Payment verified?}
M -->|Yes| N[Subscription created & active]
M -->|No| O[Payment failed screen]
N --> P[Invoice auto-generated & marked paid]
Q[Backoffice creates subscription] --> R[Draft subscription]
R --> S{Next action}
S -->|Send quotation| T[Quotation sent to portal user]
S -->|Direct confirm| U[Confirmed]
T --> U
U --> V[Invoice generated]
V --> W[Razorpay payment or manual mark paid]
W --> N
N --> X[Renew or upsell subscription]
erDiagram
USERS ||--o{ CONTACTS : owns
CONTACTS ||--o{ ADDRESSES : has
PRODUCT_CATEGORIES ||--o{ PRODUCTS : groups
PRODUCTS ||--o{ PRODUCT_VARIANTS : has
PRODUCT_ATTRIBUTES ||--o{ PRODUCT_ATTRIBUTE_VALUES : has
PRODUCTS ||--o{ PRODUCT_PLAN_PRICING : priced_with
RECURRING_PLANS ||--o{ PRODUCT_PLAN_PRICING : applies_to
QUOTATION_TEMPLATES ||--o{ QUOTATION_TEMPLATE_LINES : contains
CONTACTS ||--o{ SUBSCRIPTION_ORDERS : places
USERS ||--o{ SUBSCRIPTION_ORDERS : manages
SUBSCRIPTION_ORDERS ||--o{ SUBSCRIPTION_ORDER_LINES : has
SUBSCRIPTION_ORDERS ||--o{ INVOICES : generates
INVOICES ||--o{ INVOICE_LINES : has
INVOICES ||--o{ PAYMENTS : settled_by
.
|- apps/
| |- api/ Express API, Prisma schema, business modules, tests
| | |- prisma/ Schema, migrations, seed
| | |- src/
| | |- config/ Environment config (Zod-validated)
| | |- lib/ Prisma client, error classes, logger, mailer, Razorpay helpers
| | |- middleware/ Auth guard, error handler
| | |- modules/
| | |- auth/ Login, signup, OTP, refresh, password reset
| | |- users/ User CRUD, role management
| | |- contacts/ Contact and address management
| | |- catalog/ Products, categories, attributes, variants, plans, discounts
| | |- billing/ Invoices, payments, Razorpay order + verify, checkout
| | |- subscriptions/ Subscription lifecycle, pricing engine, renewal/upsell
| | |- taxes/ Tax rule CRUD
| | |- configuration/ Payment terms, quotation templates
| | |- reports/ Dashboard KPIs and analytics
| | |- routes/ Root API router
| |- web/ Vite React frontend, admin + portal routes, Tailwind UI
| | |- src/
| | |- app/ Router setup, query/session providers
| | |- components/ Shared layout, icons
| | |- features/
| | |- admin/ Dashboard, products, users, subscriptions, contacts, reports, config
| | |- auth/ Login, signup, OTP verify, password reset
| | |- portal/ Home, shop, cart, checkout, account, PDF generation
| | |- lib/ API client, session state, cart state, Razorpay loader, PDF utils
| |- worker/ BullMQ worker, background job execution
|- packages/
| |- shared/ Shared enums, Zod schemas, DTOs, cross-app contracts
|- infra/
| |- docker/ Local Postgres + Redis + MailHog stack
|- docs/
| |- architecture.md
|- .github/
| |- workflows/ CI/CD pipelines (ci.yml, cd.yml)
API is mounted under /api/v1:
| Route | Description |
|---|---|
GET /health | Health check with uptime and timestamp |
/auth | Login, signup, OTP verify, refresh, logout, password reset |
/users | User CRUD, role management, activate/deactivate |
/contacts | Contact + address management |
/categories | Product category CRUD |
/products | Product CRUD with variants, attributes, plan pricing |
/attributes | Product attribute definitions |
/recurring-plans | Recurring plan CRUD |
/quotation-templates | Quotation template CRUD with line items |
/payment-terms | Payment term configuration |
/discounts | Discount rule CRUD |
/taxes | Tax rule CRUD |
/subscriptions | Full subscription lifecycle endpoints |
/invoices | Invoice management and state transitions |
/payments/razorpay/create-order | Create Razorpay order for an invoice |
/payments/razorpay/verify | Verify Razorpay payment signature and mark invoice paid |
/payments/mock | Mock payment (for testing without real Razorpay credentials) |
/checkout/complete | Portal checkout completion endpoint |
/reports/dashboard | Dashboard KPI and analytics data |
| Route | Description |
|---|---|
/ | Home / landing page |
/shop | Product catalog with filtering |
/products/:slug | Product detail with plan selection |
/cart | Shopping cart |
/checkout/address | Address selection (authenticated) |
/checkout/payment | Razorpay payment flow (authenticated) |
/checkout/success | Post-payment confirmation (authenticated) |
/preview/subscriptions/:id | Quotation preview for portal users |
/account/profile | User profile and address management |
/account/orders | Order/subscription history |
/account/orders/:id | Order detail with PDF export |
/account/invoices/:id | Invoice detail with PDF export |
| Route | Description |
|---|---|
/login | Login page |
/signup | Signup page |
/verify-otp | OTP email verification after signup |
/reset-password | Password reset (via emailed link) |
| Route | Description |
|---|---|
/admin | Dashboard with KPIs |
/admin/subscriptions | Subscription list with status filters |
/admin/subscriptions/new | Create subscription form |
/admin/products | Product list |
/admin/products/new | Create product |
/admin/products/:id | View product |
/admin/products/:id/edit | Edit product |
/admin/recurring-plans | Recurring plans management |
/admin/attributes | Product attributes management |
/admin/quotation-templates | Quotation templates management |
/admin/payment-terms | Payment terms configuration |
/admin/taxes | Tax rules management |
/admin/discounts | Discount rules management |
/admin/reports | Analytics and reporting |
/admin/users | All users + contacts |
/admin/users/:id | User detail and contact info |
/admin/contacts/:id | Contact detail |
Veltrix uses Razorpay as the payment gateway for both portal checkout and admin-triggered invoice payments.
Order Creation: When the user proceeds to pay, the frontend calls POST /payments/razorpay/create-order with the invoice ID. The API creates a Razorpay order via the Razorpay REST API using the configured key/secret and returns { orderId, amount, currency, keyId }.
Frontend Checkout: The web app dynamically loads the Razorpay Checkout.js SDK and opens the payment modal pre-filled with customer details, amount, and merchant branding.
Signature Verification: On payment success, Razorpay returns { razorpay_payment_id, razorpay_order_id, razorpay_signature }. The frontend sends these to POST /payments/razorpay/verify. The API verifies the HMAC-SHA256 signature using crypto.timingSafeEqual to prevent timing attacks.
Invoice Settlement: On successful verification, the invoice is marked paid, the payment record is created, and the associated subscription is set to active.
Set these in apps/api/.env:
RAZORPAY_KEY_ID=rzp_test_your_key_id
RAZORPAY_KEY_SECRET=your_razorpay_secret
Use
rzp_test_*keys for development. Get your keys from the Razorpay Dashboard.
For loca