DEV Community


Build Web App with Go for Beginners Part I

Azeez Abiodun Solomon
A software developer that derive joy in creating stuffs and helping others
・2 min read

Cover Image

Go was designed at Google in 2007 to improve programming productivity in an era of multicore, networked machines and large code bases.The designers wanted to address criticism of other languages in use at Google, but keep their useful characteristics.

During past couple of days I have been learning Golang and I noticed some of the challenges I faced was the lack of constraints or standards, choosing external packages and much more😭. I would like to share some findings that have worked for me and also walk you through the steps by building a simple todo app.


  • A Golang compiler installed on your Machine
  • An IDE or text editor
  • Basic understanding of Go
  • Basic understanding of HTML and CSS
  • Basic understanding of SQL (Only required to create Database πŸ˜‰)

Project Layout

We would start by creating a module for our project so as to better track our packages in a file called go.mod which would makes it easier for distribution or deployment. it's more like package.json or composer.json.

 go mod init
Enter fullscreen mode Exit fullscreen mode

Next, we need to create the following folders.

You don't have to follow this structure.😊

|   └── Todo.go
β”œβ”€β”€ controllers  
|    └── TodoController.go
β”œβ”€β”€ database
|     └── connect.go
β”œβ”€β”€ views  
|     └── index.html
|     └── create.html
|── main.go
|── .env
Enter fullscreen mode Exit fullscreen mode


The following packages would be used to better develop our project.

  • Gorm: Go ORM that support mysql and other databases.
go get -u

Enter fullscreen mode Exit fullscreen mode
  • Mux: It's handles our routes and requests.
go get -u

Enter fullscreen mode Exit fullscreen mode
  • Godotenv: Would be used to access our .env variables
go get

Enter fullscreen mode Exit fullscreen mode
  • MySQL driver: Allow connection to MySQL DB
 go get

Enter fullscreen mode Exit fullscreen mode

I wouldn't want you to be bored with this post so I decided to split it into two. The other part would be posted in the comment section soon.

Please do leave a comment in case you have any contributions, I would really appreciate that.πŸ˜‰

Thanks for reading.❀️

Discussion (2)

morshud profile image
Gbadamosi Moshood

Wow! What a great tut...........

iamhabbeboy profile image
Azeez Abiodun Solomon Author

Thanks for reading, here is the continuation Part II 😊