Introduction
Hey, my DEV friends! 👋
It's been a while since I've been here, hasn't it? Sorry I've been missing, but there was a good reason... one of which I'm going to talk about in this article.
So, here is a new CLI tool that I have named gowebly 👇
📝 Table of contents
- What is gowebly?
- What is the enjoyment of using it?
- Motivation in CLI creation
- Mutually beneficial cooperation
What is gowebly?
It's a next-generation CLI tool that makes it easy to create amazing web applications using Go on the backend (net/http, Fiber, Echo, chi, etc.), htmx and hyperscript, and the most popular atomic/utility-first CSS frameworks (Tailwind CSS, UnoCSS, etc.) on the frontend.
Fully configured Docker files, as well, are included in your project.
gowebly / gowebly
🔥 A next-generation CLI tool that makes it easy to create amazing web applications with Go on the backend, using htmx, hyperscript or Alpine.js, and the most popular CSS frameworks on the frontend.
The Gowebly CLI
A next-generation CLI tool that makes it easy to create amazing web applications
with Go on the backend, using htmx, hyperscript or Alpine.js,
and the most popular CSS frameworks on the frontend.
↘ The official Gowebly CLI documentation ↙
English · Русский · 简体中文 · Español
↘ Share the project's link to your friends ↙
✨ Features
- 100% free and open source under the Apache 2.0 license.
- For any developer's level of knowledge and technical expertise, as the intelligent CLI does most of the routine project setup for you, creates an understandable structure, and prepares code for use and deployment in production.
- Cross-platform and multi-architecture allows successful running on any GNU/Linux distros, Microsoft Windows (including WSL) and Apple macOS.
- Well-documented, includes translations in many other languages (Русский, 简体中文, Español).
- Enables you to start a new project faster with Go…
What is the enjoyment of using it?
The main purpose of gowebly
CLI is to make it easier to create a new project. And it does this very well! But it's better to see it once than to hear it a hundred times:
The first thing you need to do is to install it. This can be done via:
- Homebrew (for GNU/Linux and Apple macOS users);
- Native Go installation (any platforms);
- Docker image (any platforms);
- Downloading a ready-made executable (any platforms).
💡 Note: No matter how exactly you want to install the
gowebly
CLI, it will work fine either way.
Once the gowebly
CLI is installed on your system, the following commands are available to you: init
, create
, run
, and build
.
Let's take a closer look at them 😊
💡 Note: Also, keep in mind that the documentation of the
gowebly
project has already been translated to: Русский, 中文 and Español.And the original language, of course, English.
init
command
Command to create a default config file (.gowebly.yml
) in the current folder.
Every time you make gowebly init
command in the empty folder:
- CLI validates the current folder;
- CLI creates a default
.gowebly.yml
config file.
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
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 |
create
command
Command to create a new project with the Go backend, htmx & hyperscript, and (optionally) atomic/utility-first CSS framework.
💡 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.
Every time you make gowebly 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
run
command
Command to run your project in a development (non-production) mode.
💡 Note: If you don't run
init
command to create a config file (.gowebly.yml
), thegowebly
CLI runs your project with a default configuration.
Every time you make gowebly 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.
build
command
Command to build your project for production and prepare Docker files for deploy.
💡 Note: If you don't run
init
command to create a config file (.gowebly.yml
), thegowebly
CLI builds your project with a default configuration.
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 gowebly 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.
Motivation in CLI creation
Tell me, 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 me, 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 I 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.
I am here to save you (and myself) from this routine pain! ✨
Earlier, I have already saved the world once, it was Create Go App (yep, that's my 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.
Mutually beneficial cooperation
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 😘
Photos and videos by
- Vic Shóstak https://github.com/koddr
P.S.
If you want more articles (like this) on this blog, then post a comment below and subscribe to me. Thanks! 😻
❗️ You can support me on Boosty, both on a permanent and on a one-time basis. All proceeds from this way will go to support my OSS projects and will energize me to create new products and articles for the community.
And of course, you can help me make developers' lives even better! Just connect to one of my projects as a contributor. It's easy!
My main projects that need your help (and stars) 👇
- 🔥 gowebly: A next-generation CLI tool that makes it easy to create amazing web applications with Go on the backend, using htmx, hyperscript or Alpine.js and the most popular CSS frameworks on the frontend.
- ✨ create-go-app: Create a new production-ready project with Go backend, frontend and deploy automation by running one CLI command.
Top comments (9)
Cool! I've been on a similar journey from server-rendered PHP, to React and now considering if the complexity cost of single-page-applications is too high; I recently played around with Go templates and HTMX.
Any plans for using the "embed" package for building, instead of building containers? The only thing easier than deploying a container, is deploying a single binary.
Is there a non-trivial example with server-side-rendering, database and all that good stuff? Preparing the data for the templates, was the most challenging part in my experiments, and having something like file-based-routing, would be nice too.
Hi,
Glad to hear such a good review of my work! Thank you.
Could you please clarify what is meant by embedded delivery? How would you like to see it?
Basically, I could add functionality to the CLI so that the final build (both frontend and backend) is immediately available in a single binary file to simply run on the server if the Docker option is not suitable for the user.
Just something like a “package” command that embeds all of the pages and assets inside a binary file. Go can already do this.
I think that’s a much more sensible way of default deployment
Isn’t HTMX a last-generation thing? I remember some websites were using this kind of stuff many years ago.
For me, htmx is a breath of fresh air in the world of complex frontend. I love frontend (and everything related to it), but I've always been uncomfortable customizing a workspace for React/Vue to do simple things in HTML templates.
✨ Now simple (and truly reactive) things can be done without knowing JS at all, just with htmx + hyperscript ✨
And that's super cool, in my opinion!
Super cool and interesting article! Also I really like your style, keep posting!
Thanks 😘
**Super Duper! **My friend this is an excellent job you did... liked it a lot.... I have bee trying with it and the cli is what you promise.... Good Work!
Thanks for the feedback! It helps me make the product even better every day.
I can't wait to see the projects you create! Post links to their repositories or URLs in the comments. I'm very interested! 😊