Gebweb Manual
Gebweb is an opinionated web framework written entirely in Geblang on top
of stdlib/web/*. It targets developers who'd otherwise reach for
FastAPI, Symfony, or API Platform: a typed, decorator-driven workflow
with automatic OpenAPI 3.1 + SwaggerUI, the repository pattern,
constructor-injection DI, JWT / session auth, response caching, and
streaming primitives.
This manual combines setup guides and feature references. Read from the beginning for a guided tour, use the chapter list for a specific topic, or search for an API name from the top of any page.
Status
Gebweb is at version 1.8.10. The CHANGELOG.md in the source tree
lists every feature shipped to date; this manual documents how to
use them.
Start here
- Install Gebweb and create a project.
- Build a first API with a controller and constructor-injected service.
- Understand app construction before mixing auto-discovered controllers with explicit lists.
- Test the app and build it for deployment.
For AI agents
A condensed cheatsheet for AI coding agents working in Gebweb
apps lives at AGENTS.md. It's denser than this
manual, focused on idioms and common pitfalls, and intended to be
read once at the start of a session. Point your agent at that
file (and at the Geblang language AGENTS.md in the language
docs) before asking it to edit code.
Chapters
- Getting started - install, hello-world, request lifecycle.
- Routing and decorators -
@Get/@Post/@Route, path parameters, controller-level prefix. - Parameter binding - path, query, body, raw escape hatch, type coercion.
- Responses - automatic JSON wrapping,
gebweb.html/gebweb.file/gebweb.stream, HTTP exceptions. 4a. Views and templates - Twig-style templates, inheritance, filters, context injection. - Validation -
@Assert.*rules, custom validators, 422 Problem Details responses. - Repositories and
@ApiResource- theRepository<T>interface and auto-CRUD wiring. - Dependency injection - the
container, lifecycle model, autowiring rules,
@Param, interface-typed parameters, testing patterns. - Serialization groups -
@Groups, read / write filters,@ApiResourcedefaults. - Authentication and roles -
useAuthenticator,useSessionAuth, JWT helpers,@Auth,@RequiresRole, user injection. - Middleware -
cors,securityHeaders,requestId,requestLog,compress,rateLimit,use/before/after. - Caching -
useCacheStore,@Cache(ttl, vary), store options. - WebSockets and SSE -
@WebSocket,@Sse, streaming responses. - File uploads - multipart parsing,
UploadedFile,dict<string, UploadedFile>parameter binding. - OpenAPI and SwaggerUI - auto-generated spec, decorators that shape it, security schemes, SwaggerUI mount.
- Testing -
TestClient, in-process dispatch, fixtures, integration withtest.Test. - The
gebwebCLI -new,dev,build,routes,generate,migrate. - Plugins -
gebweb.plugin, custom extensions, sibling packages. - Database migrations -
gebweb migrate, versioned SQL files, sqlite / postgres / mysql. - Background jobs -
@Jobhandlers,gebweb.enqueue,gebweb worker, retry/backoff,@Scheduledcron + leader election. - Events -
@Onsubscribers,gebweb.publish, synchronous in-process pub/sub. - Mailer -
gebweb.Mailable, SMTP / AWS SES / memory / log transports, sync + async send via the worker. - Storage -
gebweb.put/get/ etc., memory + local-disk + S3 backends,UploadedFile.saveToStorage. - Message brokers -
@OnMessagehandlers,gebweb.useMessageQueue/useMessageTopic,gebweb.runMessageWorkerfor RabbitMQ / STOMP / SQS / SNS / Kafka. - CSRF protection -
gebweb.useCsrf,@CsrfExempt, the{{ csrf }}view variable, token cookies. - Flash messages -
gebweb.flash, session-backed one-shot category-grouped messages rendered as{{ flashes }}. - Forms and rehydration - submitted body + per- field error map preserved across redirect after validation failure, content-negotiated 422 for JSON clients.
- Asset pipeline -
gebweb.useStaticAssets, content-hash manifest, theassetview filter, dev vs prod mode. - Security headers -
gebweb.useSecurity, default header set, CSP with per-request nonce expansion, HSTS opt-in. - LLM integration -
gebweb.useLlm,gebweb.llmClient, provider-agnostic chat / embed / image surface across OpenAI, Anthropic, and AWS Bedrock. - services.yaml -
config/services.yamlfor parameters, services entries, interface bindings, tags, per-env overlays, and the encrypted secrets vault plusgebweb secretsCLI. - Internationalisation - locale negotiation, YAML catalogs, plural-aware lookup, validation localisation, locale-aware number and date formatting.
- Multi-tenancy - tenant resolver,
typed-parameter injection,
tenant_idstamping and query-scoping helpers. - Health checks -
@HealthCheckdecorator,/healthzand/readyzendpoints, per-probe timeout and aggregation. - OIDC and OAuth2 sign-in - Google, GitHub, and generic OIDC providers, authorization-code-with-PKCE, automatic session establishment.
- Outbound webhooks - subscription registry, HMAC-signed delivery through the job queue, configurable retry and dead-letter handling.
- Concurrency and shared state - the
request-per-goroutine model, what is shared vs per-request,
and using
store.Storefor safe shared mutable state. - Dev profiler bar -
useProfilerBar, the collapsible toolbar injected into HTML responses, time / memory / request panels, and therecordTimingtimeline. - Deployment -
gebweb.clistandard server entrypoint: flag/env/opts precedence, LetsEncrypt and self-signed HTTPS, graceful drain on SIGINT/SIGTERM.
Conventions
- All code samples assume
import gebweb;at the top of the file. - Sub-modules are imported with their natural alias when needed
(e.g.
import gebweb.errors as errors;forinstanceof HttpExceptionchecks). - "User class" means any class declared in the application's own code - typically a DTO, a domain entity, or the user-injection type the authenticator returns.