My personal website built with Go, featuring personal projects and an introduction about myself.
# Clone the repository
git clone https://github.com/gitznik/robswebhub.git
cd robswebhub
# Run the setup script (installs everything and starts the database)
just setup
# Start the development server
just dev
# Visit http://localhost:8000- Backend: Go with Gin web framework
- Database: PostgreSQL with sqlc for type-safe queries
- Migrations: golang-migrate
- Templates: templ for type-safe HTML templates
- Frontend: HTMX for dynamic interactions, Pico CSS for styling
- Charts: go-echarts for data visualization
- Build Tool: just for task automation
This project uses just instead of make for task automation because:
- Better syntax: Cleaner, more readable command definitions
- Built-in help: Automatic help text generation
- Cross-platform: Works consistently across Linux, macOS, and Windows
- Shell flexibility: Choose your shell per recipe
- Better error messages: More helpful when things go wrong
- Parameters: Easy command parameters without make's complexity
- Personal portfolio and about page
- Scorekeeper: A game score tracking application
- Single and batch score entry
- Visual charts showing win progression
- Historical score tracking
- Go 1.22 or later
- PostgreSQL
- Docker (optional, for containerized development)
- just (command runner, install with
cargo install justorbrew install just)
- Clone the repository:
git clone https://github.com/gitznik/robswebhub.git
cd robswebhub- Install just (if not already installed):
# macOS
brew install just
# Linux/WSL
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
# Or with Cargo
cargo install just- Install dependencies and tools:
just installOr manually:
go mod download
go install github.com/a-h/templ/cmd/templ@latest
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration# Start PostgreSQL and the application
docker-compose up -d
# Stop everything
docker-compose down- Start PostgreSQL:
just setup-env
# Or use your existing PostgreSQL instance- Run migrations:
just migrate-up- Generate code (templ templates and sqlc queries):
just generate- Run the application:
just runFor hot reload during development (requires air):
go install github.com/cosmtrek/air@latest
just devjust --list # Show all available commands
just setup # Complete initial setup
just start # Start everything (DB, migrations, seed, dev server)
just stop # Stop all services
just dev # Run with hot reload
just test # Run tests
just check # Run all checks (fmt, lint, test)
just db-reset # Reset database completely
just compose-up # Start with docker-compose
just backup-db # Backup database
just help # Show detailed helpThe justfile includes many advanced commands for development:
# Database Management
just db-console # Connect to database with psql
just migrate-status # Check migration status
just migrate-goto <version> # Go to specific migration
just backup-db # Create timestamped backup
just restore-db <file> # Restore from backup
# Development Tools
just watch # Watch files and auto-rebuild
just profile-cpu # Profile CPU usage
just profile-mem # Profile memory usage
just outdated # Check for outdated dependencies
just audit # Run security audit
# Docker & Deployment
just docker # Build and run Docker container
just compose-logs # View docker-compose logs
just deploy # Deploy to Fly.io
just fly-ssh # SSH into Fly.io appFor a complete list of commands with descriptions:
just helprobswebhub/
βββ cmd/server/ # Application entry point
βββ internal/
β βββ config/ # Configuration management
β βββ database/ # Database connection and generated sqlc code
β βββ handlers/ # HTTP request handlers
β βββ templates/ # Templ templates
β βββ layouts/ # Base layouts
β βββ pages/ # Page templates
β βββ components/ # Reusable components
βββ migrations/ # Database migrations
βββ static/ # Static assets (CSS, JS, images)
βββ config/ # Configuration files
βββ scripts/ # Utility scripts
The application uses a hierarchical configuration system:
- Base configuration from
config/dev.yamlorconfig/production.yaml - Environment variables (prefixed with
APP_) .envfile (for local development)
APP_ENVIRONMENT:devorproductionAPP_APPLICATION__HOST: Server hostAPP_APPLICATION__PORT: Server portDATABASE_URL: PostgreSQL connection string
id: UUID (Primary Key)player_1: Textplayer_2: Textcreated_at: Timestamp
match_id: UUID (Foreign Key)game_id: UUIDwinner: Textwinner_score: SmallIntloser_score: SmallIntplayed_at: Datecreated_at: Timestamp
# Build the image
just docker-build
# Run the container
just docker-run
# Or do both
just docker# Install flyctl
curl -L https://fly.io/install.sh | sh
# Deploy
fly deployGET /- Home pageGET /about- About pageGET /scores- Scorekeeper indexPOST /scores/single- Submit single scorePOST /scores/batch- Submit batch scoresGET /scores/single-form- Get single score form (HTMX)GET /scores/batch-form- Get batch score form (HTMX)GET /scores/chart/:id- Get match chart
-
Code Generation: Always run
just generateafter modifying.templfiles orqueries.sql -
Database Changes: Create new migrations with:
just migrate-create your_migration_name
-
Testing: The example match ID
b13a16d8-c46e-4921-83f2-eec9675fce74is seeded for testing -
Hot Reload: Use
just devfor automatic reloading during development -
Quick Commands:
just start- Start everything (DB, migrations, seed, dev server)just quick- Quickly rebuild and run after changesjust check- Run all pre-commit checks (fmt, lint, test)
Feel free to open issues or submit pull requests if you find any bugs or have suggestions for improvements.
Robert Offner
- GitHub: @Gitznik
- LinkedIn: Robert Offner
This project is open source. Feel free to use it as a template for your own projects.