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.
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
🚀 Quick Start
package main
import "github.com/Bakemono-san/gofsen"
func main() {
app := gofsen.New()
app.GET("/", func(c *gofsen.Context) {
c.JSON(map[string]string{
"message": "Hello Gofsen!",
"version": gofsen.Version,
})
})
app.Listen("8080")
}
✨ Features
✅ HTTP Routing
- HTTP Methods: GET, POST, PUT, DELETE, PATCH
-
Route Parameters:
/users/:id
-
Route Groups:
/api/v1
-
Query Parameters:
?name=value
✅ Middleware System
- Logger: Automatic request logging
- Recovery: Panic recovery
- CORS: Complete CORS support with configuration
- Custom Middleware: Create your own middlewares
✅ Request/Response Helpers
- JSON: Automatic parsing and sending
- Query Params: Easy…
🧠 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 (1)
GOAT waiting for the next step