- Go
- Echo - Web framework
- Templ - Templating engine
- HTMX - Dynamic Sites without Javascript
- Tailwind CSS - CSS framework
- Bun - JavaScript bundler
- Air - Live reload for Go apps
- Taskfile - Task runner
run bun install
The server binary embeds the static file directory and serves anything contained within under src/static
. To build the server
binary you should first generate the tailwind
, templ
, and any other necessary generated code for your app:
task generate
Once all files have been generated, the binary can be built just like any other go binary:
go build -o build/server .src/main.go
Or you can use the build
task which will generate code before building the binary:
task build
You can easily containerize the build using the provided Dockerfile. Make sure all code is generated before triggering
a build of the container, or use the container
task which will generate any code first:
task container container_name=my-app container_tag=test
Deploying to Railway doesn't require any special configuration. You can just fork this repository and configure Railway to use your forked repository. Railway will then automatically build and deploy your main branch on every change.
Note: This template was designed to deploy to Railway in mind but there is nothing prohibiting this template from working elsewhere. The binary is just a standard go http server. The Dockerfile should work just about anywhere the runs containers.
Development mode will watch for changes in the source code and restart the server automatically. It will also watch for changes in the static files and recompile them automatically.
task dev
src/
├── static/
│ └── (static files served directly at /static/*)
├── templates/
│ └── (reusable Templ components)
└── views/
└── (views and routes for views)