Personal portfolio website built with Go, Templ and MySQL.
- Go — backend
- Templ — server-side HTML templating
- HTMX — dynamic UI without JavaScript frameworks
- MySQL — database
- Docker — containerized database
- golang-migrate — database migrations
- Go 1.22+
- Docker + Docker Compose
- Templ CLI
- golang-migrate CLI
go install github.com/a-h/templ/cmd/templ@latestgo install -tags 'mysql' github.com/golang-migrate/migrate/v4/cmd/migrate@latestMake sure $GOPATH/bin is in your PATH.
git clone https://github.com/alexbrunn/portfolio
cd portfoliocp .env.example .envEdit .env to set your database credentials:
DB_ROOT_PASSWORD=secret_root
DB_DATABASE=portfolio
DB_USER=portfolio_user
DB_PASSWORD=secret_password
DB_PORT=3306
DB_DSN=mysql://portfolio_user:secret_password@tcp(localhost:3306)/portfolio?parseTime=true
APP_PORT=8080
APP_ENV=developmentdocker compose up -dmake db/migrations/upmake run/webThe application is now running at http://localhost:8080.
| Command | Description |
|---|---|
make run/web |
Run the application |
make db/connect |
Connect to MySQL as app user |
make db/connect/root |
Connect to MySQL as root |
make db/migrations/new name=<name> |
Create new migration files |
make db/migrations/up |
Run all pending migrations |
make db/migrations/down |
Roll back migrations |
# Start containers in the background
docker compose up -d
# Follow logs
docker compose logs -f
# Stop containers
docker compose down
# Stop and remove volumes (⚠️ deletes all data)
docker compose down -v# Install dependencies
go mod tidy
# Generate templ files
templ generate
# Run the application
make run/web