This repository contains my learnings from Alex Edwards' brilliant Let's Go book. While I have stuck quite closely with the project defined in the book, I have also made deviations and additions to: (1) further challenge myself, and (2) explore more of the popular packages used by the greater Go community.
Please consider this repository as a work-in-progress — there are more things I want to add and make changes to.
- I have added a
Makefile
adapted from a blog post by Alex Edwards to make running mundane commands quicker. Notably, theMakefile
includes a command to run the project with live reloading which automatically reruns the development server whenever a code change is detected. - I have added a
package.json
file that includes Prettier and the prettier-plugin-go-template plugin for it that formats Go HTML templates. I find it quite difficult to maintain the templates otherwise due to the Go templating syntax. - I use the GoDotEnv package for reading
.env
files which I use for providing default configuration values, rather than hard-coding them. - I use the Chi library for routing instead of httprouter. Chi offers many benefits over httprouter like clean middleware chaining and route grouping while remaining stdlib compliant.
- I use pgx rather than the standard database/sql. This is because I decided to use Postgres instead of MySQL (which Alex uses in the book). Additionally, pgx features performance benefits due to its focus on Postgres rather than SQL databases in general.
- I have added metrics via Prometheus to get the codebase closer to a production-ready state. I visualise the metrics using Grafana Cloud.