The all-in-one Go tool for building, documenting, validating and securing REST APIs through code-first development
Following the recent articles about building and coding an I/S with Services API, Frontend, SDK, etc.
The key point demonstrated was the high importance of enabling developers to easily write their own controllers as functions, define annotations, and have the build and CI/CD processes generate the specification standards, routing, validations, APIs, and SDKs from the source code itself - maintaining a single source of truth.
In the previous articles, I have demonstrated how to achieve this using TSOA for TypeScript with OpenAPI schema and tools.
The most amazing aspect of TSOA
, from my point of view, is that unlike other frameworks, it focuses on the API development itself, and FROM it generates whatever is necessary (such as OpenAPI), instead of adjusting the API development structure to align with OpenAPI specifications.
Recently, we started working with Go, an amazing and well-designed programming language (unlike JS... XD), and we wanted to integrate it with our I/S and CI/CD processes.
Coming from the TypeScript ecosystem, we were inspired by frameworks like TSOA
that handle everything from routing and validation to OpenAPI generation - all from a single source of truth: your code.
And while these core features are amazing, TSOA
's true power lies in its flexibility - allowing easy customization for any real-world use-case while allowing bypassing the tool back to the native router when necessary.
Therefore, we decided to implement such a solution to provide the Golang community with the same powerful API development capabilities we had in the TypeScript ecosystem.
Our design considers the following:
We incorporated all these requirements into the Gleece
project.
Gleece is designed to provide Go developers with all these capabilities.
How does it work? Let's GO:
1 - Create a Gin/Echo service in Go
2 - Write your controllers and structs, set annotations with all required info (HTTP request, response, headers, validations, documentation, security, etc.)
3 - Implement your security check function
4 - Define your Gleece configuration (OpenAPI version, router engine, security function package, output path, etc.)
5 - Run Gleece CLI to generate routes & API specifications
6 - Import generated routes and register them into your engine's router of choice
7 - Run your server
That's all.
Sounds good?
Go ahead and check out the Gleece Repository Gleece documentation docs.gleece.dev and the complete Gleece Service Example
💡 Pro Tip: Install our VSCode Extension for a full coding viability support!
Special thanks to my colleague and friend Yuval Pomerchik for the initiative and massive contribution to this project.