Skip to content

Architecture

The License Server is a full-stack application for managing software licenses, customers, and features. It provides a REST API, gRPC API, and a web-based admin UI.

license-server/
├── server/ # Server application
│ ├── cmd/server/ # Entry point (main.go)
│ ├── cmd/ # CLI commands (Cobra)
│ ├── biz/ # Business logic
│ ├── data/ # Data/Repository layer (Ent queries)
│ ├── server/ # HTTP/gRPC handler wiring
│ ├── service/ # Service layer (Proto → Biz bridge)
│ └── ui/ # Embedded frontend assets
├── client/ # Go client library (separate module)
│ ├── admin/ # Admin HTTP client
│ ├── events/ # Event system
│ ├── offline/ # Offline mode (cache, .lic, reconnect)
│ └── examples/ # Usage examples
├── release/ # Release tool
│ ├── cmd/release-tool/ # Entry point
│ ├── builder/ # Build logic
│ ├── docker/ # Docker build
│ ├── keys/ # Key management
│ └── packager/ # Customer package generation
├── shared/ # Shared code (used by server + client)
│ ├── auth/ # JWT, LDAP, TOTP, Password
│ ├── config/ # Configuration (Viper)
│ ├── database/ # Database client
│ ├── ent/ # Ent ORM (generated schemas)
│ ├── errors/ # Error handling
│ └── ... # Logging, metrics, etc.
├── web/ # Frontend (React/TypeScript)
│ └── src/
│ ├── pages/ # Page components
│ ├── components/ # Shared components
│ ├── stores/ # Zustand stores
│ ├── hooks/ # React Query hooks
│ └── gen/ # Generated types from proto
├── api/ # API definitions
│ ├── proto/ # Protobuf definitions
│ └── gen/ # Generated Go + TypeScript code
└── deployment/ # Docker, Compose, monitoring

The client supports a three-tier fallback chain for validation in disconnected environments:

TierUse CaseDurationRequires Server
Online ValidationNormal operationRealtimeYes
Offline License (.lic)Air-gapped / permanent offlineUp to 365 daysNo
Grace Period TokenTemporary network outageTypically 72hInitially yes

Authentication methods:

MethodFormatUse Case
JWTBearer <token>Web UI, interactive sessions
API KeyBearer lsk_<key>Programmatic access, CI/CD
LDAPVia login endpointEnterprise SSO

Roles:

RolePermissions
super_adminFull access, manage admins + groups
adminManage customers/licenses within assigned groups
editorCreate/edit customers and licenses
viewerRead-only access

Supports SQLite (default) and PostgreSQL.

SQLite is recommended for single-instance deployments:

  • WAL mode enabled for concurrent reads
  • Foreign keys enforced
  • Data stored in data/license.db

PostgreSQL is recommended for production/multi-instance:

  • Full ACID compliance
  • Connection pooling support
  • Configured via environment variables or config.yaml

Schema management uses Ent ORM with auto-migration on startup.

LayerTechnology
FrameworkGo-Kratos (HTTP + gRPC)
ORMEnt (schema-driven, code generation)
APIProtobuf + gRPC + google-annotations
AuthJWT + TOTP (2FA) + LDAP + API Keys
FrontendReact 19 + Vite 7 + TailwindCSS + HeroUI
StateZustand + React Query
DatabaseSQLite (mattn/go-sqlite3) / PostgreSQL
MetricsPrometheus
LoggingZerolog
CLICobra + Viper
SigningEd25519 (license + offline files)
EncryptionAES-256-GCM (backups, offline cache)