# bagusstwan/wifi-blockchain architecture

> Architecture diagram of the GitHub repository bagusstwan/wifi-blockchain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bagusstwan/wifi-blockchain
- Repository: https://github.com/bagusstwan/wifi-blockchain

## Overview

WiFi-Blockchain is a Laravel captive-portal system that grants hotspot access to registered, whitelisted wallet holders. The principal flow is client portal access, wallet-authentication submission, eligibility checks and session recording, then MikroTik IP-binding bypass; authentication attempts are audited. A separate Filament admin panel manages routers and provides operational views of wallets, sessions, logs, and access roles. The sampled verifier shows a required signature field but no cryptographic signature check. README capabilities such as walled-garden setup and MAC synchronization are documented, but their implementation is not present in the sampled source.

Main entry points: [`app/Http/Controllers/Api/VerifyAuthController.php`](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Http/Controllers/Api/VerifyAuthController.php) (Auth Verifier), [`app/Models/Router.php`](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/Router.php) (Router Config), [`app/Http/Controllers/WifiAuthController.php`](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Http/Controllers/WifiAuthController.php) (Portal Handler), [`app/Models/Wallet.php`](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/Wallet.php) (Wallet Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Portal Authentication"]
  node_portal_handler["Portal Handler"]
  node_portal_view["Login View<br/>[login.blade.php]"]
  node_verifier["Auth Verifier"]
end

subgraph group_network["Router Access"]
  node_routeros["MikroTik RouterOS"]
end

subgraph group_state["Application State"]
  node_wallet_model["Wallet Records<br/>[Wallet.php]"]
  node_session_model["Active Sessions<br/>[ActiveSession.php]"]
  node_log_model["Auth Logs<br/>[AuthLog.php]"]
  node_router_model["Router Config<br/>[Router.php]"]
  node_database[("Application Database")]
end

subgraph group_admin["Admin Dashboard"]
  node_router_resource["Router Management<br/>[RouterResource.php]"]
  node_session_resource["Session Management"]
  node_log_resource["Auth Log Management"]
  node_wallet_resource["Wallet Management<br/>[WalletResource.php]"]
  node_dashboard_widgets["Dashboard Insights"]
end

node_client(("WiFi Client"))
node_admin(("Administrator"))

node_client -->|"requests portal"| node_portal_handler
node_portal_handler -->|"renders login"| node_portal_view
node_client -->|"submits credentials"| node_verifier
node_verifier -->|"checks wallet"| node_wallet_model
node_verifier -->|"upserts session"| node_session_model
node_verifier -->|"records outcome"| node_log_model
node_verifier -->|"loads active router"| node_router_model
node_wallet_model -->|"reads"| node_database
node_session_model -->|"writes"| node_database
node_log_model -->|"writes"| node_database
node_router_model -->|"reads"| node_database
node_verifier -->|"queries binding; adds bypass"| node_routeros
node_admin -->|"manages routers"| node_router_resource
node_admin -->|"reviews sessions"| node_session_resource
node_admin -->|"reviews auth logs"| node_log_resource
node_admin -->|"manages wallets"| node_wallet_resource
node_admin -->|"views metrics"| node_dashboard_widgets
node_router_resource -->|"manages records"| node_router_model

click node_portal_handler "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Http/Controllers/WifiAuthController.php"
click node_portal_view "https://github.com/bagusstwan/wifi-blockchain/blob/main/resources/views/wifi/login.blade.php"
click node_verifier "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Http/Controllers/Api/VerifyAuthController.php"
click node_wallet_model "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/Wallet.php"
click node_session_model "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/ActiveSession.php"
click node_log_model "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/AuthLog.php"
click node_router_model "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/Router.php"
click node_router_resource "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/RouterResource.php"
click node_session_resource "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/ActiveSessionResource.php"
click node_log_resource "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/AuthLogResource.php"
click node_wallet_resource "https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/WalletResource.php"
click node_dashboard_widgets "https://github.com/bagusstwan/wifi-blockchain/tree/main/app/Filament/Widgets"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_portal_handler,node_portal_view,node_verifier,node_client toneBlue
class node_routeros toneAmber
class node_wallet_model,node_session_model,node_log_model,node_router_model,node_database toneMint
class node_router_resource,node_session_resource,node_log_resource,node_wallet_resource,node_dashboard_widgets toneRose
class node_admin toneIndigo
```

## Components

### Portal Authentication

- [Portal Handler](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Http/Controllers/WifiAuthController.php): `app/Http/Controllers/WifiAuthController.php`
- [Login View](https://github.com/bagusstwan/wifi-blockchain/blob/main/resources/views/wifi/login.blade.php): `resources/views/wifi/login.blade.php`
- [Auth Verifier](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Http/Controllers/Api/VerifyAuthController.php): `app/Http/Controllers/Api/VerifyAuthController.php`

### Router Access

- **MikroTik RouterOS**

### Application State

- [Wallet Records](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/Wallet.php): `app/Models/Wallet.php`
- [Active Sessions](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/ActiveSession.php): `app/Models/ActiveSession.php`
- [Auth Logs](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/AuthLog.php): `app/Models/AuthLog.php`
- [Router Config](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Models/Router.php): `app/Models/Router.php`
- **Application Database**

### Admin Dashboard

- [Router Management](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/RouterResource.php): `app/Filament/Resources/RouterResource.php`
- [Session Management](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/ActiveSessionResource.php): `app/Filament/Resources/ActiveSessionResource.php`
- [Auth Log Management](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/AuthLogResource.php): `app/Filament/Resources/AuthLogResource.php`
- [Wallet Management](https://github.com/bagusstwan/wifi-blockchain/blob/main/app/Filament/Resources/WalletResource.php): `app/Filament/Resources/WalletResource.php`
- [Dashboard Insights](https://github.com/bagusstwan/wifi-blockchain/tree/main/app/Filament/Widgets): `app/Filament/Widgets`

### Other components

- **WiFi Client**
- **Administrator**

## Connections

- WiFi Client → Portal Handler: requests portal
- Portal Handler → Login View: renders login
- WiFi Client → Auth Verifier: submits credentials
- Auth Verifier → Wallet Records: checks wallet
- Auth Verifier → Active Sessions: upserts session
- Auth Verifier → Auth Logs: records outcome
- Auth Verifier → Router Config: loads active router
- Wallet Records → Application Database: reads
- Active Sessions → Application Database: writes
- Auth Logs → Application Database: writes
- Router Config → Application Database: reads
- Auth Verifier → MikroTik RouterOS: queries binding; adds bypass
- Administrator → Router Management: manages routers
- Administrator → Session Management: reviews sessions
- Administrator → Auth Log Management: reviews auth logs
- Administrator → Wallet Management: manages wallets
- Administrator → Dashboard Insights: views metrics
- Router Management → Router Config: manages records
