Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apis/go-htmx-post-css-example
Example CRUD Web application written in Go, HTMX, PostCSS
https://github.com/apis/go-htmx-post-css-example
go-template golang htmx postcss vite
Last synced: 12 days ago
JSON representation
Example CRUD Web application written in Go, HTMX, PostCSS
- Host: GitHub
- URL: https://github.com/apis/go-htmx-post-css-example
- Owner: apis
- License: mit
- Created: 2024-12-20T15:16:21.000Z (14 days ago)
- Default Branch: master
- Last Pushed: 2024-12-22T00:59:08.000Z (13 days ago)
- Last Synced: 2024-12-22T01:27:20.340Z (13 days ago)
- Topics: go-template, golang, htmx, postcss, vite
- Language: Go
- Homepage:
- Size: 99.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# go-htmx-post-css-example
## Example CRUD Web application written in Go, HTMX, PostCSS
This is example Web application which is using [HTMX](https://htmx.org/) Javascript frontend library and
framework-less CSS generated with [PostCSS](https://postcss.org/). Server side rendering done with [Go HTML
templates](https://pkg.go.dev/html/template) on backend.Application builds single executable with all frontend code and templates embedded into it.
## Highlights
### Frontend dependencies
* [HTMX](https://htmx.org/) is a JavaScript library that streamlines web development by enabling you to define page behavior using HTML attributes and server-side logic, reducing the reliance on client-side JavaScript.
* [Vite](https://vite.dev) is a frontend tooling framework.
* [PostCSS](https://postcss.org/) plug-ins toolchain for consistent CSS styling and reducing assets size.### Server side Go dependencies
* [Go HTML templates](https://pkg.go.dev/html/template) for server side rendering
* [Chi](https://github.com/go-chi/chi) HTTP server
* [Zerolog](https://github.com/rs/zerolog) for loggingCode in this project partially based on this [repo](https://github.com/jritsema/go-htmx-tailwind-example).
Thanks a lot to an author ❤️ it was solid starting point for my HTMX Go trip! All CRUD models and Go HTML templates were
shamelessly taken from there.## Screenshot
![alt Screenshot](screenshot.png "Screenshot")
## Build instructions
```console
cd web/frontend
npm i
npm run build
```This should build your frontend assets into
web/frontend/dist
directory.```console
cd ../..
go build .
```
This should build Go executable and embed assets and templates into it.```console
./htmx-example
```By default application runs on http://localhost:8080
```console
./htmx-example --Host 0.0.0.0 --Port 8081 --SimulatedDelay 1000
```Optionally you can specify different host, port and simulate server side processing delay in milliseconds.