Based on my GoScaffold project which allows you to quickly set-up Ready to deploy Web application projects using Go, SQLite with GORM, Templ with HTMX and DaisyUI/TailwindCSS:
- Go Web Server: Fiber
- Database: SQLite3 (or PostreSQL/MySQL)
- ORM/SQL Query Builder: GORM
- HTML/Templating: Templ
- Client/Server interactions: HTMX
- Client Interactivity: AlpineJS
- UI/CSS: DaisyUI/TailwindCSS
vokoscreenNG-2024-07-23_17-00-32.webm
These instructions will get you a copy of the project up and running on your local machine for development, scaffolding and testing purposes.
Other sections still pending in the README:
Note: working but pending readme section
- Automated production deployments with Coolify
- Sqlite Litestream backups
- Object storage with Minio (used by Litestream)
- Development feature brances.
Install dev environment tooling, you must have go correctly installed and in your path.
It will install:
- bun: for TailwindCSS
- TailwindCSS: plugins
- goose: for migrations
- templ: to build/compile templ files into go code
make install
Generate TailwindCSS styles, templ files and go executable (go build)
make build
Apply migrations to the DB and start the application (used in prod docker deployment)
make start
This is what you should be using for development, will auto generate css, templ files and translations and enable auto reloading of the server on file changes (not browser, just refresh the page, hit [f5] and done).
make dev
If for whatever reason you don't want to use Air and have auto reloading enabled
(use make dev
above for that), this will generate the css and templ files and go run
.
make run
Creates an Sqlite file at ./database/app.sqlite
to use for the app
make db/create
It deletes the database file
make db/delete
It deletes, then re-creates the Database and runs all migrations to start with a clean slate.
make db/setup
It dumps the DB schema into a file at ./database/schema.sql
make db/dump-schema
Creates a new migration file for the DB.
make db/migration name=add_column_price_to_payments
Lists Goose migration status
make db/status
Runs pending migrations
make db/migrate
Rollbacks the last migration
make db/rollback
Rollbacks then re-runs last migration
make db/redo