A full-stack MERN platform for professional audio engineers and music producers β featuring a beat marketplace, studio booking system, and a secure admin dashboard.
| Service | URL |
|---|---|
| Frontend (Client) | https://rexlab.vercel.app |
| Backend (API) | https://rexlab.onrender.com/api |
- π΅ Beat Marketplace β Browse, preview, and purchase beats with cover art, BPM, genre, mood tags, and streaming previews. Beat ownership is tracked with a sold status flag.
- π³ Razorpay Payment Integration β Secure order creation and server-side HMAC-SHA256 signature verification via the Razorpay API, with full order records persisted in MongoDB.
- π Studio Session Booking β Interactive calendar-driven booking flow supporting session types: Full Recording, Vocals, Audio/Instrumental, Mixing & Mastering, and Custom, with payment status tracking (pending β advance_paid β full_paid).
- π JWT + Role-Based Auth β Stateless authentication using JSON Web Tokens. A two-tier role system (
admin/client) enforces route-level access control viaprotectandadminmiddleware. - βοΈ Secure Admin Dashboard β A protected
/adminarea for managing beats (CRUD), viewing and updating studio session statuses, and handling customer enquiries with read/replied status tracking. - βοΈ Supabase File Storage β High-resolution WAV/ZIP beat files and audio previews are stored on Supabase Storage, keeping the main database lean and performant.
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 14.1.0 |
App Router, SSR/SSG framework |
| React | ^18 |
UI component library |
| Tailwind CSS | ^3.3.0 |
Utility-first styling |
| Framer Motion | ^12.33.0 |
Animations and transitions |
| Axios | ^1.13.5 |
HTTP client for API calls |
@supabase/supabase-js |
^2.99.1 |
Supabase Storage client |
react-calendar |
^6.0.0 |
Booking calendar UI |
next-themes |
^0.4.6 |
Dark/light mode toggling |
react-hot-toast |
^2.6.0 |
Toast notifications |
react-icons |
^5.5.0 |
Icon library |
date-fns |
^4.1.0 |
Date formatting utilities |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | >=18 |
Runtime environment |
| Express | ^4.18.2 |
REST API framework |
| Mongoose | ^8.0.3 |
MongoDB ODM |
jsonwebtoken |
^9.0.3 |
JWT generation and verification |
bcryptjs |
^2.4.3 |
Password hashing (salt rounds: 10) |
| Razorpay | ^2.9.6 |
Payment gateway SDK |
| Stripe | ^14.10.0 |
Payment gateway SDK (secondary) |
@supabase/supabase-js |
^2.99.1 |
Supabase Storage admin client |
| Cloudinary | ^1.41.2 |
Alternative media storage |
| Nodemailer | ^6.9.7 |
Email notifications |
| Multer | ^1.4.5-lts.1 |
Multipart file upload handling |
express-async-handler |
^1.2.0 |
Async error propagation |
| Nodemon | ^3.1.11 |
Dev server auto-restart |
| dotenv | ^16.3.1 |
Environment variable management |
| Service | Role |
|---|---|
| MongoDB Atlas | Cloud-hosted database |
| Supabase Storage | Beat audio file hosting |
| Vercel | Next.js frontend deployment |
| Render | Express backend deployment |
rex-labs/
βββ client/ # Next.js 14 frontend (App Router)
β βββ src/
β β βββ app/ # App Router pages
β β β βββ page.js # Homepage (Hero, Showcase, Studio Gallery)
β β β βββ beats/ # Beat store listing page
β β β βββ book/ # Session booking page
β β β βββ about/ # About page
β β β βββ contact/ # Contact / enquiry form
β β β βββ enquiry/ # Enquiry submission page
β β β βββ location/ # Studio location page
β β β βββ admin/
β β β β βββ login/ # Admin login page
β β β β βββ dashboard/ # Admin dashboard (beats, sessions, enquiries)
β β β βββ privacy-policy/
β β β βββ refund-policy/
β β β βββ shipping-policy/
β β β βββ terms/
β β βββ components/ # Reusable UI components (Hero, NavBar, etc.)
β β βββ context/ # React context providers
β β βββ providers.js # ThemeProvider & global wrappers
β β βββ utils/ # Utility helpers (API clients, formatters)
β βββ public/ # Static assets (studio images, DAW logos)
β βββ next.config.mjs
β βββ tailwind.config.js
β βββ vercel.json # Vercel deployment config
β
βββ server/ # Express.js REST API
β βββ controllers/ # Route handler logic
β β βββ authController.js # Register / Login
β β βββ beatController.js # Beat CRUD
β β βββ sessionController.js # Session booking CRUD
β β βββ enquiryController.js # Enquiry management
β β βββ paymentController.js # Razorpay order & verification
β βββ middleware/
β β βββ authMiddleware.js # JWT protect + admin role guard
β β βββ errorMiddleware.js # Centralised error handler
β βββ models/ # Mongoose schemas
β β βββ User.js
β β βββ Beat.js
β β βββ Session.js
β β βββ Order.js
β β βββ Enquiry.js
β βββ routes/ # Express routers
β β βββ authRoutes.js
β β βββ beatRoutes.js
β β βββ sessionRoutes.js
β β βββ enquiryRoutes.js
β β βββ paymentRoutes.js
β βββ seeder.js # DB seed script (admin user + sample beats)
β βββ server.js # Entry point, DB connection, middleware setup
β βββ render.yaml # Render.com deployment config
β
βββ dev-start.bat # Windows dev launcher (runs both servers)
βββ package.json # Root: concurrently runs client + server
βββ README.md
Rex Labs follows a monorepo, decoupled full-stack architecture. The frontend and backend are developed and deployed independently but communicate over a JSON REST API.
βββββββββββββββββββββββββββββββββββββββββββββββ
β Browser β
β Next.js 14 App Router β
β (Vercel β https://rexlab.vercel.app) β
βββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β HTTPS / Axios (JSON)
β CORS whitelist: localhost:3000,
β *.vercel.app
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββ
β Express REST API (Node.js) β
β (Render β https://rexlab.onrender.com) β
β β
β ββββββββββββ ββββββββββ ββββββββββββββ β
β β Auth β β Beats β β Sessions β β
β β /api/ β β /api/ β β /api/ β β
β β users β β beats β β sessions β β
β ββββββββββββ ββββββββββ ββββββββββββββ β
β ββββββββββββ ββββββββββββββββββββββββββββ β
β βEnquiries β β Payment β β
β β/api/ β β /api/payment/order β β
β βenquiries β β /api/payment/verify β β
β ββββββββββββ ββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β MongoDB Atlasβ β Supabase β
β (documents) β β Storage β
β β β (audio/WAV) β
ββββββββββββββββ ββββββββββββββββ
Payment Flow:
- Client calls
POST /api/payment/orderβ server creates a Razorpay order (amount in paise, currency INR) and saves apendingOrder record to MongoDB. - Client renders the Razorpay checkout modal using the returned
orderIdandkey. - On payment success, client calls
POST /api/payment/verifywithrazorpay_order_id,razorpay_payment_id, andrazorpay_signature. - Server recomputes the expected HMAC-SHA256 signature. If it matches, the Order is updated to
paidstatus.
| Field | Type | Constraints |
|---|---|---|
username |
String | Required, Unique |
email |
String | Required, Unique, Lowercase |
password |
String | Required, bcrypt hashed (salt: 10) |
role |
String | Enum: admin, client (default: client) |
createdAt |
Date | Default: Date.now |
| Field | Type | Notes |
|---|---|---|
title |
String | Required |
audioUrl |
String | Required β preview MP3 (Supabase) |
highResUrl |
String | Optional β WAV/ZIP download link (Supabase) |
coverArtUrl |
String | Optional cover image |
price |
Number | Required (INR) |
genre |
String | Required |
mood |
String | Optional |
bpm |
Number | Optional |
duration |
String | e.g., "3:45" |
isSold |
Boolean | Default: false |
plays |
Number | Default: 0 |
downloads |
Number | Default: 0 |
| Field | Type | Notes |
|---|---|---|
clientName |
String | Required |
clientEmail |
String | Required, Lowercase |
clientPhone |
String | Required |
date |
Date | Required |
timeSlot |
String | e.g., "14:00 - 18:00" |
sessionType |
String | Enum: Full Recording, Audio / Instrumental, Vocals Recording, Mixing & Mastering, Custom |
notes |
String | Optional |
status |
String | Enum: pending, booked, completed, cancelled |
paymentStatus |
String | Enum: pending, advance_paid, full_paid |
| Field | Type | Notes |
|---|---|---|
user |
ObjectId (ref: User) | Optional (guest checkout supported) |
items[] |
Array | `{ name, price, itemType: Beat |
totalAmount |
Number | Required |
razorpayOrderId |
String | Required, Unique |
razorpayPaymentId |
String | Populated post-verification |
razorpaySignature |
String | Populated post-verification |
status |
String | Enum: pending, paid, failed |
| Field | Type | Notes |
|---|---|---|
name |
String | Required |
email |
String | Required, Lowercase |
message |
String | Required |
status |
String | Enum: new, read, replied |
| Mechanism | Implementation |
|---|---|
| Password Hashing | bcryptjs with salt rounds of 10 via a Mongoose pre-save hook |
| JWT Auth | jsonwebtoken β Bearer tokens validated in authMiddleware.js |
| Role Guard | admin middleware checks req.user.role === 'admin' before allowing write operations |
| Payment Verification | HMAC-SHA256 signature recomputed server-side using RAZORPAY_KEY_SECRET; signatures are compared before marking an order as paid |
| CORS Policy | Whitelist restricts origins to localhost:3000, rexlab.vercel.app, rexlabs.vercel.app, and all *.vercel.app preview URLs |
| Error Handling | Centralised notFound + errorHandler middleware prevents stack trace leakage to clients |
- Node.js v18 or higher
- MongoDB Atlas account with a cluster URI
- Razorpay account (test mode key pair)
- Supabase project with Storage configured
git clone https://github.com/Artyologist/rexlab.git
cd rexlab
# Install all dependencies (root + client + server)
npm run install-allserver/.env
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/rexlabs
JWT_SECRET=your_super_secret_jwt_key
# Razorpay (Test Mode)
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxx
RAZORPAY_KEY_SECRET=your_razorpay_secret
# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your_supabase_service_role_keyclient/.env.local
NEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_keyCreates an admin user (admin@rexlabs.com / password123) and sample beats:
cd server
npm run data:importTo wipe the seed data:
npm run data:destroyOption A β Windows (Recommended):
.\dev-start.batOption B β Concurrent (from root):
npm startOption C β Separate terminals:
# Terminal 1
cd server && npm run dev # http://localhost:5000
# Terminal 2
cd client && npm run dev # http://localhost:3000| URL | Credentials |
|---|---|
http://localhost:3000/admin/login |
admin@rexlabs.com / password123 |
| Metric | Value |
|---|---|
| API Endpoints | 15 (Auth: 2, Beats: 5, Sessions: 5, Enquiries: 4, Payment: 2 β see routes) |
| Mongoose Models | 5 (User, Beat, Session, Order, Enquiry) |
| Frontend Pages | 12 (Home, Beats, Book, About, Contact, Enquiry, Location, Admin Login, Admin Dashboard, Privacy, Refund, Terms) |
| Frontend Deployment | Vercel (Next.js managed) |
| Backend Deployment | Render.com (Node web service, port 10000) |
| Database | MongoDB Atlas (cloud) |
| File Storage | Supabase Storage |
| UI Framework | Next.js 14 App Router |
| Auth Strategy | Stateless JWT (Bearer token) |
This project is licensed under the MIT License. See the LICENSE file for details.
Built with π΅ by Rex Labs