English | Π ΡΡΡΠΊΠΈΠΉ | δΈζ | EspaΓ±ol
This CLI tool can easily build amazing web applications with Go on the backend, using htmx & hyperscript and the most popular atomic/utility-first CSS frameworks on the frontend.
Features:
- 100% free and open source under the Apache 2.0 license;
- For any level of developer's knowledge and technical expertise;
- Well-documented, with a lot of tips and assists from the authors;
- Smart CLI that does most of the routine setup and preparation for production;
- Helps to get into the Go + htmx + hyperscript technology stack faster;
- The possibility of simply adding a ready-to-use and completely customized atomic/utility-first CSS framework to your project;
- Has a library of user-friendly helpers for your Go code;
- Contains a comprehensive example of how to use it out of the box.
π¬ From the authors: To give you a full understanding of the project, we have recorded a short πΊ video and prepared an introduction π article demonstrating the main features of the
gowebly
CLI.
![gowebly logo](https://private-user-images.githubusercontent.com/11155743/271663181-55c80da2-30c6-45e7-a813-1ddc42764480.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3NzQ4OTksIm5iZiI6MTcyNTc3NDU5OSwicGF0aCI6Ii8xMTE1NTc0My8yNzE2NjMxODEtNTVjODBkYTItMzBjNi00NWU3LWE4MTMtMWRkYzQyNzY0NDgwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA4VDA1NDk1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIwNzU4YjYxZmY5YmJiYzRmYWFkMWNiYWM5YTk4NDc5YzI4MjJlZWJjNDBhYThhMDFiY2RmY2JhMzM2NTQ0OWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.aNBKPHUiFf4BeyEDDxHM6f0Ol6lqk7ulq_g0OyWRcEM)
First, download and install Go. Version 1.21
(or
higher) is required.
Now, you can use gowebly
without installation. Just go run
it to create a new project with a default configuration:
go run github.com/gowebly/gowebly@latest create
That's it! π₯ A wonderful web application, using the built-in net/http package (as a Go backend), htmx & hyperscript is available in your Go HTML templates.
If you still want to install gowebly
CLI to your system by Golang, use the
go install
command:
go install github.com/gowebly/gowebly@latest
GNU/Linux and Apple macOS users available way to install gowebly
CLI via
Homebrew.
Tap a new formula:
brew tap gowebly/tap
Install gowebly
:
brew install gowebly/tap/gowebly
Feel free to using gowebly
CLI from our
official Docker image and run it in the isolated container:
docker run --rm -it -v ${PWD}:${PWD} -w ${PWD} gowebly/gowebly:latest create
Download ready-made exe
files for Windows, deb
, rpm
, apk
or Arch
Linux packages from the Releases page.
To get a complete guide to use and understand the basic principles of the
gowebly
CLI, we have prepared a comprehensive explanation of each command at
once in this README file.
π¬ From the authors: We always treasure your time and want you to start building really great web products on this awesome technology stack as soon as possible!
We hope you find answers to all of your questions! π But, if you do not find needed information, feel free to create an issue or send a PR to this repository.
Don't forget to switch this page for your language (current is English): Π ΡΡΡΠΊΠΈΠΉ, δΈζ, EspaΓ±ol.
Command to create a default config file
(.gowebly.yml
) in the current folder.
gowebly init
π‘ Note: Of course, you can skip this step if you're comfortable with the following default configuration for your new project:
- Go module (
go.mod
) andpackage.json
names are set to project;- Without any Go framework for the backend part (only built-in net/http package);
- Without any CSS framework for the frontend part (only default styles for the code example);
- The JavaScript runtime environment for the frontend part is set to Node.js;
- Server port is
5000
, timeout (in seconds):5
for read,10
for write;- Latest versions of the htmx & hyperscript.
![gowebly init](https://private-user-images.githubusercontent.com/11155743/270867417-679dd0e1-ecd6-4cfb-b145-c9f551ab2d9c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3NzQ4OTksIm5iZiI6MTcyNTc3NDU5OSwicGF0aCI6Ii8xMTE1NTc0My8yNzA4Njc0MTctNjc5ZGQwZTEtZWNkNi00Y2ZiLWIxNDUtYzlmNTUxYWIyZDljLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA4VDA1NDk1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5MjBkOWM5OTRmNmNiMmJkYzg5YzM5YWQzNGNkY2E3YmFmNWU3YjhhNTMxOWMxOTE4ZDVkMzk3MGVmNzJlODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.22aYjL5JHNYx0U6rKs-aXLkhg4eaIJ_0nvR7fhJILuQ)
Typically, a created config file contains the following options:
backend:
module_name: project # (string) option can be any name of your Go module (for example, 'github.com/user/project')
go_framework: default # (string) option can be one of the values: 'fiber', 'echo', 'chi', or 'default'
port: 5000 # (int) option can be any port that is not taken up on your system
timeout:
read: 5 # (int) option can be any number of seconds, 5 is recommended
write: 10 # (int) option can be any number of seconds, 10 is recommended
frontend:
package_name: project # (string) option can be any name of your package.json (for example, 'project')
css_framework: default # (string) option can be one of the values: 'tailwindcss', 'unocss', or 'default'
runtime_environment: default # (string) option can be one of the values: 'bun', or 'default'
htmx: latest # (string) option can be any existing version
hyperscript: latest # (string) option can be any existing version
But, you can choose any Go framework for your project's backend:
Go framework | Description |
---|---|
default |
Don't use any Go framework (only built-in net/http package) |
fiber |
Use a Go backend with the Fiber web framework |
echo |
Use a Go backend with the Echo web framework |
chi |
Use a Go backend with the chi composable router |
In additional, you can choose versions of the htmx, hyperscript, and one of the most popular atomic/utility-first CSS framework to your project:
CSS framework | Description |
---|---|
default |
Don't use any CSS framework (only default styles for the code example) |
tailwindcss |
Use the Tailwind CSS as a CSS framework |
unocss |
Use the UnoCSS as a CSS framework |
Also, you can set one of the JavaScript runtime environment for your frontend part:
JavaScript runtime | Description |
---|---|
default |
Use the Node.js as a JavaScript runtime environment |
bun |
Use the Bun as a JavaScript runtime environment |
Command to create a new project with the Go backend, htmx & hyperscript, and (optionally) atomic/utility-first CSS framework.
gowebly create
π‘ Note: If you don't run
init
command to create a config file (.gowebly.yml
), thegowebly
CLI creates a new project with a default configuration.
![gowebly create](https://private-user-images.githubusercontent.com/11155743/270867412-35b15677-4991-406d-b666-dfbc40beb1ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3NzQ4OTksIm5iZiI6MTcyNTc3NDU5OSwicGF0aCI6Ii8xMTE1NTc0My8yNzA4Njc0MTItMzViMTU2NzctNDk5MS00MDZkLWI2NjYtZGZiYzQwYmViMWNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA4VDA1NDk1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3N2Y3ODljMWEwN2VkOGRkZDMwNjg1NTY1ZmY0MDY2ZTg1ZWY1YTFkZGFlM2JkYmU5OGRhNjhjYjZjOTk4NmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hgUpM0TCueyH2lYSAGzMzxn8sKJmIvrvqOkoKQhc4B4)
Every time you make create
command for your project:
- CLI validates the config and applies all settings to the current project;
- CLI prepares the backend part of your project (generates the project
structure and needed utility files, runs
go mod tidy
); - CLI prepares the frontend part of your project (generates the needed utility
files, runs
npm|bun install
andnpm|bun run build:dev
for the first time); - CLI downloads minimized versions of htmx and hyperscript (from
official and trusted unpkg.com CDN) to the
./static
folder and places them as separated<script>
tags (at the bottom of the<body>
tag) in the Go HTML templatetemplates/main.html
.
Typically, a created project contains the following files and folders:
.
βββ assets
β βββ styles.css
βββ static
β βββ favicon.ico
β βββ htmx.min.js
β βββ hyperscript.min.js
β βββ styles.css
βββ templates
β βββ pages
β β βββ index.html
β βββ main.html
βββ .gitignore
βββ go.mod
βββ go.sum
βββ handlers.go
βββ main.go
βββ package-lock.json
βββ package.json
βββ server.go
Command to run your project in a development (non-production) mode.
gowebly run
π‘ Note: If you don't run
init
command to create a config file (.gowebly.yml
), thegowebly
CLI runs your project with a default configuration.
![gowebly run](https://private-user-images.githubusercontent.com/11155743/270867424-51c05652-4601-4f8b-8722-20401d0099d1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3NzQ4OTksIm5iZiI6MTcyNTc3NDU5OSwicGF0aCI6Ii8xMTE1NTc0My8yNzA4Njc0MjQtNTFjMDU2NTItNDYwMS00ZjhiLTg3MjItMjA0MDFkMDA5OWQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA4VDA1NDk1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRiMzc3YTE3MjhiODVmZDI4ZjcwZjY2YWRlYWIzMTY0YjBlY2ZhMTljZDE0YzRkMDRmMGE3NTVjN2UxNzRkNzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.udXhdu6QlJtqnHCNQZ1DRV3Dolx82dT9KCkDuPUQdYo)
Every time you make run
command for your project:
- CLI validates the config and applies all settings to the current project;
- CLI prepares the frontend part of your project (runs
npm|bun run build:dev
); - CLI prepares a development (non-production) version of the selected CSS
framework to the
./static
folder and places it as a<link>
tag (at the bottom of the<head>
tag) in the Go HTML templatetemplates/main.html
; - CLI starts a project's backend with settings from the default
configuration (or from the
.gowebly.yml
config file) by a simplego run
command.
Command to build your project for production and prepare Docker files for deploy.
gowebly build [OPTION]
π‘ Note: If you don't run
init
command to create a config file (.gowebly.yml
), thegowebly
CLI builds your project with a default configuration.
![gowebly build](https://private-user-images.githubusercontent.com/11155743/270867400-ac35b01f-0596-4d33-832e-1618709497d3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3NzQ4OTksIm5iZiI6MTcyNTc3NDU5OSwicGF0aCI6Ii8xMTE1NTc0My8yNzA4Njc0MDAtYWMzNWIwMWYtMDU5Ni00ZDMzLTgzMmUtMTYxODcwOTQ5N2QzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA4VDA1NDk1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlMDkyYWZiMzYwYjRmY2MyYTFjZjFlMzM0ZWE5NDhkZGUzMzQyZTBkYTZmMjI0OTRmNWQ4MzNlZTlhYzQ4YzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5KWgpdW6w9HBaba08y0FBnvPJ3Yj6TQRQfHvEZpqkr8)
You might add the following options:
Option | Description | Required? |
---|---|---|
--skip-docker |
Skip generation process for the Docker files (it's helpful if you've your own) | no |
Every time you make build
command for your project:
- CLI validates the config and applies all settings to the current project;
- CLI downloads minimized versions of htmx and hyperscript (from
official and trusted unpkg.com CDN) to the
./static
folder and places them as separated<script>
tags (at the bottom of the<body>
tag) in the Go HTML templatetemplates/main.html
; - CLI prepares a production version of the selected CSS framework and
places it as a
<link>
tag (at the bottom of the<head>
tag) in the Go HTML templatetemplates/main.html
; - If the
--skip-docker
option is not set, CLI generate a clear and well-documented Docker files (.dockerignore
,Dockerfile
,docker-compose.yml
) in the root of the project folder to deploy it in isolated containers via Portainer (recommended), or manually, to your remote server.
The gowebly
CLI has a library of user-friendly helpers
for your code. This will help you start building beautiful web applications
in Go even faster.
go get -u github.com/gowebly/helpers
π‘ Note: The
gowebly helpers
library is already included in the Go backend that is created by thecreate
command, but you can use these helpers in other projects as well.
Tell us, how often have you had to start a new project from scratch and had to make painful manual configurations? π€ Especially, when you are just getting acquainted with a new technology or stack, where everything is new to you.
For many developers, including us, this process is as tedious and even depressing as possible, and doesn't carry any useful workload. It is a very frustrating process that can push any developer away from technology a lot.
Why not just give all that awful manual work to machines? Let them do all the hard work for us, and we will just create awesome web products and not have to think about build and deploy.
That's why we created the gowebly
CLI and its helpers' library, which helps
you start an amazing web applications in Go using htmx,
hyperscript and popular atomic/utility-first CSS frameworks.
We are here to save you (and ourselves) from this routine pain! β¨
π¬ From the authors: Earlier, we have already saved the world once, it was Create Go App (yep, that's our project too). The GitHub stars statistics of this project can't lie: more than 2.2k developers of any level and different countries start a new project through this CLI tool.
And now, I invite you to participate in this project! Let's work together to create the most useful tool for developers on the web today.
- Issues: ask questions and submit your features.
- Pull requests: send your improvements to the current.
Your PRs & issues are welcome! Thank you π
gowebly
is free and open-source software licensed
under the Apache 2.0 License, created and supported by
Vic ShΓ³stak with π©΅ for people and robots. Official logo
distributed under the Creative Commons License (CC BY-SA
4.0 International).