Skip to content

Gas Docs

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.

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.

Add the core package to your Go module:

Terminal window
go get github.com/gasmod/gas

This small program is a complete Gas app. Run starts the server, waits for a shutdown signal, and closes the app’s services.

main.go
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)
}
}