Rakhsh is a minimal and lightweight web framework for Go designed to make building HTTP services simple and fast while staying close to Go's standard library.
The goal of Rakhsh is to provide a clean developer experience without hiding how Go's net/http works.
- Simple and clean API
- Built on top of Go's
net/http - Lightweight and minimal
- Easy to understand and extend
First initialize your Go module if you haven't already:
go mod init your-projectThen install Rakhsh:
go get github.com/aqandeh/rakhshCreate a main.go file:
package main
import "github.com/aqandeh/rakhsh"
func main() {
app := rakhsh.New()
app.GET("/", func(c *rakhsh.Context) {
c.String(200, "Hello from Rakhsh 🚀")
})
app.Listen(":8080")
}Run your server:
go run .Open your browser:
Rakhsh provides simple HTTP method routing.
app.GET("/users", func(c *rakhsh.Context) {
c.String(200, "Users list")
})app.POST("/users", func(c *rakhsh.Context) {
c.String(200, "User created")
})Each handler receives a Context object.
func(c *rakhsh.Context)
The context provides access to:
- `http.ResponseWriter`
- `*http.Request`
- route parametersapp.GET("/api", func(c *rakhsh.Context) {
c.JSON(200, map[string]string{
"framework": "Rakhsh",
"status": "running",
})
})app.GET("/hello", func(c *rakhsh.Context) {
c.String(200, "Hello world")
})Start the HTTP server with:
app.Listen(":8080")This will start the server on port 8080.
project/
│
├── go.mod
├── main.go
│
└── rakhsh/
├── app.go
├── router.go
└── context.go
Rakhsh follows a few simple ideas:
- Keep the API minimal
- Stay close to Go's
net/http - Avoid unnecessary abstractions
- Make the framework easy to understand and extend
Planned features for future versions:
- Dynamic routes (
/users/:id) - Middleware support
- Route groups
- Request binding
- Validation
- Logging middleware
- Static file serving
- CLI project generator
MIT License
