A comprehensive web-based billing management system for cable network businesses with support for 200+ customers across multiple villages.
- Secure Admin Login - JWT-based authentication
- Customer Management - Add, edit, delete customers
- Monthly Billing System - Track payments month-wise with color-coded status
- Customer Details - View total due, last 6-month history, payment timeline
- Dashboard Analytics - Total customers, total due, collections, village-wise summary
- Payment Request Verification - Approve/reject customer payment requests
- Simple Login - Login using Name + Phone + Village (no password)
- View Due Amount - See total due and month-wise payment status
- Submit Payment - Submit bKash payment requests with transaction ID
- Payment History - View last 6 months payment history
- Frontend: Next.js 13, React, Tailwind CSS, Recharts
- Backend: Next.js API Routes
- Database: MongoDB (MongoDB Atlas)
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: bcryptjs
- Clone the repository
git clone <repository-url>
cd sohel-sweet-cable-network- Install dependencies
npm install- Set up environment variables
Create a
.env.localfile in the root directory (see.env.example):
MONGODB_URI=your_mongodb_atlas_connection_string
JWT_SECRET=your_secure_jwt_secret_key_minimum_32_characters
- Create the first admin user After starting the server, create an admin user by making a POST request:
curl -X POST http://localhost:3000/api/setup/create-admin-direct \
-H "Content-Type: application/json"Or use the direct route with specific credentials:
curl -X POST http://localhost:3000/api/setup/create-admin \
-H "Content-Type: application/json" \
-d '{"email":"admin@example.com","password":"admin123","name":"Admin"}'- Run the development server
npm run dev- Open http://localhost:3000 in your browser
See NETLIFY_DEPLOY.md for detailed deployment instructions.
Quick steps:
- Push code to GitHub/GitLab/Bitbucket
- Connect repository to Netlify
- Set environment variables in Netlify dashboard
- Deploy!
{
"_id": ObjectId,
"name": String,
"phone": String (optional),
"village": String,
"billAmount": Number (optional),
"createdAt": Date,
"updatedAt": Date
}{
"_id": ObjectId,
"customerId": ObjectId (ref: Customer),
"month": String (format: "2025-01"),
"status": "paid" | "unpaid",
"paidAt": Date,
"transactionId": String,
"verifiedByAdmin": Boolean,
"createdAt": Date,
"updatedAt": Date
}{
"_id": ObjectId,
"name": String,
"phone": String,
"village": String,
"customerId": ObjectId (ref: Customer, optional),
"transactionId": String,
"month": String (format: "2025-01"),
"amount": Number,
"screenshotURL": String (optional),
"verified": Boolean,
"verifiedBy": ObjectId (ref: Admin),
"verifiedAt": Date,
"createdAt": Date,
"updatedAt": Date
}{
"_id": ObjectId,
"email": String (unique),
"password": String (hashed),
"name": String,
"createdAt": Date,
"updatedAt": Date
}- Navigate to
/admin/login - Enter admin email and password
- Access dashboard, customers, and payment requests
- Navigate to
/user/login - Enter name, phone, and village
- View dashboard and submit payments
POST /api/auth/admin/login- Admin loginPOST /api/auth/user/login- User login
GET /api/customers- Get all customers (Admin only)POST /api/customers- Create customer (Admin only)GET /api/customers/[id]- Get customer details (Admin only)PUT /api/customers/[id]- Update customer (Admin only)DELETE /api/customers/[id]- Delete customer (Admin only)GET /api/customers/[id]/payments- Get customer paymentsGET /api/customers/[id]/analytics- Get customer analytics
PUT /api/payments- Update payment status (Admin only)
GET /api/payment-requests- Get payment requests (Admin only)POST /api/payment-requests- Submit payment request (Public)POST /api/payment-requests/[id]/verify- Verify payment request (Admin only)
GET /api/dashboard- Get admin dashboard dataGET /api/user/dashboard- Get user dashboard data
- IMPORTANT: Change
JWT_SECRETin production (use at least 32 random characters) - Disable
/api/setup/create-adminand/api/setup/create-admin-directroutes in production after creating admin - Use HTTPS in production (Netlify provides this automatically)
- Implement rate limiting for API routes
- Add input validation and sanitization
- Never commit
.env.localor.envfiles to Git - Use Netlify environment variables for production secrets
This project is open source and available under the MIT License.