---
title: Publishing to ForgeBox
summary: Package your project, log in, and publish it to ForgeBox with versioning.
icon: phosphor-duotone:rocket-launch
tags: [course]
---

Any folder with a `box.json` is a package. In this lesson you will describe your package, bump its version and publish it to [ForgeBox](https://forgebox.io) so anyone can install it.

## Describe the package

Run `package init` in the project root to create a `box.json`. Set the fields ForgeBox needs.

```bash
box package init slug=my-package type=modules
```

```json title="box.json"
{
    "name": "My Package",
    "slug": "my-package",
    "version": "1.0.0",
    "type": "modules",
    "ignore": [
        "**/.*",
        "test",
        "tests"
    ]
}
```

- `slug` is the unique id people use to install it.
- `type` tells ForgeBox and CommandBox what kind of package this is, for example `modules`.
- `ignore` lists files left out of the published zip.

ForgeBox also reads a `readme`, `instructions` and `changelog` file from your project (`.md` or `.txt`) for the package page.

## Version, log in, publish

::: stepper
::: step "Bump the version"
```bash
box bump --patch
```
Use `--minor` or `--major` for bigger changes. In a clean Git repo this also creates a tag.
:::
::: step "Log in to ForgeBox"
```bash
box forgebox login
```
You need a free account from forgebox.io.
:::
::: step "Publish"
```bash
box publish
```
If the version already exists, its metadata is updated. If it is new, it is added.
:::
:::

## Check it

```bash
box forgebox show my-package
box install my-package
```

!!! note "Private packages"
    Add `--private` to `package init` to create a package only you can see.

## Recap

- A package is a folder with a `box.json` that has `name`, `slug`, `version`, `type` and `ignore`.
- `box bump` changes the version using semantic versioning.
- `box forgebox login` then `box publish` puts your package on ForgeBox.
