> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lightning-go.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Lightning

> A lightweight, high-performance web framework for Go. Build fast HTTP services with clean routing, flexible middleware, and an expressive context API.

Lightning is a Go web framework designed for speed and simplicity. Powered by [fasthttp](https://github.com/valyala/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.

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Build and run your first Lightning app in minutes
  </Card>

  <Card title="Routing" icon="route" href="/concepts/routing">
    Learn URL parameters, wildcards, and HTTP methods
  </Card>

  <Card title="Middleware" icon="layer-group" href="/concepts/middleware">
    Add logging, recovery, auth, and more to your handlers
  </Card>

  <Card title="Context API" icon="code" href="/concepts/context">
    Access request data and write responses with the Context object
  </Card>
</CardGroup>

## Get started in 3 steps

<Steps>
  <Step title="Install Lightning">
    Add Lightning to your Go module with a single command.

    ```bash theme={null}
    go get github.com/go-labx/lightning
    ```
  </Step>

  <Step title="Create your app">
    Instantiate the app, register a route, and start the server.

    ```go theme={null}
    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()
    }
    ```
  </Step>

  <Step title="Test it">
    Run your app and send a request to confirm it's working.

    ```bash theme={null}
    go run main.go
    curl http://127.0.0.1:6789/ping
    # {"message":"pong"}
    ```
  </Step>
</Steps>

## Explore the framework

<CardGroup cols={2}>
  <Card title="Route Groups" icon="folder-tree" href="/concepts/groups">
    Organize routes under shared prefixes with scoped middleware
  </Card>

  <Card title="Request Handling" icon="inbox" href="/guides/request-handling">
    Parse JSON bodies, query strings, headers, and cookies
  </Card>

  <Card title="Responses" icon="paper-plane" href="/guides/responses">
    Send JSON, XML, HTML, plain text, and file responses
  </Card>

  <Card title="Error Handling" icon="triangle-exclamation" href="/guides/error-handling">
    Customize 404 and 500 handlers for your application
  </Card>

  <Card title="Static Files" icon="folder-open" href="/guides/static-files">
    Serve assets, images, and other static content
  </Card>

  <Card title="Configuration" icon="gear" href="/configuration/app-config">
    Tune app name, JSON codecs, body size limits, and debug mode
  </Card>
</CardGroup>
