Initialize a Go project with “go-blueprint”
Tags: go, beginners, initgo, goblueprint
Published: 2024-06-25 17:47:18


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/by0xm5vckr5d5wmh5p4i.png)


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/](https://golang.org/dl/)
**Step 1: Open terminal:**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yr38o7ixr210gu3s5u08.png)

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

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w8rzitefzrq4mg2zlcgv.png)

**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:**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vw5o6o22s5u26acijrzr.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7kcoo55104auvwhe7eg1.png)

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

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/flww1hn5g7sinkfz1t5o.png)


- If you encounter the "command not found" error as below, follow the next steps in step 5. Otherwise, you can proceed to step 6

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xsnq5nvnctv4zkbzp532.png)

**Step 5.1: Run command:**

```
GOPATH=$HOME/go
```

**Step 5.2: Run command:**

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jpkshud087220rimfl6.png)

So it's already fixed. You can refer to the error at the link: [here](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:**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bu1vrfqwdix933gtz1lg.png)

**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 .
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utopp3stldjlbkw6nguq.png)

- This is the result received


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q573yfa2h9ddcz3d4kp9.png)

- 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!")
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1x7me6ta06y8ws185ig.png)

**Step 9: Open terminal and run command:**

```
make run
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jc53r4z8fq8xltujpxai.png)

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

You can refer to "Go-blueprint" here 👉 [Go-blueprint](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:

- Medium: [Quang Hieu (Bee) -- Medium](https://quanghieudev.medium.com/)
- Dev: [Quang Hieu (Bee) -- Dev](https://dev.to/hieunguyendev)
- Linkedin: [Quang Hieu (Bee) -- Linkedin](https://www.linkedin.com/in/hiếu-nguyễn-1a38132bb/)
- Buy Me a Coffee: [Quang Hieu (Bee) -- buymeacoffee](https://buymeacoffee.com/quanghieudev)