DEV Community

Pritt Patrick
Pritt Patrick

Posted on

XRadius: Building a Modern ISP & Wi-Fi Hotspot Billing Platform with Go, MikroTik, M-Pesa and WebSockets

Running an ISP or public Wi-Fi hotspot in Kenya is more than putting up a router and connecting customers.

You need to manage customers, internet packages, payments, network access, routers, sessions, revenue, staff, and support — often across several systems.

That is the problem I wanted to solve with XRadius.

XRadius is an ISP and Wi-Fi hotspot billing platform designed for internet service providers and hotspot operators. The goal is simple:

Make it easier to sell internet, collect payments, manage networks, and give customers a seamless connection experience.

The problem

Imagine a customer arrives at a Wi-Fi hotspot and wants:

10 Mbps — 1 hour — KES 20

The traditional workflow might look something like this:

  1. Customer selects a package.
  2. They enter their phone number.
  3. They initiate an M-Pesa payment.
  4. They wait.
  5. The operator checks whether payment arrived.
  6. Someone activates the customer's internet access.
  7. The customer refreshes the page and hopes it worked.

That experience can be frustrating for both the customer and the operator.

I wanted XRadius to make this process automatic.

What is XRadius?

XRadius is being built as a multi-tenant platform for ISP and Wi-Fi hotspot businesses.

At a high level:

                    ┌─────────────────────┐
                    │      XRadius        │
                    │   ISP Platform      │
                    └──────────┬──────────┘
                               │
          ┌────────────────────┼────────────────────┐
          │                    │                    │
          ▼                    ▼                    ▼
     Customers             Payments             Network
          │                    │                    │
          ▼                    ▼                    ▼
    Captive Portal          M-Pesa             MikroTik
                              │                    │
                              ▼                    ▼
                         Transactions          Internet
Enter fullscreen mode Exit fullscreen mode

The platform brings these pieces together instead of requiring the operator to manage them independently.

Why Go?

The backend is being built with Go.

Go is particularly attractive for this kind of system because XRadius needs to handle several concurrent activities:

  • API requests
  • Payment callbacks
  • Customer sessions
  • Router communication
  • Background jobs
  • Notifications
  • WebSocket connections
  • Dashboard updates

Go's lightweight concurrency model makes it a good fit for an application that needs to manage many simultaneous connections and background operations.

The backend follows a modular architecture with components for authentication, customers, billing, payments, networking, dashboards, and notifications.

The technology stack

The current architecture includes technologies such as:

  • Go — backend/API
  • PostgreSQL — primary database
  • Redis — caching, queues and real-time state
  • MikroTik RouterOS API — network provisioning and control
  • M-Pesa Daraja API — payments
  • JWT — authentication
  • WebSockets — real-time communication
  • Docker — deployment and service orchestration

The system is designed so that additional payment providers and networking integrations can be added later.

The captive portal

One of the most important parts of XRadius is the customer-facing captive portal.

A customer should not need to understand anything about RADIUS, MikroTik, APIs, or payment callbacks.

They should simply see something like:

EXTREME SOLUTIONS

Plug In. Connect Up. Go Extreme.

Choose your package

10 Mbps
1 Hour
KES 20

[ Buy Now ]
Enter fullscreen mode Exit fullscreen mode

After selecting the package, the customer enters their phone number and initiates payment.

The complicated infrastructure should happen behind the scenes.

M-Pesa + WebSockets

One of the features I'm particularly interested in is combining M-Pesa payment processing with WebSockets.

The flow looks like this:

Customer
   │
   │ Select package
   ▼
Captive Portal
   │
   │ HTTP request
   ▼
XRadius API
   │
   │ Initiate payment
   ▼
M-Pesa
   │
   │ Payment callback
   ▼
XRadius Backend
   │
   ├── Verify transaction
   ├── Update PostgreSQL
   ├── Update Redis
   └── Provision internet
            │
            ▼
        MikroTik
            │
            ▼
       Internet Access
            │
            ▼
        WebSocket
            │
            ▼
         Customer
Enter fullscreen mode Exit fullscreen mode

Instead of making the customer repeatedly refresh the page, the frontend can maintain a WebSocket connection.

When the payment is confirmed, XRadius can immediately notify the customer:

Payment successful! Connecting you to the internet...

Then the customer can be redirected into their active internet session.

This makes the payment-to-connect experience feel much more like a modern application.

Real-time admin dashboard

WebSockets are not only useful for customers.

They can also make the administrator dashboard much more dynamic.

For example, an operator could see:

ONLINE USERS       127
ACTIVE PACKAGES     84
TODAY'S REVENUE     KES 18,450
ACTIVE ROUTERS       6
PAYMENTS TODAY      312
Enter fullscreen mode Exit fullscreen mode

Instead of refreshing the dashboard every few seconds, important changes can be pushed to the browser in real time.

For example:

M-Pesa Payment Received
        ↓
Transaction Created
        ↓
Database Updated
        ↓
WebSocket Event
        ↓
Admin Dashboard
Enter fullscreen mode Exit fullscreen mode

The revenue counter can update immediately.

The online-user count can change immediately.

A router going offline can trigger an alert immediately.

MikroTik integration

The network layer is where XRadius becomes more than a normal billing application.

The platform is designed to communicate with MikroTik routers through the RouterOS API.

This allows the billing system to interact with the actual network infrastructure.

For example:

Customer purchases package
          ↓
Payment confirmed
          ↓
XRadius determines package
          ↓
Bandwidth rules applied
          ↓
MikroTik receives configuration
          ↓
Customer gets internet access
Enter fullscreen mode Exit fullscreen mode

This also opens the door to features such as:

  • Multiple router management
  • Online user monitoring
  • Bandwidth control
  • Session management
  • Hotspot provisioning
  • Router health monitoring
  • Automatic user disconnection after expiry

The goal is to move from manually managing routers to managing the network from one platform.

Bandwidth control

An internet package is not simply a price and duration.

It can also define network behavior.

For example:

Package Speed Duration Price
Starter 5 Mbps 1 hour KES 10
Standard 10 Mbps 3 hours KES 25
Premium 20 Mbps 24 hours KES 50

XRadius can use the package configuration to determine the appropriate bandwidth policy when provisioning a customer.

This creates a direct relationship between:

Payment → Package → Network Policy → Internet Access

Redis

Redis plays an important supporting role in the architecture.

Some information does not need to be repeatedly retrieved from PostgreSQL.

Redis can help with:

  • Caching
  • Session state
  • Temporary payment state
  • WebSocket-related state
  • Background job queues
  • Rate limiting
  • Short-lived data

For example, payment processing can involve several asynchronous steps.

Redis can help coordinate temporary state while PostgreSQL remains the source of truth for persistent financial records.

PostgreSQL

PostgreSQL acts as the primary persistent data store.

The domain model includes concepts such as:

  • Customers
  • Internet packages
  • Invoices
  • Payments
  • Routers
  • Hotspots
  • Transactions
  • Users
  • Businesses

This provides the foundation for reporting, billing history, customer management and auditing.

Multi-tenant architecture

One of the important goals of XRadius is to support multiple ISP and hotspot businesses from the same platform.

The basic concept is:

                    XRadius
                       │
        ┌──────────────┼──────────────┐
        │              │              │
        ▼              ▼              ▼
    Business A     Business B     Business C
        │              │              │
     Routers         Routers         Routers
     Customers       Customers       Customers
     Payments        Payments        Payments
Enter fullscreen mode Exit fullscreen mode

Each business should be able to manage its own:

  • Customers
  • Packages
  • Routers
  • Payment accounts
  • Revenue
  • Staff
  • Network infrastructure

This creates the possibility of XRadius becoming a platform rather than simply software installed on one router.

Security matters

Because XRadius handles payments, customer information and network infrastructure, security cannot be an afterthought.

The architecture therefore needs to consider:

  • Secure password storage
  • JWT security
  • Role-based access control
  • API authentication
  • Rate limiting
  • Input validation
  • Payment verification
  • Secure secrets management
  • Audit logging
  • Database security
  • Router credential protection
  • WebSocket authentication
  • Secure Docker configuration
  • HTTPS/TLS

A compromised billing system could potentially become a compromised network.

That makes security one of the most important parts of the project.

The business model

The platform is being designed around a SaaS model for Kenyan ISP and hotspot operators.

An operator could sign up, configure their business, connect their payment account, configure internet packages and connect their MikroTik routers.

From there, they can manage their operation from the XRadius dashboard.

The broader vision is:

One platform for running an ISP or Wi-Fi hotspot business.

What makes the project interesting?

For me, the interesting part of XRadius is that it sits at the intersection of several technologies.

It combines:

Fintech

M-Pesa and payment processing.

Networking

MikroTik, bandwidth management, hotspots and sessions.

Backend engineering

Go, PostgreSQL, Redis and APIs.

Real-time systems

WebSockets and live dashboards.

SaaS

Multi-business architecture and subscription management.

These aren't isolated components.

They have to work together.

A payment needs to eventually become network access.

A network session needs to become billing information.

A customer action needs to trigger backend events.

A router problem needs to become an administrator notification.

That integration is where the real engineering challenge lies.

Where XRadius is heading

There are several areas I want to continue exploring:

  • Real-time M-Pesa payment status
  • Real-time admin dashboards
  • Multi-router management
  • Better bandwidth management
  • Automated router provisioning
  • Advanced revenue analytics
  • Customer notifications
  • Network health monitoring
  • Mobile applications
  • More payment providers
  • AI-assisted ISP analytics
  • Automated anomaly detection

The long-term goal isn't just to build another billing dashboard.

It's to build infrastructure that helps small and growing internet businesses operate more efficiently.

Final thoughts

Building XRadius has been an interesting journey because it forces software engineering and networking to meet in the real world.

A customer doesn't care that a payment callback went through an API.

They care that they paid and got internet.

An ISP operator doesn't care that a WebSocket event was emitted.

They care that their dashboard accurately shows who is online and how much they have earned.

That's the standard I'm aiming for with XRadius:

Hide the complexity. Automate the workflow. Make internet businesses easier to run.

And ultimately:

XRadius — Connect. Bill. Manage. Grow.

If you're interested in ISP infrastructure, MikroTik, RADIUS, M-Pesa integrations, Go, real-time systems, or building technology for African connectivity businesses, this is a project I'll be documenting as it evolves.

Top comments (0)