__/\\\________/\\\_______/\\\\\_______/\\\\\\\\\\\\_____/\\\________/\\\_____/\\\\\\\\\____
_\/\\\_______\/\\\_____/\\\///\\\____\/\\\////////\\\__\/\\\_____/\\\//____/\\\\\\\\\\\\\__
_\//\\\______/\\\____/\\\/__\///\\\__\/\\\______\//\\\_\/\\\__/\\\//______/\\\/////////\\\_
__\//\\\____/\\\____/\\\______\//\\\_\/\\\_______\/\\\_\/\\\\\\//\\\_____\/\\\_______\/\\\_
___\//\\\__/\\\____\/\\\_______\/\\\_\/\\\_______\/\\\_\/\\\//_\//\\\____\/\\\\\\\\\\\\\\\_
____\//\\\/\\\_____\//\\\______/\\\__\/\\\_______\/\\\_\/\\\____\//\\\___\/\\\/////////\\\_
_____\//\\\\\_______\///\\\__/\\\____\/\\\_______/\\\__\/\\\_____\//\\\__\/\\\_______\/\\\_
______\//\\\__________\///\\\\\/_____\/\\\\\\\\\\\\/___\/\\\______\//\\\_\/\\\_______\/\\\_
_______\///_____________\/////_______\////////////_____\///________\///__\///________\///__
A modern Go web framework focused on developer experience, full-stack workflow, and fast iteration.
Vodka is a lightweight, high-performance HTTP framework for Go that combines clean routing, middleware chaining, validation, authentication utilities, and a powerful CLI for building modern full-stack applications.
Unlike traditional Go frameworks that focus only on request handling, Vodka focuses heavily on developer experience:
- โก Fast routing with Radix Tree architecture
- ๐ฅ Built-in hot reload for Go backends
- โ๏ธ Vite + React full-stack scaffolding
- ๐งฉ Middleware chaining system
- ๐ Authentication helpers and JWT validation
- โ Request validation support
- ๐ ๏ธ Clean and ergonomic API design
- ๐ One-command development workflow
go install github.com/DevanshuTripathi/vodka/cmd/vodka@latestMake sure your Go bin directory is in your system PATH.
export PATH=$PATH:$(go env GOPATH)/binAdd the following directory to Environment Variables:
%USERPROFILE%\go\bin
vodka create my-appThis generates:
- A Go backend powered by Vodka
- A Vite + React frontend
- Preconfigured development workflow
- SPA serving support for production deployments
cd my-app
cd frontend && npm install
cd ..vodka run devThis starts:
- The Vite frontend dev server
- The Vodka backend
- Automatic Go hot reload
- Concurrent frontend/backend workflow
Edit .jsx files โ frontend updates instantly.
Edit .go files โ backend rebuilds automatically.
package main
import (
"log"
"github.com/DevanshuTripathi/vodka"
)
func main() {
app := vodka.DefaultRouter()
app.GET("/ping", func(c *vodka.Context) {
c.JSON(200, vodka.M{
"message": "pong!",
})
})
if err := app.Run(":8080"); err != nil {
log.Fatal(err)
}
}mkdir backend-app
cd backend-app
go mod init app
go get github.com/DevanshuTripathi/vodkaInside any Go project using Vodka:
vodkaVodka automatically:
- Watches
.gofiles - Rebuilds your backend
- Restarts the server instantly
| Feature | Included |
|---|---|
| Radix Tree Routing | โ |
| Middleware Chaining | โ |
| Route Groups | โ |
| JSON Binding | โ |
| Request Validation | โ |
| JWT Validation Helpers | โ |
| Bearer Auth Middleware | โ |
| Hot Reload | โ |
| Vite + React Scaffolding | โ |
| SPA Serving | โ |
| Panic Recovery Middleware | โ |
| Logger Middleware | โ |
| CORS Middleware | โ |
| Request ID Middleware | โ |
| Context Storage | โ |
vodka.Engine is the central router and application instance.
It uses a Radix Tree-based routing architecture for fast request matching and low overhead.
app := vodka.DefaultRouter()vodka.Context wraps Go's http.Request and http.ResponseWriter into a clean and ergonomic API.
c.JSON(200, vodka.M{
"message": "hello",
})name := c.Query("name")id := c.Param("id")var user User
c.BindJSON(&user)c.Error(400, errors.New("invalid request"))Vodka middleware is just a vodka.HandlerFunc, which means it is a function with the signature:
func(*vodka.Context)That makes middleware a regular request handler that can run before and after the route handler.
Middlewares can:
- Modify requests
- Attach values to context
- Authenticate users
- Log requests
- Recover from panics
- Handle errors
Middlewares are registered with app.Use(...) or on a router group with group.Use(...).
Each incoming request is wrapped in a *vodka.Context and the framework builds a handler chain:
- all group middlewares
- the final route handler
c.Next() tells Vodka to continue to the next middleware or to the route handler. If you omit c.Next(), the chain stops there, which is useful when you want to short-circuit the request (for example, when authentication fails).
Use c.Next() inside your middleware when you want the request to continue down the chain. This lets you:
- run code before the next handler
- allow the next handler to execute
- run code after the next handler finishes
A middleware that calls c.Next() can also inspect or modify the response after the rest of the chain has executed.
If a middleware wants to stop the chain immediately, it can simply avoid calling c.Next() and optionally call c.Abort().
func RequestTimer() vodka.HandlerFunc {
return func(c *vodka.Context) {
start := time.Now()
c.Next()
latency := time.Since(start)
log.Printf("[RequestTimer] %s %s %v", c.Request.Method, c.Request.URL.Path, latency)
}
}
log.Printf(
"[%s] %s %v",
c.Request.Method,
c.Request.URL.Path,
latency,
)
}
}
func main() {
app := vodka.DefaultRouter()
app.Use(vodka.Logger(), vodka.Recovery(), vodka.ErrorHandler())
app.Use(RequestTimer())
api := app.Group("/api", AdminOnly())
api.GET("/dashboard", func(c *vodka.Context) {
userRole, _ := c.Get("user_role")
c.JSON(200, vodka.M{"role": userRole})
})
}Track requests across your logs using automatic request ID generation. Every request gets a unique ID that's automatically added to response headers and stored in the context.
app := vodka.DefaultRouter()
// Add request ID middleware โ generates unique ID for each request
app.Use(mixers.RequestID())
app.GET("/api/users", func(c *vodka.Context) {
requestID, _ := c.Get("request-id")
log.Printf("[%v] Fetching users", requestID)
c.JSON(200, vodka.M{"users": []string{"Alice", "Bob"}})
})
// Client receives: X-Request-ID: 550e8400-e29b-41d4-a716-446655440000Use a different header name if needed (context key is always "request-id"):
app.Use(mixers.RequestIDWithHeader("X-Correlation-ID"))Vodka supports request validation using struct tags.
type User struct {
Email string `validate:"required,email"`
Password string `validate:"min=8"`
}Vodka includes built-in Bearer authentication middleware and JWT validation helpers.
You can also provide custom validation logic:
app.Use(vodka.BearerAuth(contextKey, func(token string) (any, bool) {
return validateToken(token)
}))Projects generated using vodka create come with SPA serving preconfigured.
app.ServeSPA("./frontend/dist")If a route does not match an API endpoint, Vodka automatically serves the frontend application, enabling seamless React Router support in production.
Vodka is designed around a few core ideas:
- Fast development workflow
- Minimal boilerplate
- Strong developer experience
- Clean APIs
- Modern full-stack integration
- Practical defaults without excessive abstraction
- More middleware packages
- Enhanced validation system
- Improved benchmarking suite
- Expanded CLI tooling
- Testing utilities
Contributions, issues, and feature requests are welcome.
If you find bugs or have suggestions, feel free to open an issue or submit a pull request.
MIT License