Running
Install dependencies
Download a go compiler, at least version 1.22
Download the correct version of templ using:
go install github.com/a-h/templ/cmd/templ@$(grep -oPm1 'github.com/a-h/templ \K[^ ]*' go.sum)
Setup a database
Start a postgresql database, using e.g.:
docker run -d --name pls4-db -p 5432:5432 -e POSTGRES_PASSWORD=pls4 -e POSTGRES_DB=pls4 -e POSTGRES_USER=pls4 postgres:16-alpine3.19
...or add a user and database to an existing instance:
CREATE USER pls4 WITH PASSWORD 'pls4';
CREATE DATABASE pls4 WITH OWNER pls4;
Setup the login system
Either:
Set up environment variables.
See .env.example
.
I recommend installing direnv and running
cp .env.example .env
echo "dotenv" > .envrc
echo ".envrc" >> .git/info/exclude
Build/Run
To run and rebuild when code has changed, download air and run:
air -build.pre_cmd="go generate ./..." -build.exclude_regex=".*_templ.go" -build.include_ext="go,templ"
To build the project as a binary, run:
go generate ./...
go build .
You can also build an OCI image using the Dockerfile
.
Profit
Open https://localhost:3000/ in your web browser!