Hi everyone! After weeks of development, I'm excited to officially launch Gofsen β a new web framework for building fast and maintainable REST APIs in Go.
π GitHub Repo
Bakemono-san
/
gofsen
A fast, idiomatic API framework for Go, built in Senegal.
π Gofsen - HTTP Framework for Go
Gofsen is a lightweight, Express.js-inspired HTTP framework for Go. Simple, fast, and powerful.
π¦ Installation
go get github.com/Bakemono-san/gofsen
CLI (gofsen-cli) Installation
You can install the CLI in multiple ways:
- Using go install (latest from main):
go install github.com/Bakemono-san/gofsen/cmd/gofsen-cli@latest
- Using Homebrew (macOS/Linux):
brew tap Bakemono-san/homebrew-tap
brew install gofsen-cli
- Linux via APT (Cloudsmith hosted repo):
# Add the APT repository (Ubuntu/Debian)
curl -1sLf 'https://dl.cloudsmith.io/public/bakemono-san/gofsen/setup.deb.sh' | sudo -E bash
# Install
sudo apt update
sudo apt install gofsen-cli
- RHEL/CentOS/Alma/Rocky via YUM/DNF (Cloudsmith hosted repo):
# Add the YUM/DNF repository
curl -1sLf 'https://dl.cloudsmith.io/public/bakemono-san/gofsen/setup.rpm.sh' | sudo -E bash
# Install
sudo dnf install gofsen-cli
# or: sudo yum install gofsen-cli
- Download prebuilt binaries (Windows/macOS/Linux) from the Releases page.
Verify installation:
gofsen-cli --version
CLI quickstart:
# Create a new project (interactive)
gofsen-cli new
# Generate CRUD routes for a resource
gofsen-cli gen route users
#β¦π§ Why Gofsen?
Gofsen was built out of a simple need: create clean, maintainable, and idiomatic APIs in Go β without boilerplate or over-engineered abstractions.
Other frameworks like Gin, Echo, or Fiber are great, but sometimes you just want:
- β Clear routing
- β Simple middleware chaining
- β
Route groups (
/api/v1) - β
Dynamic params (
/users/:id) - β JSON helpers and error handling
- β No reflection, no magic
That's where Gofsen shines.
β¨ Features
- β HTTP Routing: GET, POST, PUT, DELETE, PATCH
- β
Route Parameters:
/users/:id - β
Route Groups:
/api/v1, with local middleware - β Global & Custom Middleware
- β Request Helpers: JSON, query params, errors
- β Built-in Middleware: CORS, Logging, Recovery
- β Built in Go with β€οΈ from Senegal πΈπ³
π§ͺ Quick Start
Try it out right now! Here's a complete working example:
And here's the actual Gofsen Go code:
package main
import (
"github.com/Bakemono-san/gofsen"
)
func main() {
r := gofsen.New()
r.GET("/hello", func(ctx *gofsen.Context) {
ctx.Status(200).JSON(map[string]string{"message": "Hello from Gofsen"})
})
r.Listen("8080")
}
π Route Parameters & Groups
package main
import (
"github.com/Bakemono-san/gofsen"
)
func main() {
r := gofsen.New()
// Simple route with parameter
r.GET("/users/:id", func(ctx *gofsen.Context) {
userID := ctx.Param("id")
ctx.Status(200).JSON(map[string]string{
"user_id": userID,
"message": "User details",
})
})
// Route groups
api := r.Group("/api/v1")
api.GET("/posts", func(ctx *gofsen.Context) {
ctx.Status(200).JSON(map[string]string{"message": "All posts"})
})
api.POST("/posts", func(ctx *gofsen.Context) {
var post map[string]interface{}
if err := ctx.BindJSON(&post); err != nil {
ctx.Error(400, "Invalid JSON")
return
}
ctx.Status(201).JSON(map[string]interface{}{
"message": "Post created",
"post": post,
})
})
r.Listen("8080")
}
π§© Middleware Example
package main
import (
"github.com/Bakemono-san/gofsen"
)
// Custom Auth Middleware
func AuthMiddleware() gofsen.MiddlewareFunc {
return func(ctx *gofsen.Context) {
token := ctx.Request.Header.Get("Authorization")
if token != "Bearer valid-token" {
ctx.Error(401, "Unauthorized")
return
}
ctx.Next()
}
}
func main() {
r := gofsen.New()
// Global middleware
r.Use(gofsen.Logger())
r.Use(gofsen.Recovery())
r.Use(gofsen.CORS())
// Public routes
r.GET("/", func(ctx *gofsen.Context) {
ctx.Status(200).JSON(map[string]string{"message": "Welcome to Gofsen!"})
})
// Protected API group
api := r.Group("/api")
api.Use(AuthMiddleware()) // Apply auth to this group only
api.GET("/me", func(ctx *gofsen.Context) {
ctx.Status(200).JSON(map[string]string{
"user": "authenticated_user",
"message": "This is a protected route",
})
})
r.Listen("8080")
}
π Installation
go get github.com/Bakemono-san/gofsen
Import it in your project:
import "github.com/Bakemono-san/gofsen"
π§ Coming Soon
π οΈ A CLI is on the way to scaffold new Gofsen apps
gofsen new my-api
gofsen generate handler user
π Upcoming Features:Want to see the roadmap?
π Get Involved
Gofsen is 100% open-source and actively developed.
- π Report issues
- π Contribute features or fixes
- π’ Share it if you find it useful!
π https://github.com/Bakemono-san/gofsen
Thanks for reading, and happy hacking with Go! π¦«
Tags: #golang #go #api #webdev #opensource #framework #gofsen #backend #devtools
Top comments (2)
GOAT waiting for the next step
No worry buddy coming soon...