Initialize a Go project with “go-blueprint”

Quang Hieu (Bee)
CodeX
Published in
3 min readJun 25, 2024

Step-by-step guide to initiating a Go project. Make sure you have Go installed on your machine. You can download it from the official Go website**: https://golang.org/dl/**

Step 1: Open terminal:

Step 2: Install go-blueprint with the following command:

go install github.com/melkeydev/go-blueprint@latest

Step 3: Open the “go-blueprint” tool on the browser with the following link:

https://go-blueprint.dev/

Step 4: Fill in the necessary information of the project into the form such as projectName, database, framework, and some advanced options if used:

  • From the information we filled in the form, we will receive an order as shown in the picture.

Step 5: Copy the command, paste it into the terminal and press enter:

go-blueprint create --name my_project --framework gin --driver mongo
  • If you encounter the “command not found” error as below, follow the next steps in step 5. Otherwise, you can proceed to step 6

Step 5.1: Run command:

GOPATH=$HOME/go

Step 5.2: Run command:

PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

So it’s already fixed. You can refer to the error at the link: https://github.com/Melkeydev/go-blueprint/issues/166

Step 5.3: Then run the command:

go-blueprint create --name my_project --framework gin --driver mongo

Step 6: When run successfully, we will get results as shown:

Step 7: Open the project with Visual Studio Code

  • Enter the “my_project” directory using the command
cd my_project
  • Open the project quickly with Visual Studio Code using command
code .
  • This is the result received
  • That’s a great tool. So we have successfully initiated a Go project with “go-blueprint”. To continue running the project we just initiated, we perform the following steps

Step 8: Open the main.go file in the cmd/api folder and add the following line:

fmt.Println("Hello, World!")

Step 9: Open terminal and run command:

make run

We have finally completed the initialization of the Go project and successfully ran the project.

You can refer to “Go-blueprint” here: **https://github.com/Melkeydev/go-blueprint**

If you found this article useful and interesting, please share it with your friends and family. I hope you found it helpful. Thanks for reading 🙏

Let’s get connected! You can find me on:

--

--