Boneless: a CLI to create your apps with Go
Tags: go, serviceweaver, fiber, gomigrate
Published: 2023-06-28 16:48:43

---
title: Boneless: a CLI to create your apps with Go
published: true
description: A CLI (Command Line Interface) to create your apps with Service Weaver, using gomigrate, sqlc, and Fiber.
tags: go, serviceweaver, fiber, gomigrate
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-06-28 03:02 +0000
---

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](https://github.com/renanbastos93/boneless): [Service Weaver](https://serviceweaver.dev/), [Go Migrate](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate#installation), [SQLC](https://docs.sqlc.dev/en/stable/overview/install.html), and [Fiber](https://gofiber.io/). 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.
```sh
$ go install -tags 'mysql sqlite3' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ go install github.com/sqlc-dev/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.
```sh
$ 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.
```sh
$ 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
```sh
$ 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:
```sh
$ boneless help
Usage: boneless [target]

Targets:
  help                                     Show commands for use
  version                                  Show version
  new  <sql|sqlite3>                       Create a project from scratch using Weaver, SQLC, and go-migrate
  create-scratch <sql|sqlite3>             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
  <sql|sqlite>                             Specify "sql" to use some SQL "sqlite3" to use sqlite3 and it is the default

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.