A monorepo containing Go microservices for Wayru network infrastructure. This repository includes services for identity management, network access server operations, accounting, usage scoring, and device package updates.
This monorepo contains three main applications:
- IDP (Identity Provider): Authentication and credentials distribution service for Wayru's first-party realm (
wayru.io) - NAS (Network Access Server): Network accounting, connection tracking, usage statistics, and scoring service
- WUPI: Worker service for calculating NAS usage scores from accounting data
π Identity & Authentication: Secure credential distribution and authentication for network access
π Accounting & Tracking: Comprehensive network session accounting and connection tracking
π Usage Analytics: Real-time statistics, scoring, and analytics for network usage
π Real-time Processing: MQTT and RabbitMQ integration for real-time data processing
π³ Containerized: Docker support for all services
βΈοΈ Kubernetes Ready: Kubernetes deployment configurations included
π¦ Database Integration: PostgreSQL with SQLC for type-safe database queries
π FreeRADIUS Integration: Full FreeRADIUS compatibility for network authentication
- Runtime: Go 1.23+
- Database: PostgreSQL
- Query Generation: SQLC
- Message Queue: RabbitMQ
- Real-time: MQTT
- Logging: Zap (Uber)
- Containerization: Docker
- Orchestration: Kubernetes
Before you begin, ensure you have the following installed:
- Go 1.23+ and Go modules
- PostgreSQL database
- SQLC (for query code generation)
- golang-migrate (for database migrations)
- Docker (optional, for containerized deployment)
- Make or Just (for build automation)
network-services/
βββ apps/
β βββ idp/ # Identity Provider service
β βββ nas/ # Network Access Server service
β βββ wupi/ # Usage score calculation worker
βββ db/ # Database migrations and queries
β βββ idp/ # IDP database migrations
β βββ nas/ # NAS database migrations
β βββ explorers/ # Explorers database migrations
β βββ devices/ # Devices database migrations
βββ pkg/ # Shared packages
β βββ api/ # API response utilities
β βββ cache/ # Caching utilities
β βββ logger/ # Logging utilities
β βββ middleware/ # HTTP middlewares
β βββ pgutils/ # PostgreSQL utilities
β βββ router/ # HTTP router
βββ docs/ # Documentation
βββ go.mod # Go module definition
git clone <repository-url>
cd network-servicesgo mod downloadFrom the root directory, run:
make generateOr using Just:
just generate idp
just generate nas
just generate wupiEach application can be run independently. Navigate to each app directory for specific instructions:
Using Make (if available):
# Build an app
make build app=idp
# Run an app
make run app=idp
# Watch and hot reload
make watch app=idpUsing Just:
# Build an app
just build idp
# Run an app
just run idp
# Watch and hot reload
just watch idpDatabase migrations are located in the db/ directory, organized by database:
db/idp/migrations/- IDP database migrationsdb/nas/migrations/- NAS database migrationsdb/explorers/migrations/- Explorers database migrationsdb/devices/migrations/- Devices database migrations
Run migrations using golang-migrate:
# Example for IDP database
migrate -path db/idp/migrations -database "postgres://user:password@localhost/dbname?sslmode=disable" upThis project uses SQLC to generate type-safe Go code from SQL queries. After writing queries in the queries/ directories, run:
make generateThe project uses SQLC for database query code generation. Each app has its own sqlc.yaml configuration file.
- Each app follows a similar structure:
cmd/main.go- Application entry pointinternal/- Private application codehandlers/- HTTP request handlersservices/- Business logicrepository/- Data access layerinfra/- Infrastructure setup (DB, env)
queries/- SQL queries for SQLCdeploy/- Deployment configurations
The pkg/ directory contains shared packages used across applications:
api/- API response utilitiescache/- Caching layerlogger/- Structured loggingmiddleware/- HTTP middlewares (auth, logging, etc.)pgutils/- PostgreSQL connection and query utilitiesrouter/- HTTP router implementation
Each application includes a Dockerfile. Build and run:
# Build IDP
docker build -t idp-api -f apps/idp/Dockerfile .
# Build NAS
docker build -t nas-api -f apps/nas/Dockerfile .
# Build WUPI
docker build -t wupi -f apps/wupi/Dockerfile .Kubernetes configuration files are available in each app's deploy/ directory. Update the configuration files with your specific values before deploying.
Each service requires specific environment variables. See individual app READMEs for detailed configuration:
Additional documentation is available in the docs/ directory:
database.md- Database setup and structuredeploy.md- Deployment instructionsdeploy_idp.md- IDP-specific deploymentmigrations.md- Migration guidelinesfreeradius_specs.md- FreeRADIUS integration specifications
This project is now open source. Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
Important: This project is now open source and maintained by the community. WAYRU no longer exists and will not provide support for this repository. For issues, questions, or contributions, please use the GitHub Issues section.
π Farewell Message
With gratitude and love, we say goodbye.
WAYRU is closing its doors, but we are leaving these repositories open and free for the community.
May they continue to inspire builders, dreamers, and innovators.
With love, WAYRU
Note: This project is open source. Wayru, Inc and The Wayru Foundation are no longer operating entities, and will not provide any kind of support. The community is welcome to use, modify, and improve this codebase.