feat: add Docker deployment, UAT test suites, and fix signup middleware bug

- Add Dockerfile, docker-entrypoint.sh, and .dockerignore for containerized deployment
- Fix middleware to exclude /api/tenants/signup from auth (P0 signup bug)
- Add Playwright E2E tests (16 browser tests) and curl-based API test script (80 tests)
- Add playwright config and dev dependency
- Update .gitignore with proper exclusions
- Add v1 milestone audit report and ISP system PRD

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kevin-asprec
2026-03-06 08:20:54 +08:00
parent d47d108a88
commit dcffed4a0d
12 changed files with 1849 additions and 2 deletions

64
isp_system_prd.md Normal file
View File

@@ -0,0 +1,64 @@
# NetForge - Product Requirements Document (PRD)
## 1. System Overview
A multi-tenant Software-as-a-Service (SaaS) web application designed for Internet Service Providers (ISPs). The platform, NetForge, allows independent ISP owners to register, manage their network, and handle billing. The primary goal is to provide ISP owners with full visibility into cash flow and client statuses, while giving their managers and technicians the tools to automate revenue collection, provisioning, and support.
## 2. Target Users & Roles
* **Owner:** Requires a high-level executive dashboard for financials, cash flow, and overall business health.
* **Manager:** Requires tools for client management, billing processing, payment logging, and technician dispatching.
* **Technicians:** Requires a mobile-friendly view (and eventual mobile app) for field installations, repairs, and ad-hoc payment collection.
* **Clients (Self-Service via FB Messenger):** Can check account status, request billing info, and create support tickets using Facebook Messenger, powered by n8n.
## 3. Core Modules
### 3.1 Executive Dashboard (The "Command Center")
* **Live Financial Pulse:** View revenue collected vs. pending/overdue payments.
* **Cash Flow Summary:** Income vs. Operating Expenses to calculate true profit margins.
* **Network Pulse:** Global view of active clients, suspended clients, and new installations.
### 3.2 Client Management
* **Client Database:** Profiles with installation address, IP/MAC addresses, plan tier, and payment history.
* **Status Tracking:** Segregate by Active, Pending Installation, Suspended, or Cancelled.
* **Technician View:** Dispatch list for today's physical jobs/repairs.
### 3.3 Financials, Billing & SMS Automation
* **Billing Engine:** Auto-generate invoices on specific, recurring billing cycles.
* **Payment Collection:** Manual entry for cash/transfers logged by the manager or technicians.
* **SMS Automated Reminders:**
* *Pre-due reminder:* Sent X days before the due date.
* *Overdue alert:* Warning of service disconnection.
* *Payment Confirmation:* Receipt upon successful logged payment.
### 3.4 MikroTik Integration
* **Auto-Suspend & Auto-Activate:** Direct router commands triggered by the billing engine when a client becomes overdue or pays their balance.
* **Live Connection Status:** Query the router to see if a specific user is actively connected and pulling data.
* **Multi-Router Management:** Ability for each ISP to connect and manage multiple MikroTik routers across different zones.
### 3.5 API-First Architecture & n8n Integration
* **RESTful API:** Every action the web app can do (checking a balance, adding a user, creating a ticket) will be exposed as a secure API endpoint.
* **n8n / Facebook Messenger Support:**
* Connect n8n to the API to build conversational flows for clients.
* *Example Flow:* Client messages Facebook Page -> n8n captures message -> n8n queries the ISP API for the user's phone number/account -> Returns current balance.
* *Ticketing:* Clients can type "Help, my internet is down" -> n8n pushes a Ticket to the Manager's dashboard via the API.
### 3.6 SaaS & Multi-Tenancy (Platform Level)
* **Tenant Isolation:** A robust multi-tenant database structure (`tenant_id`) ensuring that each ISP's data (clients, financials, routers) is strictly isolated and secure.
* **Super-Admin Dashboard:** A master dashboard for *you* (the SaaS creator) to manage the ISP businesses subscribed to your platform.
* **SaaS Subscriptions:** Integration with Stripe/PayPal to charge ISPs a monthly fee (e.g., based on their active subscriber count or flat tier).
* **White-labeling (Future Phase):** Allowing ISPs to add their own logo and custom domain for their specific customer portals.
### 3.7 Inventory & Asset Management
* **Asset Tracking:** Track every piece of hardware (routers, antennas, ONTs, vehicles) from purchase to deployment.
* **Assignments:** Know exactly whether an item is "In Stock", "Deployed to Client", or "Assigned to Technician".
* **Capital Expense Tracking:** Log the purchase price of assets to calculate business valuation and depreciation.
### 3.8 Full Double-Entry Accounting
* **Chart of Accounts (COA):** A standardized list of all financial accounts (Assets, Liabilities, Equity, Revenue, Expenses).
* **Automated Journal Entries:** Every action (invoice generated, payment received, cash transferred) automatically creates balanced debit/credit journal entries.
* **Ledger & Financial Reports:** Generate real-time Balance Sheets, Income Statements (Profit & Loss), and Trial Balances.
* **Expense & Vendor Management:** Log bills from upstream bandwidth providers, rent, and payroll against the correct expense accounts.
## 4. Phase Rollout Strategy
* **Phase 1:** Core Web App (Owner Dashboard, Client Management, Billing, MikroTik connection).
* **Phase 2:** API Exposure & Automations (SMS, n8n Facebook Messenger chat flows).
* **Phase 3:** Native Mobile App (Technician handy work & field collections).