Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add postgres support #9

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/host_web"
bin = ";export $(grep -v '^#' .envrc | xargs); ./tmp/host_web"
cmd = "go build -o ./tmp/host_web ./cmd/web/"
delay = 500
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
Expand Down
47 changes: 45 additions & 2 deletions cmd/web/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"flag"
"fmt"
"html/template"
Expand All @@ -9,15 +10,18 @@ import (
"sync"
"time"

"github.com/alexedwards/scs/pgxstore"
"github.com/alexedwards/scs/v2"
"github.com/alexedwards/scs/v2/memstore"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/rynhndrcksn/go-starter-site/internal/data"
"github.com/rynhndrcksn/go-starter-site/internal/vcs"
)

// config contains all the project configuration.
type config struct {
port int
env string
dsn string
}

// application contains the stuff used across the project.
Expand All @@ -28,12 +32,14 @@ type application struct {
wg sync.WaitGroup
templateCache map[string]*template.Template
sessionManager *scs.SessionManager
models data.Models
}

func main() {
var conf config
flag.IntVar(&conf.port, "port", 4000, "Web server port")
flag.StringVar(&conf.env, "env", "development", "Environment (development|staging|production)")
flag.StringVar(&conf.dsn, "dsn", os.Getenv("DB_CONN"), "Database DSN")
debug := flag.Bool("debug", false, "Enable debug mode")
displayVersion := flag.Bool("version", false, "Display version and exit")
flag.Parse()
Expand All @@ -53,20 +59,30 @@ func main() {
os.Exit(1)
}

// Initialize a new DB connection
db, err := openDB(conf)
if err != nil {
logger.Error(err.Error())
os.Exit(1)
}
defer db.Close()
logger.Info("database connection pool established")

// Initialize a new session manager with an in memory session store.
// Documentation can be found here: https://pkg.go.dev/github.com/alexedwards/scs/v2
sessionManager := scs.New()
sessionManager.Cookie.Secure = true
sessionManager.Lifetime = 12 * time.Hour
sessionManager.HashTokenInStore = true
sessionManager.Store = memstore.New()
sessionManager.Store = pgxstore.New(db)

// Initialize a new application struct.
app := &application{
config: conf,
debug: *debug,
logger: logger,
templateCache: templateCache,
models: data.NewModels(db),
sessionManager: sessionManager,
}

Expand All @@ -78,3 +94,30 @@ func main() {
}
os.Exit(0)
}

// openDB returns a pgxpool.Pool.
func openDB(cfg config) (*pgxpool.Pool, error) {
// Use pgxpool.New() to create an empty connection pool, using the DSN from the config struct.
// Note: pgxpool parses configurations from the connection string.
// i.e. postgres://.../myDatabase?sslmode=verify-ca&pool_max_conns=10
// More information can be found here: https://pkg.go.dev/github.com/jackc/pgx/v5/[email protected]#Config
db, err := pgxpool.New(context.Background(), cfg.dsn)
if err != nil {
return nil, err
}

// Create a context with a 5-second timeout deadline.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

// Use Ping() to establish a new connection to the database.
// If the connection couldn't be established successfully within the 5-second deadline, then this will return an error.
err = db.Ping(ctx)
if err != nil {
db.Close()
return nil, err
}

// Return the pgxpool.Pool connection pool.
return db, nil
}
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ module github.com/rynhndrcksn/go-starter-site
go 1.22

require (
github.com/alexedwards/scs/pgxstore v0.0.0-20240316134038-7e11d57e8885
github.com/alexedwards/scs/v2 v2.8.0
github.com/jackc/pgx/v5 v5.6.0
github.com/julienschmidt/httprouter v1.3.0
)

require (
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.18.0 // indirect
)
85 changes: 85 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,89 @@
github.com/alexedwards/scs/pgxstore v0.0.0-20240316134038-7e11d57e8885 h1:I5Z6bSLjKuh99H9JLN35Ep9+GOYp2Cg0Jy+HhykoQf8=
github.com/alexedwards/scs/pgxstore v0.0.0-20240316134038-7e11d57e8885/go.mod h1:hwveArYcjyOK66EViVgVU5Iqj7zyEsWjKXMQhDJrTLI=
github.com/alexedwards/scs/v2 v2.8.0 h1:h31yUYoycPuL0zt14c0gd+oqxfRwIj6SOjHdKRZxhEw=
github.com/alexedwards/scs/v2 v2.8.0/go.mod h1:ToaROZxyKukJKT/xLcVQAChi5k6+Pn1Gvmdl7h3RRj8=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.5.4/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
16 changes: 16 additions & 0 deletions internal/data/models.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package data

import (
"github.com/jackc/pgx/v5/pgxpool"
)

// Models struct contain the other models our application needs.
// For example: Users UserModel
type Models struct {
}

// NewModels returns a new Models struct.
// For example: Users: UserModel{DB:db}
func NewModels(db *pgxpool.Pool) Models {
return Models{}
}
32 changes: 22 additions & 10 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,31 @@ confirm:
## db/psql: connect to the database using psql
.PHONY: db/psql
db/psql:
psql ${DB_CONN}
@psql ${DB_CONN}

## db/mig/new name=$1: create a new database migration
.PHONY: db/mig/new
db/mig/new:
## db/mig/create name=$1: create a new database migration
.PHONY: db/mig/create
db/mig/create:
@echo 'Creating migration files for ${name}...'
migrate create -seq -ext=.sql -dir=./migrations ${name}
@goose -dir=./migrations postgres ${DB_CONN} create ${name} sql

## db/mig/down: apply all up database migrations
.PHONY: db/mig/down
db/mig/down: confirm
@echo 'Rolling back last migration...'
@goose -dir=./migrations postgres ${DB_CONN} down

## db/mig/status: see migration status for current database
.PHONY: db/mig/status
db/mig/status:
@echo 'Getting migration status for database...'
@goose -dir=./migrations postgres ${DB_CONN} status

# note: the $DB_CONN string is being sourced from the .envrc file.
## db/mig/up: apply all up database migrations
.PHONY: db/mig/up
db/mig/up: confirm
@echo 'Running up migrations...'
migrate -path ./migrations -database ${DB_CONN} up
@goose -dir=./migrations postgres ${DB_CONN} up

## dev/web: run the cmd/web application using 'air' for live reload
.PHONY: dev/web
Expand All @@ -49,14 +60,15 @@ dev/web:

## run/docker/web: run the dockerized cmd/web application
.PHONY: run/docker/web
run/docker/web: build/web
run/docker/web: build/docker/web
@echo 'Starting docker container for cmd/web...'
podman run -p 4000:4000 --rm localhost/${APP_DOCKER_NAME}:latest

## run/web: run the cmd/web application
## run/web: run the cmd/web application (fallback if 'air' isn't installed)
.PHONY: run/web
run/web:
@go run ./cmd/web
@go run ./cmd/web \
-dsn=${DB_CONN}

# ==================================================================================== #
# QUALITY CONTROL
Expand Down
16 changes: 16 additions & 0 deletions migrations/20240905232827_add_sessions_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS sessions
(
token TEXT PRIMARY KEY,
data BYTEA NOT NULL,
expiry TIMESTAMPTZ NOT NULL
);

CREATE INDEX IF NOT EXISTS sessions_expiry_idx ON sessions (expiry);
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS sessions;
-- +goose StatementEnd
8 changes: 6 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ Change the module name from `github.com/rynhndrcksn/go-starter-site` to match yo

In an effort to keep third party dependencies to a minimum, only the following ones have been added:

1. https://github.com/alexedwards/scs | Session management
2. https://github.com/julienschmidt/httprouter | Http router
1. https://github.com/alexedwards/scs/pgxstore | Store sessions in Postgres
2. https://github.com/alexedwards/scs | Session management
3. https://github.com/jackc/pgx | PostgreSQL driver
4. https://github.com/julienschmidt/httprouter | Http router

There are some development related dependencies that I recommend installing to your local machine:

Expand All @@ -44,7 +46,9 @@ If you're curious why the project is structured this way, look here!
- `cmd/` contains the entry points for the application.
- `web/` contains the server side logic for the website (routing, handlers, etc.).
- `internal/` contains things like validators, models, sending emails, etc.
- `data/` contains models, storing/retrieving things from a database, etc.
- `vcs/` contains logic for figuring out what version of the site is running.
- `migrations/` contains all the migration files for the site.
- `ui/` contains everything relating to HTML templates and site assets (css, js, and images).
- `html/` contains all the templates for constructing the website.
- `components/` contains components to embed into partials and/or pages.
Expand Down