<<<<<<< HEAD
A full-stack React application for Music Rights Management (MRM) billing data entry with MongoDB backend storage.
- Client Management: Add, edit, and remove clients with customizable service fees
- Monthly Billing Entry: Enter royalty income from various sources (IPRS, PRS, Sound Exchange, ISAMRA, ASCAP, PPL)
- Auto-Calculations: Automatic calculation of commissions, GST, and total invoices
- Financial Year Support: Configurable financial year (April to March)
- Currency Conversion: GBP to INR conversion with customizable exchange rates
- Draft & Submit: Save entries as drafts or submit them
- Reports: View all billing entries with status tracking
- Frontend: React 18 with Hooks
- Backend: Node.js with Express
- Database: MongoDB with Mongoose ODM
- Styling: Custom CSS (dark theme)
mrm-billing-app/
├── client/ # React frontend
│ ├── public/
│ │ └── index.html
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── Header.jsx
│ │ │ ├── MonthTabs.jsx
│ │ │ ├── ClientPanel.jsx
│ │ │ ├── BillingForm.jsx
│ │ │ ├── Toast.jsx
│ │ │ ├── Modals.jsx
│ │ │ └── Legend.jsx
│ │ ├── contexts/ # React Context
│ │ │ └── AppContext.js
│ │ ├── hooks/ # Custom hooks
│ │ │ └── useBillingForm.js
│ │ ├── services/ # API services
│ │ │ └── api.js
│ │ ├── styles/ # CSS styles
│ │ │ └── App.css
│ │ ├── App.js
│ │ └── index.js
│ └── package.json
├── server/ # Node.js backend
│ ├── config/
│ │ └── db.js # MongoDB connection
│ ├── models/ # Mongoose models
│ │ ├── Client.js
│ │ ├── BillingEntry.js
│ │ └── Settings.js
│ ├── routes/ # Express routes
│ │ ├── clients.js
│ │ ├── billing.js
│ │ └── settings.js
│ ├── index.js # Server entry point
│ ├── .env.example
│ └── package.json
├── package.json # Root package.json
└── README.md
- Node.js (v16 or higher)
- MongoDB (local or Atlas)
- npm or yarn
# Navigate to project directory
cd mrm-billing-app
# Install all dependencies (root, client, and server)
npm run install:allOr install separately:
# Install root dependencies
npm install
# Install server dependencies
cd server && npm install
# Install client dependencies
cd ../client && npm installCreate a .env file in the server directory:
cp server/.env.example server/.envEdit server/.env with your MongoDB connection string:
# Local MongoDB
MONGODB_URI=mongodb://localhost:27017/mrm_billing
# OR MongoDB Atlas
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/mrm_billing?retryWrites=true&w=majority
PORT=5000
NODE_ENV=development# From the root directory, start both frontend and backend
npm run devThis will start:
- Backend server on
http://localhost:5000 - Frontend React app on
http://localhost:3000
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/clients |
Get all clients |
| GET | /api/clients/:id |
Get client by ID |
| POST | /api/clients |
Create new client |
| PUT | /api/clients/:id |
Update client |
| DELETE | /api/clients/:id |
Delete/deactivate client |
| POST | /api/clients/bulk |
Bulk import clients |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/billing |
Get all billing entries |
| GET | /api/billing/:clientId/:month |
Get specific entry |
| POST | /api/billing |
Create/update billing entry |
| PUT | /api/billing/:id |
Update entry |
| DELETE | /api/billing/:clientId/:month |
Delete entry |
| GET | /api/billing/reports/summary |
Get summary report |
| GET | /api/billing/reports/client/:clientId |
Get client report |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/settings |
Get all settings |
| GET | /api/settings/:key |
Get specific setting |
| PUT | /api/settings/:key |
Update setting |
| PUT | /api/settings/financial-year |
Update financial year |
| PUT | /api/settings/exchange-rate |
Update exchange rate |
{
clientId: String, // Unique identifier (e.g., "MRM001")
name: String, // Client name
type: String, // "Film Composer", "Lyricist", etc.
fee: Number, // Service fee (0.10 = 10%)
email: String,
phone: String,
isActive: Boolean,
createdAt: Date,
updatedAt: Date
}{
clientId: String,
clientName: String,
month: String, // "apr", "may", etc.
monthLabel: String, // "April 2025"
financialYear: {
startYear: Number,
endYear: Number
},
// Royalty amounts
iprsAmt: Number,
prsGbp: Number,
prsAmt: Number,
soundExAmt: Number,
isamraAmt: Number,
ascapAmt: Number,
pplAmt: Number,
// Commissions (calculated)
serviceFee: Number,
iprsComis: Number,
prsComis: Number,
// ... other commission fields
totalCommission: Number,
gst: Number,
totalInvoice: Number,
// Status
status: String, // "draft" or "submitted"
invoiceStatus: String,
invoiceDate: Date,
gbpToInrRate: Number
}{
key: String, // "financialYear", "gbpToInrRate", etc.
value: Mixed, // Setting value
description: String,
updatedAt: Date
}- Click "Add Client" button in the header
- Fill in the client details:
- Client ID (unique identifier)
- Client Name
- Client Type
- Service Fee percentage
- Click "Add Client"
- Select a client from the left panel
- Choose the month from the tabs
- Enter royalty amounts:
- IPRS Amount (₹)
- PRS Amount (£) - auto-converts to INR
- Sound Exchange, ISAMRA, ASCAP, PPL amounts
- Commissions are auto-calculated based on service fee
- Add remarks if needed
- Click "Save Draft" or "Submit Entry"
- Click "View Entries" to see all billing entries
- Entries show status (Draft/Submitted), commission, and invoice totals
- Click "Settings" button
- Update financial year or exchange rate
- Click "Save Settings"
# Start both frontend and backend with hot reload
npm run dev# Build the React frontend
npm run build
# Start production server
npm start| Variable | Description | Default |
|---|---|---|
MONGODB_URI |
MongoDB connection string | mongodb://localhost:27017/mrm_billing |
PORT |
Server port | 5000 |
NODE_ENV |
Environment | development |
REACT_APP_API_URL |
API URL (client) | /api |
- Ensure MongoDB is running locally or Atlas cluster is accessible
- Check the connection string in
.env - Verify network access settings in MongoDB Atlas
# Kill process on port 3000 or 5000
npx kill-port 3000
npx kill-port 5000The server includes CORS configuration. If issues persist, check the cors middleware in server/index.js.
ISC
a0c4ed66d4892eba4ac99a39cd8475161d166198
Email: admin@mrm.com Password: Admin@123