Skip to content

EN Admin Backend

Andrewkydev edited this page Aug 25, 2026 · 2 revisions

Admin Backend

Русский: RU-Admin-Backend

Admin is an optional management backend, not a required part of the bot runtime.

It implements bootstrap v1/v2, principals/RBAC, web grants and sessions, users/chats/plugins/settings, logs/audit/SSE/metrics, declarative UI, Control WebSocket, and durable operations with progress reporting.

Minimal loopback setup

server := api.NewWithDependencies(api.Dependencies{
	App: app, Store: store, Plugins: app.Plugins(), Logs: stream, Logger: logger,
	Auth: verifier, Authorization: policy,
})
if err := server.RegisterPluginModules(app.Plugins()); err != nil {
	log.Fatal(err)
}
defer server.Shutdown(context.Background())
log.Fatal(server.Listen("127.0.0.1:8080"))

In production, provide Auth, Authorization, durable identity/session repositories, and the required Control/operations dependencies.

Security rules

  • Without Auth, protected requests fail closed with 401 Unauthorized.
  • For unauthenticated local development, use api.NewInsecureDevelopmentServer() or set InsecureDevelopment explicitly. Its Listen method accepts only an explicit loopback host.
  • NewHTTPServer and ServeHTTP do not validate the bind address themselves; provide auth or an external network boundary.
  • The static verifier is suitable only for development and compatibility use.
  • Never put web grants, session tokens, or Control tickets in URLs or logs.
  • Call RegisterPluginModules before serving; a registration error is fatal.
  • Shutdown(ctx) closes maintenance tasks, operations, Control sockets, and the audit dispatcher.

The admin frontend and demo application are maintained in separate repositories.

Clone this wiki locally