Skip to Content
Forest Releases September, 2025!
PackagesCreating Packages

Creating & Updating a Package

This section will cover how to create and upload your own packages to Forest PM.

Prerequisites

Before you can create and upload packages, you’ll need to have the following:

Creating a Package

Let’s say we want to create a package that provides a simple “Hello World” function.

Create a new directory for your package

    • init.lua

Create an init.lua file that contains our code

Your init file can be located anywhere within the first 2 levels of your package directory. Such as my-package/init.lua or my-package/src/init.lua
local function Speak() print("Hello, World!") end return Speak

Initialize our package with the Forest CLI

forest init

After selecting the appropriate options, this will create a forest.json file in our package directory.

This file contains metadata about our package, such as its name, version, and description. In most cases, you won’t need to manually edit this file.

Publish to Forest Package Manager

forest publish

This command will upload our package to Forest PM, making it available for others to install and use. If this is your first time publishing a package, you’ll be prompted to log in to your Forest PM account.

The CLI will ask you a few questions about your package, such as its visibility (public or private), name, description, version and License type.

Uploading a package with Dependencies

If your package relies on other packages to work, you can install those dependencies locally before publishing your package.

For example, if our package relies on a package called @forest/utils, we can install it locally like this:

forest i @forest/utils

Then, when we publish our package, the Forest CLI will automatically detect the dependency and include it in the forest.json file.

When someone installs your package, Forest PM will automatically install any of its dependencies.

Packages with dependencies will always have their /package folder at the same level as the init file. For example, if your init file is located at my-package/src/init.lua, your dependencies will be installed to my-package/src/packages/. This ensures your package can always find its dependencies, regardless of project structure

For Rojo users, default.project.json will be ignored.

Updating a Package

To update your package, simply make changes to your code, then run the forest publish command again.

The CLI will automatically increment the version number based on the changes you made (major, minor, or patch), and upload the new version to Forest PM.

For more information about how Forest PM handles versioning, see the SemVer  guidelines.

Last updated on