Project Framework
1. Architecture
[Electron/React Frontend]
↓ (HTTPS REST API )
[[Link] + Express Backend]
↓
[MongoDB Atlas Cloud DB]
↓
[Future Integration: ERP Portal API]
↓
[Subscription/Payment Gateway (e.g.
Razorpay/Stripe)]
,
•Frontend: React (inside Electron for desktop app
packaging).
•Backend: [Link] + Express (REST API, JWT authentication,
role-based access).
•Database: MongoDB Atlas (cloud-hosted, scalable, schema-
flexible).
•ERP Portal: Future integration point (via REST API/SDK).
•Subscription Layer: Future integration with payment
services.
2. User Roles & Modules
User Module
• Register with email/password + company details.
• Login with credentials (JWT-based auth).
• Profile Management (edit/update company details).
• Subscription (future: choose plan, pay, activate
features)
Admin Module
•Secure login (unique credentials, possibly 2FA).
•Dashboard to view all registered users & company
profiles.
•Approve/reject user accounts.
•View subscription status of each company.
•Export reports (CSV).
•Manage ERP integration configs.
3. Database Design (MongoDB Collections)
users .
•.
{
"_id": ObjectId,
"name": "John Doe",
"email": "john@[Link]",
"passwordHash": "hashed_password",
"role": "user", // 'admin' or 'user'
"createdAt": ISODate,
"lastLogin": ISODate,
"subscriptionPlan": "free" // future: 'pro', 'enterprise'
}
Company Profiles
{
"_id": ObjectId,
"userId": ObjectId, // reference to users
"companyName": "ABC Pvt Ltd",
"gstin": "22AAAAA0000A1Z5",
"address": "Delhi, India",
"contactNumber": "+91-9876543210",
"complianceStatus": "pending",
"linkedToERP": false,
"createdAt": ISODate,
"updatedAt": ISODate
}
subscriptions (future)
{
"_id": ObjectId,
"userId": ObjectId,
"plan": "pro",
"status": "active",
"startDate": ISODate,
"endDate": ISODate,
"paymentId": "razorpay_txn_id"
}
4. API Endpoints ([Link]/Express)
Auth
•POST /api/auth/register → register new user + create
company profile.
•POST /api/auth/login → JWT token.
•GET /api/auth/me → get logged-in user details.
User (Role: user)
•GET /api/company/me → view own company profile.
•PUT /api/company/me → update company details.
Admin (Role: admin)
•GET /api/admin/companies → view all company profiles.
•GET /api/admin/companies/:id → view single company profile.
•PATCH /api/admin/companies/:id/status → update compliance status /
ERP link.
•GET /api/admin/users → list all users.
•PATCH /api/admin/users/:id/role → promote/demote roles.
Subscription (future)
POST /api/subscription/create- GET
checkout-session /api/subscription/status/:userId
5. Security
•Authentication: JWT with refresh tokens.
•Password Hashing: bcrypt.
•Admin Credentials: Pre-seeded in DB with
strong hashed password.
7. Subscription Framework
(future-proofing)
•Integrate Razorpay/Stripe for billing.
•Store plans in subscriptions collection.
•Middleware to check active subscription
before allowing premium features.
8. Deployment
•Frontend: Electron builder → .exe, .dmg
installers.
•Backend: Deploy on Render / Railway /
AWS / Heroku.
•Database: MongoDB Atlas (cloud).
•ERP API: Configurable in admin dashboard.
This framework is leaner fully [Link] + MongoDB.
It supports:
•Admin/User flows
•ERP linking (future)
•Subscription model (future)