Gas Docs
What is Gas?
Section titled “What is Gas?”Gas is a modular Go framework for building SaaS backends. It provides dependency injection, routing, middleware, events, and service lifecycle so each application starts with working infrastructure and a clear structure.
The framework has a small core package, github.com/gasmod/gas, and optional
modules for databases, configuration, authentication, storage, email, queues,
and more. Each module is its own Go module, so applications only add the
dependencies they use.
How to use these docs
Section titled “How to use these docs”The docs are organized by the parts of an application:
- Getting started: install Gas, learn the project structure, and build a notes API.
- Core: services, routing, middleware, events, and application lifecycle.
- Modules: optional integrations and their provider interfaces.
- Production: testing and deployment.
Use the sidebar to browse topics, or search with Ctrl+K / ⌘K to find a
specific API or behavior.
Start a new app
Section titled “Start a new app”Add the core package to your Go module:
go get github.com/gasmod/gasThis small program is a complete Gas app. Run starts the server, waits for a
shutdown signal, and closes the app’s services.
import ( "log" "net/http"
"github.com/gasmod/gas")
func main() { app := gas.NewApp()
app.Router().Handle(nil, http.MethodGet, "/", func(ctx gas.Context) error { return ctx.Text(http.StatusOK, "Hello, World!") })
if err := app.Run(); err != nil { log.Fatal(err) }}