golang structure

Golang Skeleton With Fully Managed Versions For Kick Start GoLang Project Development

The buzzing programing language in an IT Industry is Golang, which has been seen in the limelight due to its intelligent features, good community support, and great documentation. These days, more developers are getting involved in the Golang usage due to its fame and high pay scale in dominant countries. Here we present a report to support this statement.


The above image indicates a steep rise in the involvement of developers in the GO language.

Though good documentation and intelligent features of Golang could help developers in learning language effectively and applying it productively still, Golang is missing with the common structure to quick start any API Structure.

We at MindInventory have proficient Golang Development team who encountered with a requirement of having an effective Integrated GoLang API Development Structure while working on several Golang Projects and as a result of which they came up with one. It is a kind of “Get Started Kit” where one can find all required components in a single package and need not to set up each time they start with any crucial work.

As it’s known, Golang is server-side language and one needs to have various components working and interacting with one another. It’s really cumbersome and wastage of time while adding each separate components and settling it down every time you have to work on and it’s better to go with one common structure where you get all settled as per well accepted coding standards.


Now, by going straight, let’s see how to use this Golang API Skeleton with Fully Managed Versions to kick start Golang project.


One need to install latest version of Go i.e 1.12 (Released in Feb 2019) from https://golang.org/dl/ and setup GOROOT and GOPATH.

Steps to Follow

1. For running the server you have to run following command in the terminal.

$ go run main.go

It will start your server at the port you have mentioned in the .env file.

2. To run the server in a port other than the default, run following command

$ go run main.go <specific port>

3. To create a build for your project and upload in the server, one need to run following command.

$ go build

Let’s go through each component to know all about it.

golang structure

1. API Helpers

It is a component which contains helper functions which returns API responses, HTTP status codes, default messages and other, etc.

2. Controllers

It is a component which contains handler functions which handles particular route need to be called when there are any API requests from the client machine.

3. Helpers

It is a component which contains common functions which are called helper function which is generally required in all APIs one creates.

4. Middlewares

It is a component which provides a convenient mechanism for filtering HTTP requests and one can add as add required middleware in this component.

5. Models

This is a component where database structure is created which is used while Database Migration.

6. Resources

Resources contain all structures other than models which can be used as responses.

7. Routers

It is a component where resources define the routes for the project and are used by the controller to handle the incoming request.

8. Seeder

It is a component which adds seeding data (dummy data) while creating a database. It is an optional component but generally used to test the model.

9. Services

This is the main component where all the core APIs for projects resides and one writes all APIs in this section.

10. Storage

It is a component where data is stored to which is generally termed as Database. It can handle all type of data i.e SQL like MySQL, MariaDB, and PostgreSQL whereas NoSQL Database like MongoDB.

11. Templates

It is a component which contains the HTML templates to be used in the project.

12. .env

It is a file which contains environment variables.

In this way, you can straight start your project with Golang for API creation and need not spent time in project set up.

Check full source code of Golang-Project-Structure on Github.

Paresh Solanki

Paresh Solanki is a Technical Head at Mindinventory. He started his career as PHP developer and have expertise in Node, Linux Administration, Angular, IONIC, React-Native, Laravel, CakePHP, CodeIgniter, Meteor, ReactJS and many other JS frameworks. Currently having his hands on Go Language, Python, RoR and Flutter.

Turn your vision to magnificent reality With
Our Web and Mobile Solutions