This is a simple Go API template that uses a controller-service based model to build its routes.

Directory tree

├── output/
│   ├── text_file_1.txt
│   ├── text_file_2.txt
├── routes/
│   ├── end/
│   │   ├── controller.go
│   │   ├── route.go
│   │   └── service.go
│   └── root/
│       ├── controller.go
│       ├── route.go
│       └── service.go
├── go.mod
├── go.sum
├── main.go
├── README.md
├── routes.go


The output directory stores all files that are created when you sent a request.


The routes directory stores all routes definitions and its components.


This file defines the HTTP interaction for the route. It translates and treats the Fiber context to useful information for the service. That means it provides the HTTP interface for the service.


This file defines the Method, the path for the route and the Handler creation function. It exports everything needed to the main.go file to recognize this route.


The guts and the raw functions that execute the operations needed for the system to work.

⚠️ Should not have any coupling to HTTP. These functions should only have the strict necessary to work.


API initialization and API execution.


API route definition throughout the imports of the handlers created on the routes/ directory.


View Github