Skip to main content
Lightning is a Go web framework designed for speed and simplicity. Powered by fasthttp, it gives you trie-based routing, a composable middleware system, route groups, and a rich request/response API — all in a single, zero-fuss package.

Quick Start

Build and run your first Lightning app in minutes

Routing

Learn URL parameters, wildcards, and HTTP methods

Middleware

Add logging, recovery, auth, and more to your handlers

Context API

Access request data and write responses with the Context object

Get started in 3 steps

1

Install Lightning

Add Lightning to your Go module with a single command.
go get github.com/go-labx/lightning
2

Create your app

Instantiate the app, register a route, and start the server.
package main

import (
    "net/http"
    "github.com/go-labx/lightning"
)

func main() {
    app := lightning.DefaultApp()

    app.Get("/ping", func(ctx *lightning.Context) {
        ctx.JSON(http.StatusOK, lightning.Map{"message": "pong"})
    })

    app.Run()
}
3

Test it

Run your app and send a request to confirm it’s working.
go run main.go
curl http://127.0.0.1:6789/ping
# {"message":"pong"}

Explore the framework

Route Groups

Organize routes under shared prefixes with scoped middleware

Request Handling

Parse JSON bodies, query strings, headers, and cookies

Responses

Send JSON, XML, HTML, plain text, and file responses

Error Handling

Customize 404 and 500 handlers for your application

Static Files

Serve assets, images, and other static content

Configuration

Tune app name, JSON codecs, body size limits, and debug mode