4

Boneless: a CLI to create your apps with Go

 1 year ago
source link: https://dev.to/renanbastos93/boneless-a-cli-to-create-your-apps-with-go-31kh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
renanbastos93

Posted on Jun 28

• Updated on Jun 30

9 1 1 1 3

Boneless: a CLI to create your apps with Go

Boneless is a powerful tool that offers a wide range of features to facilitate application development. In this blog post, we will explore some essential tools that can be used in conjunction with Boneless: Service Weaver, Go Migrate, SQLC, and Fiber. Let's discover how these tools can boost productivity and efficiency in application development.


After setting the context and providing a comprehensive introduction, we will demonstrate how to use our CLI. First, we need to install the necessary CLI tools.


By the way, first, we need to install the binary of Service Weaver, Go Migrate, SQLC, and Boneless. Even so, I suggest you read the documentation of all of them on your official websites.

$ brew install golang-migrate # in other OS we can to check doc from go migrate
$ go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
$ go install github.com/ServiceWeaver/weaver/cmd/weaver@latest
$ go install github.com/renanbastos93/boneless/cmd/boneless@latest

Well, let's go on an adventure


Create scratch project

Always remember to check the available methods by executing boneless help. After that, we can proceed to create a new folder and a go.mod file.

$ mkdir -p myapp
$ cd myapp
$ go mod tidy myapp

# "Now we can start utilizing commands from Boneless
$ boneless create-scratch

After creating the project, we can go ahead and execute it.

$ SERVICEWEAVER_CONFIG="./weaver.toml" boneless run

Adding a New app

If you want to add a new component to your application built with Boneless, the process is straightforward. Here are the steps you can follow

$ boneless create-app user

After that, you need to make changes according to your requirements.

In addition, there are other Boneless commands available that you can use when they are truly necessary. See below:

$ boneless help
Usage: boneless [target]

Targets:
  help                                     Show commands for use
  version                                  Show version
  create-scratch                           Create a project from scratch using Weaver, SQLC, and go-migrate
  build                                    Build the Weaver component with SQLC
  make-migrate <app-name> <name>           Create a new migration for an app
  migrate <app-name> <up|down>             Run migrations for an app
  create-app <app-name>                    Create a new app based on a template
  build-app <app-name>                     Build an app using Weaver and SQLC
  run                                      Run the project using Weaver

Parameters:
  <app-name>                               Name of the app to create or run migrations on
  <name>                                   Name of the migration to create
  <up|down>                                Specify "up" to apply migrations or "down" to rollback migrations

Examples:
  boneless help
  boneless version
  boneless create-scratch
  boneless build
  boneless make-migrate my-app migration-name
  boneless migrate my-app up
  boneless create-app my-app
  boneless build-app my-app
  boneless run

Conclusion

In summary, we have explored the powerful tools available for application development using Boneless. We discussed the Command Line Interface (CLI) that facilitates the creation of web applications, along with Service Weaver, Go Migrate, SQLC, and Fiber. These tools provide essential features to boost productivity and efficiency in developing distributed applications, managing database migrations, generating secure code, and building fast web applications.

By utilizing these tools together, developers have a wide range of resources at their disposal to create robust, scalable, and secure applications. Through the Boneless CLI, you can initiate projects, manage database migrations, and leverage the benefits of Service Weaver and Fiber to build efficient and responsive APIs.

We hope this article has provided a comprehensive overview of these tools and sparked your interest in further exploring the potential of Boneless and its components. With the right combination of tools and knowledge, you will be well-positioned to develop high-quality web applications.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK