Skip to content
/ light Public

fullstack go web app template, for those who enjoy radical simplicty.

Notifications You must be signed in to change notification settings

roscrl/light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

light

fullstack go web app template, for those who enjoy radical simplicty.

image

Setup

git clone https://github.com/roscrl/light.git &&
cd light                                      &&
make tools                                    &&
make run

Go Template

go install golang.org/x/tools/cmd/gonew@latest
gonew github.com/roscrl/light

Dependencies

Backend

go-sqlite3 database driver, requires CGO to build. Prefer zig cc over gcc/clang for easier cross compilation

Frontend

tailwindcss styling

@hotwired/turbo SPA like navigation

@hotwired/stimulus lightweight JS functionality

esbuild bundling

Development

sqlc generate Go code from SQL queries

is test assertions

rod browser testing

fsnotify watch Go template changes in dev mode without recompiling

golangci-lint linting

gofumpt formatting

Deployment Checklist

Cloudflare

  • Set SSL Full (strict)
  • Add an A record in the DNS settings pointing to VPS IP
  • Create a 15 year 'Origin Certificate' and place in config/public.pem & config/private.pem
  • Enable Rate Limiting
    • (http.request.uri.path contains "/") 50 requests per 10s
    • TODO: Also add rate limiting to Caddy as is not an application concern
  • Enable Bot Fight Mode
  • Enable Page Rules Caching to respect Cache-Control headers returned
    • playlistvote.com/* Cache Level: Cache Everything
  • Always Use HTTPS, Enable Brotli

Hetzner

  • Set firewall to allow only Cloudflare IPs on port 443
  • Set firewall to allow only personal IP on port 22

VPS Setup

  • Change Makefile constant APP_NAME to your own

  • Change Makefile constant CLOUDFLARE_ZONE_ID to your own

  • Change filename config/todos.caddy to <APP_NAME>.caddy

  • Change config/todos.caddy tls /etc/ssl/certs/todos.pem /etc/ssl/private/todos.pem to tls /etc/ssl/certs/<APP_NAME>.pem /etc/ssl/private/<APP_NAME>.pem

  • Change filename config/todos.service to <APP_NAME>.service

  • Change config/todos.service EnvironmentFile=/root/todos/.prod to EnvironmentFile=/root/<APP_NAME>/.prod

  • Change config/todos.service WorkingDirectory=/root/todos to WorkingDirectory=/root/<APP_NAME>

  • Change config/todos.service ExecStart=/root/todos/app to ExecStart=/root/<APP_NAME>/app

  • Create config/.prod using config/.prod.template as a template

  • Ensure config/private.pem exists (cloudflare origin certificate private key from cloudflare setup)

  • Set VPS_IP environment variable to your VPS IP

  • Set CLOUDFLARE_ZONE_ID environment variable to your cloudflare zone id

  • Set CLOUDFLARE_EMAIL environment variable to your cloudflare email

  • Set CLOUDFLARE_KEY environment variable to your cloudflare key

  • Run make vps-new

Classic abandoned TODO section

  • On PR, create a ephemeral preview environment with usage of Makefile VPS creation commands
  • On PR, performance testing should execute and attach a graph with ability to see performance changes overtime. rod for e2e? but tests/bench for individual endpoints
  • Code coverage + quality + unit test reports integrated to PR
  • core/notify package for sending notifications (email, sms, push, etc)
  • E2E testing of VPS deployment as CI/CD workflow
  • Load testing https://shane.ai/posts/load-testing-tips/
  • Replica to S3 for SQLite https://litestream.io
  • Tailwind css formatter/autocomplete plugin, not working for some reason on Intellij multiple tickets open on Intellij YouTrack
  • Session management https://github.com/alexedwards/scs , fix bug with goroutine
  • Investigate https://www.sqlite.org/spellfix1.html
  • https://docs.gitlab.com/ee/ci/testing/
  • Hotreload - find simple solution

About

fullstack go web app template, for those who enjoy radical simplicty.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages