DEV Community

Georgios Komninos
Georgios Komninos

Posted on • Originally published at blog.gkomninos.com

Crafting a Web Application with Golang: A Step-by-Step Guide

Introduction

This is the first part the series Build a Web App with Golang . I am going to show you how you can build a web application using Golang. In fact, we are going to build an application that I need.

I this blog post we will cover the following:

  • Scope, meaning we will define what we want to build

The goal of this blog post is to understand the problem and it's domain. This will help us to understand what we need to code.

I will try to keep each blog post in a separate git branch. I believe this will make it easier for you to follow the tutorial.

Scope

As a freelancer I want a web application in which I will login and I can create invoices for my clients.

I want to be able to view the invoices created and download a PDF version

Let's breakdown the above requirements one by one.

First, let's see what an invoice contains:

  • Freelancer's details which include:

    Company Name

    Company Address

    Email

    Tax Number

    VAT Number

    Bank Accounts

  • Client details which include:

    Company Name

    Company Address

    Email

    VAT number

    • Invoice Details: Invoice Number Invoice Date Line Items

Here a sample invoice:

Image description

A Line Item, consists of:

- Description

- Disbursements

- Fees

A Bank Account, consists of:

- Bank Name

- Account No.

- IBAN

- BIC

We also need to have the VAT rate for our country and the amount of days that the invoice is payable within.

Let's now discuss the invoice number. This should be unique per invoice and in most of the cases it must be sequential. For my case the invoice number has the form for example 1030/24 which means that the invoice belongs to 2024 year and it has the number 1030. The next invoice should be 1031/24 and so on.

This generation should be automated.

Since this is an MVP and it should work only for one freelancer we will use HTTP Basic Authentication and the UI will be really minimal

Pages

Since we will build a web application let's define the pages that we want to build.

That's a draft but it will help us to get started.

- / : this is the homepage of the application. It should display a list of all the invoices created with pagination. Next to each invoice we want to have a button to view its details.

- /settings: Here we will display our company's details

-/settings/edit: A form to edit our company's details

- /clients: We will display a list of our clients

- /clients/id: It will display the details for the client with id id

- /clients/id/edit: a form to edit the client's details with id

- /clients/new: a form to add a new client

- /invoices/id/download: this will download the invoice with id id

- /invoices/id: we will view the details of an invoice

- /invoices/new: a form to create a new invoice

Technologies that we will use

We need to store our data somewhere. For simplicity and easy of deployment we are going to use the awesome SQLite DBMS.

This post is all about Golang so that's the back-end language. However we are going to use the Echo Framework and GORM to speedup development.

For the front-end I am not sure yet, most likely we are going to use Bootstrap . I am also pretty sure that we are going to use ChatGPT to write the basic HTML and CSS for us.

Conclusion

In the blog post we will dive into coding. We will create our git repository and setup some basics tooling that will save us a lot of time while we are developing.

I expect to release the next blog post of the tutorial every day.

If you have any questions or requests please write a comment.

Please subscribe to my newsletter so you get the updates.

Finally, just today I created an X Account and I would love to start having some followers.

Top comments (0)