Introduction
Hello, friends! 😉 Today, I'd like to present you my own CLI for automation many things for starting a new project. I called it Create Go App (or CGAPP for short).
The main idea was to create a universal tool for full automation of the project start when you don't need to install everything you need separately.
What did it come out of? Let's look at it together!
📝 Table of contents
- Another CLI?
- How does it work?
- Available commands
- Available project templates
- Video screencast
- Your assistance to the project
Another CLI?
And yes and no.
When I started this project, I asked ourselves this question too and... came to the conclusion, that approximately 8 out of 10 routine operations at the start of a new project and/or the deployment of an existing one can be automated.
And it would be better to have all the necessary functions inside one CLI. That's why we transferred all our experience to the Create Go App, which we use ourselves!
So, yes, this CLI gives you the ability to prepare everything you need to start a new project (as create-react-app
for the React.js ecosystem does) and deploy an existing project to a remote server in configured and fully isolated Docker containers.
Focus on writing code and thinking of business logic! The Create Go App CLI will take care of the rest.
How does it work?
This is a common console utility, written on pure Golang. Therefore, download and install Go. Version 1.11 or higher is required. Next, download the latest version of the Create Go App and install to your system:
# Download
go get github.com/create-go-app/cli
# Install CLI
go build -i -o $GOPATH/bin/cgapp github.com/create-go-app/cli
If you don't want to install Create Go App CLI to your system, you feel free to using the Official Docker image:
docker run --rm -it -v ${PWD}:${PWD} -w ${PWD} koddr/cgapp:latest
With this Docker image, you don't have to worry about installing tools for supported frontend UI libraries or frameworks.
Two modes of work with the CLI
After installation, you will have two modes of work. Choose the one that suits you best, they work equally well.
- With an interactive console UI (or CUI for short):
cgapp [COMMAND]
- From configuration file (by default, in
.cgapp.yml
):
cgapp [COMMAND] --use-config
Available commands
You can see all available commands and options by running cgapp --help
.
I'd like to remind you, the best way to better explore all the features of an any tool is to read the Official Documentation.
-
init
— command for generate a default.cgapp.yml
config file:
cgapp init
-
create
— command to create a new project with the choosen configuration for backend (Golang), frontend (JavaScript or TypeScript) and deploy automation (through Ansible playbook and configuredDockerfile
) by CUI or config file:
cgapp create
-
deploy
— command for deploy Docker containers with your project to a remote server or local machine by CUI or config file:
cgapp deploy
Yes, you can run containers on your local machine too (if you've not skipped Ansible roles at cgapp create
step). All you have to do is define localhost
as your host.
Warning:
deploy
command is currently unavailable in Docker image.
Available project templates
At the moment, the official Create Go App templates are as follows:
- Backend: net/http, Fiber
- Frontend: React, Preact, Vue.js, Angular, Svelte, Sapper
- Web server: Nginx
New templates will be added as they are created. Write in comments, what templates you'd like to see in future.
But you can create your own templates and connect them in the configuration file (.cgapp.yml
) like this:
project:
- backend: github.com/user/my-template
- frontend: gitlab.com/user/my-template
- webserver: bitbucket.org/user/my-template
# ...
Video screencast
To make everything as clear as possible, I recorded a small video for you where I show the main functions and structure of the created project using the CLI:
Your assistance to the project
I'm always open to your suggestions, so please write in comments what to add or change in Create Go App project. This would really help me develop this awesome tool and make it even better and more useful for you!
Also, I'll be glad if you put a start and add this project to the list for notifications on project's GitHub repository:
Photos by
- Vic Shóstak https://github.com/create-go-app
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 (0)