Public
Like
rashid
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
index.ts
https://Rashid1473--f04920443a3f11f0abcd9e149126039e.web.val.run
An automated system for authorizing new ONU (Optical Network Unit) fiber routers. The system validates device information, assigns IP addresses based on mainboard types, and integrates with billing systems.
- Device Registration: Collect MAC address, geo data, and mainboard information
- Automatic IP Assignment: Assign IP addresses based on mainboard type
- Billing Integration: Upload device data to external billing systems
- Validation: Verify MAC address format and geo coordinates
- Admin Dashboard: View and manage registered devices
βββ backend/
β βββ database/
β β βββ migrations.ts # Database schema
β β βββ queries.ts # Database operations
β βββ routes/
β β βββ devices.ts # Device management API
β β βββ static.ts # Static file serving
β βββ index.ts # Main Hono server
βββ frontend/
β βββ components/
β β βββ App.tsx # Main application
β β βββ DeviceForm.tsx # Device registration form
β β βββ DeviceList.tsx # Device management dashboard
β βββ index.html # Main HTML template
β βββ index.tsx # Frontend entry point
βββ shared/
βββ types.ts # Shared TypeScript types
Set these in your Val Town environment:
BILLING_API_URL
: URL of the external billing systemBILLING_API_KEY
: API key for billing system authentication
POST /api/devices
- Register new deviceGET /api/devices
- List all devicesPUT /api/devices/:id
- Update deviceDELETE /api/devices/:id
- Delete device
- Huawei: 192.168.1.x range
- ZTE: 192.168.2.x range
- Nokia: 192.168.3.x range
- Alcatel: 192.168.4.x range
- Default: 192.168.100.x range