• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
Rashid1473

Rashid1473

rashid

Public
Like
rashid
Home
Code
4
backend
3
frontend
3
shared
1
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
Code
/
Search
index.ts
https://Rashid1473--f04920443a3f11f0abcd9e149126039e.web.val.run
README.md

ONU Fiber Router Authorization System

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.

Features

  • 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

Project Structure

β”œβ”€β”€ 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

Environment Variables

Set these in your Val Town environment:

  • BILLING_API_URL: URL of the external billing system
  • BILLING_API_KEY: API key for billing system authentication

API Endpoints

  • POST /api/devices - Register new device
  • GET /api/devices - List all devices
  • PUT /api/devices/:id - Update device
  • DELETE /api/devices/:id - Delete device

IP Assignment Rules

  • 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
HTTP
  • index.ts
    Rashid1473--f0…9e.web.val.run
Code
backendfrontendsharedREADME.md
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.