Gleece - Bringing joy and ease to API development in Go! 🚀




Philosophy
Developing APIs doesn’t have to be a chore - it should be simple, efficient, and enjoyable.
Gone are the days of manually writing repetitive boilerplate code or struggling to keep your API documentation in sync with your implementation.
With Gleece, you can:
- 🔧 Simplify your API development process.
- 📜 Automatically generate OpenAPI v3.0.0 / v3.1.0 specification directly from your code.
- 🎯 Ensure your APIs are always well-documented and consistent.
- ✅ Validate input data effortlessly to keep your APIs robust and secure.
- 🔐 Security first approach, easy authorization with supplied check function.
- ⚡️ Choose Your Framework - seamlessly works with both Gin & Echo Rest frameworks
Gleece aims to make Go developers’ lives easier by seamlessly integrating API routes, validation, and documentation into a single cohesive workflow.
💫 Look & Feel
Here’s a practical snippet of how Gleece simplifies your API development:
package api
import (
"github.com/google/uuid"
"github.com/gopher-fleece/gleece/external" // Importing GleeceController
)
// @Tag(User Management)
// @Route(/users-management)
// @Description The User Management API
type UserController struct {
external.GleeceController // Embedding the GleeceController
}
// @Description User's domicile
type Domicile struct {
// @Description The address
Address string `json:"address" validate:"required"`
// @Description The number of the house (must be at least 1)
HouseNumber int `json:"houseNumber" validate:"gte=1"`
}
// @Description Create a new user
// @Method(POST)
// @Route(/user/{user_name})
// @Path(name, { name: "user_name", validate: "required" }) The user's name
// @Query(email, { validate: "required,email" }) The user's email
// @Body(domicile, { validate: "required" }) The user's domicile info
// @Header(origin, { name: "x-origin" }) The request origin
// @Header(trace) The trace info
// @Response(200) The ID of the newly created user
// @ErrorResponse(500) The error when process failed
// @Security(ApiKeyAuth, { scopes: ["read:users", "write:users"] })
func (ec *UserController) CreateNewUser(email string, name string, domicile Domicile, origin string, trace string) (string, error) {
// Do the logic....
userId := uuid.New()
return userId.String(), nil
}
All other aspects, including HTTP routing generation, authorization enforcement, payload validation, error handling, and OpenAPI v3 specification generation, are handled by Gleece CLI.
📚 Documentation
🌐 Integrating with Golang Rest Routers
For a complete example project using Gleece, check out the Gleece Example Project. This project demonstrates how to set up and use Gleece in a real-world scenario, providing you with a practical reference to get started quickly.
🎨 VSCode Extension
To enhance your development experience with Gleece, we provide an official VSCode extension that provides intelligent annotation highlighting and improved code visibility.
For more information and capabilities see the Gleece VSCode Extension.
To install it search Gleece
in the "Extension" tab or go to the VSCode Marketplace.
⚠️ Disclaimer
Gleece is currently an under-development project. We’re working hard to make it amazing.
We’d love your feedback and contributions as we shape Gleece!
Stay tuned for updates, and feel free to open issues or pull requests to help us improve!
📜 License
Gleece is licensed under the MIT LICENSE.