Change a project
Add, remove, or switch modules and mobile apps, and upgrade to a newer Starter release, while keeping your edits.
Inside a project created by the CLI, add and remove change modules and, from CLI 0.46.0, the apps installed on devices, and upgrade moves the project to a newer Starter release. Projects from Starter v0.8.0 on have a clubedge script, so pnpm clubedge add cache redis works too. Without a module or option, add and remove ask for them, with a list where you can pick several modules at once (space to pick, enter to confirm); add then asks for each one's option, and the changes apply together.
Inside the project, use its clubedge script:
# Choose a module and option from a list
pnpm clubedge add
# Add or switch a module (also: add auth better-auth)
pnpm clubedge add cache redis
# Remove a module
pnpm clubedge remove storage
# Several modules as one change
pnpm clubedge add email resend payments stripe
pnpm clubedge remove storage payments
# The native app, or the website packaged as an app, and back
pnpm clubedge add mobile expo
pnpm clubedge add shell capacitor
pnpm clubedge remove mobile
# Preview a change without writing anything
pnpm clubedge add infra local --dry-runOr run the CLI directly, for example on projects from before Starter v0.8.0, or to upgrade with the newest CLI:
# Add, remove, or preview the same way
pnpm dlx @clubedge/create-clubedge-app add cache redis
pnpm dlx @clubedge/create-clubedge-app remove storage
# Upgrade to the newest CLI's Starter release
pnpm dlx @clubedge/create-clubedge-app@latest upgrade
# Or to a specific tag, branch, or commit
pnpm dlx @clubedge/create-clubedge-app upgrade --ref v0.23.0Apps installed on devices
From CLI 0.46.0, add and remove also take the apps that run on phones rather than on a server: the native app (add mobile expo) and the mobile app that packages the website (add shell capacitor). A project created without them can take them, and drop them again, without starting over. The framework and the API stay as the project was created, since its deployment and data are built around them.
-
Adding an app brings its folder, its CI job and the rest of the Starter's sections for it, its release workflow, its dependencies in
pnpm-lock.yaml, and its local env file, made from its example as a new project's is.package.jsonrecords it in"apps", so later changes and upgrades keep it. -
The app must fit the project: the native app calls an API, so it needs
--framework viteornonewith an API, and the mobile app packages the Vite frontend. When the project can't take an app, the CLI says which project can:Expo calls the project's API, and this project has none: Next.js serves its own pages. A project's framework and API are chosen when it is created, so add cannot change them: for Expo, create a project with --framework vite or none, and --api hono or fastapi. -
An app implements the modules it uses, such as the native app's sign-in. When the project's option is one it lacks, switch it in the same command:
pnpm clubedge add mobile expo auth better-auth. -
Removing an app deletes the Starter's files for it, and leaves what was never the Starter's: its env file, its
node_modules, and the mobile app'sandroid/andios/projects. The CLI lists them, to delete once you no longer need them.
Interactive add and remove list the apps next to the modules; with one app that fits, add mobile takes it without asking.
Before you run it
The project must be a Git repository without uncommitted changes, so you can review the result with git diff and undo it. Commit first. Outside Git, an interactive run asks whether to continue, since the change can't be undone; with --yes or in a script, it refuses. Pass --force to skip these checks, and --dry-run to preview the change without writing anything.
A command that would change nothing says so before these checks, without downloading the Starter (CLI 0.43.0 or newer). That covers add with an option the project already uses, remove of a module that is already none, and upgrade without --ref on a project already on this CLI's Starter release.
How the change is merged
The CLI renders the project twice, from the Starter commit and modules recorded in your package.json and from the new state, and merges the difference into your project. The new state has other modules for add and remove, and the newer Starter with the same modules for upgrade. Modules a newer Starter introduces start as none where possible, so an upgrade never adds a service on its own.
- Files you never changed are updated, added, or deleted.
- Files you changed keep your edits. Where the module change touches the same lines, the file gets conflict markers for you to resolve.
- Your own files are never touched.
- The root
package.jsonkeeps the project'sversion, so it no longer conflicts with every Starter release (CLI 0.41.0 or newer). New projects start at0.1.0. - Each app's
package.jsonkeeps aversionyou changed, without a conflict on that line. An app whose version you never changed takes the new Starter's (CLI 0.43.0 or newer). - A
README.mdyou replaced with your own, without the generated## Generated fromsection, is kept as it is (CLI 0.41.0 or newer). The Starter's new README goes to.clubedge/incoming/README.md, to compare. - Each app's env file (
apps/web/.env.local, andapps/api/.env.localwith a separate API,apps/mobile/.env.localwith a native app, orapps/shell/.env.localwith a mobile app) keeps your values. Values still at their generated defaults follow the new selection, and new variables are added. - A project without a website stays without one: its
package.jsonrecords"framework": "none", so the website's default never comes back (CLI 0.44.0 or newer). pnpm-lock.yamlis replaced if you never changed your dependencies; otherwisepnpm installreconciles it.
Conflicts look like this:
<<<<<<< yours
your version of the lines
=======
the Starter's version of the lines
>>>>>>> clubedgeSeveral modules in one command are applied as one change, and their requirements are checked together, so add auth supabase storage supabase works even though Supabase Storage needs Supabase Auth. When lines conflict, the CLI lists each file with its number of conflict blocks, and saves the Starter's whole new version of each in .clubedge/incoming/, to compare with yours:
git diff --no-index apps/web/src/app/page.tsx .clubedge/incoming/apps/web/src/app/page.tsxGit ignores .clubedge/, so it never shows in git status or a commit; each change replaces the previous change's files, and you can delete the folder when you are done. Files left for you to check by hand get the Starter's version there too, when it has one. Before an upgrade, it lists the Starter releases it crosses with the sections of their release notes, such as v0.13.0 Observability, Tests, Also.
From a local Starter checkout
To try Starter changes on a real project before releasing them, pass --template-dir:
# add and remove: render the project's own Starter from the checkout
pnpm clubedge add auth better-auth --template-dir ../clubedge-starter
# upgrade: the checkout is the Starter to upgrade to
pnpm clubedge upgrade --template-dir ../clubedge-starterWith add and remove, the checkout should be at the commit the project records. That is also how to change a project that records no Starter commit. With upgrade, the project's own Starter still comes from GitHub. --ref applies only to upgrade, and not together with --template-dir.
After the change
The CLI runs pnpm install unless you pass --no-install. Then, if the change added tables or services:
pnpm db:migrate
pnpm check:servicesReview the result with git diff, resolve any conflict markers, and commit.
pnpm cannot read a package.json with conflict markers. When a change leaves them in one, the CLI skips pnpm install and says why (CLI 0.41.0 or newer): resolve the markers, then run pnpm install. Until then, pnpm commands fail, pnpm clubedge among them. Run the CLI directly instead, such as pnpm dlx @clubedge/create-clubedge-app status: it names the file and prints the git diff --no-index command that compares it with the Starter's version in .clubedge/incoming/. The list of conflicts always prints, even when pnpm install fails for another reason; the CLI then exits with an error.
A change that leaves conflicts exits with 0, like a clean one. For scripts that need to tell them apart, pass --detailed-exit-code (CLI 0.41.0 or newer): the CLI then exits with 2 when the change left conflicts to resolve, 0 when it was clean or there was nothing to change, and 1 when it failed.
Upgrades as pull requests
Projects from Starter v0.16.0 on have .github/workflows/clubedge-upgrade.yml. Every Monday, or when you run it from the Actions tab, it runs upgrade with the newest CLI; when a newer Starter release is out, it opens a pull request with the merged change, the updated lockfile, a link to the release notes, and the files with conflict markers. The Starter's versions of conflicted files are kept as the run's starter-versions artifact, and your CI tests the pull request before you merge it. It opens one pull request per release; delete the file to turn it off.
From Starter v0.26.1, the workflow runs upgrade --detailed-exit-code (CLI 0.41.0 or newer) and also opens the pull request when a package.json has conflict markers, listing it with the other conflicted files; before, conflicts in the root package.json stopped the run without one. pnpm cannot read that file, so the lockfile is not updated: resolve the conflicts on the pull request's branch, then run pnpm install and commit pnpm-lock.yaml. Any other failure stops the run without a pull request.
It needs Settings → Actions → General → Allow GitHub Actions to create and approve pull requests, or a CLUBEDGE_UPGRADE_TOKEN secret (a fine-grained token with contents and pull requests write), which also lets the pull request start your CI by itself. Projects created before v0.16.0 get the workflow with their next upgrade, and older versions of it are updated the same way.
For every repository at once
Clubedge Starter Cloud opens these pull requests without the workflow or a token: install its GitHub App on the repositories made with the Starter, and when the CLI moves to a newer Starter release, each one gets a pull request with the same upgrade, which starts your CI like any other. It adds a policy for which releases to take and who reviews them, email and Slack notifications, and a dashboard; public repositories are free. See how its upgrades work.
How is this guide?