This documentation is in the BETA stage, and the API is subject to change. Please reach out to us if you want to try it out or have any feedback.

Packages

Create and share code across your projects

You can turn anything you build into a package and reuse it across all your projects. A package is just a collection of components, utilities, assets, and configuration that you can easily share and bring into other projects whenever you need them. It’s a bit like Git Submodules, but without the friction, and much more focused on how you actually work day to day.

Begin small

Just run conf pkg:init your-organization/color inside your project. This creates a package right in your codebase, without any external repository or versioning setup.

Reuse across projects

Once your package starts to take shape, you can easily reuse it in other projects.

When you’re ready to share it, run conf pkg:push your-organization/color. This pushes your package to a remote repository so it can be used elsewhere. From that point on, you can keep improving it and push updates whenever you make changes.

In other projects, you can pull it in with conf pkg:pull your-organization/color. That way, you always stay in sync without copying files or duplicating work.

Note that all changes in the /pkg directory are also committed in the main repository. Confetti synchronizes these commits to the remote repository using Git Subtree. We know this approach can be a bit controversial, but it allows packages to evolve over time and be published later on. If you prefer, you can also share your package through Packagist. In that case, it can be installed via Composer, and it will live in your vendor directory instead of pkg.

Get code from a specific project

Let’s keep it realistic: maintaining a separate repository for every small internal package isn’t always practical. Most of the time, packages grow naturally from project to project. With Confetti CMS, you can easily reuse code directly from another project. For example, you can pull a package straight from a project using:

conf pkg:pull your-organization/the-big-shop/pkg/your-organization/color

This makes it easy to promote code from project to project as it matures, without needing to set up a dedicated repository upfront.

Keep your code isolated

Sometimes you want your package to behave like a small, self-contained service.

If you add a Dockerfile, Confetti CMS will automatically build and run it for you. For example, the pkg/confetti-cms/image/container/Dockerfile runs a lightweight Go server that can store and modify images.

With Dockerfile.json5, you can configure how your package interacts with the rest of your project. In this example, uploaded files are shared with the web server, keeping everything connected without tight coupling (requested by view.Dockerfile.json5 in the root of the project).

Another example is the website/tailwind.Dockerfile file, which runs Tailwind in a development stage (FROM alpine:3.21 as development-cmd) and a production stage (FROM alpine:3.21 as production-cmd). You can configure multiple development and test environments by updating the config.json5 file in the root of the project.

Sell your package

Eventually, we will allow you to sell your package on a Confetti CMS marketplace. This way, you can monetize your code and assets by selling them to other developers. As a SaaS company, the buyer can’t see your code. Since AI can legally use a “clean room” approach to reverse engineer your code, it is necessary to protect your code more than ever.

Let's Join the Waitlist