gio add
Add starter features - Tailwind, an API route, authentication, a database, Docker, CI - to an existing GioJS app, without overwriting files you changed.
npx gio add tailwind authpnpm exec gio add tailwind authyarn gio add tailwind authbunx gio add tailwind authbash
gio add <feature...> [--cwd <dir>] [--dry-run] [--force]Reference
| Option | Type | Default | Description |
|---|---|---|---|
<feature...> (required) | string | - | One or more of tailwind, api, auth, db, docker, ci, as separate arguments or comma-separated. Aliases: tailwindcss; database, sqlite, drizzle for db; github-actions for ci. The create flags work too: --auth, --features auth,db. |
--cwd <dir> | path | . | The project directory. |
--dry-run | boolean | false | Show what would be created and updated; write nothing. |
-f, --force | boolean | false | Overwrite files and package.json scripts that differ from the feature's. |
-h, --help | boolean | - | Print create-giojs add's help, with the feature list, and exit with 0. |
Features
| Feature | Adds | Static sites |
|---|---|---|
tailwind | Tailwind CSS v4 through its CLI, rebuilt as you edit (npm run dev runs the watcher). | yes |
api | A JSON route.ts and a <GioForm> page action (/guestbook). | no |
auth | Cookie sessions, login and logout, a guarded /dashboard, a rate-limited /login. | no |
db | Drizzle ORM on Node's built-in SQLite, with migrations (Node 22.16+). | no |
docker | A production Dockerfile built with gio build standalone, plus docker-compose.yml. | no |
ci | A GitHub Actions workflow: install, typecheck, test and build on every push. | yes |
Features are always applied in that order, whatever order you name them in. The Starter Features page lists every file each one writes.
Behavior
gio add runs create-giojs add with your arguments, finding create-giojs the way gio migrate does (installed copy first, else the same version through npx / pnpm dlx / bunx, never a release without the subcommand). Then:
- It reads the project:
package.jsonmust exist, with agio.tomlor anapp/directory. TypeScript or JavaScript comes fromtsconfig.json/jsconfig.json; abuildscript runninggio exportmarks a static site; the package manager comes from the lockfile. - It plans the whole run. A feature that is already set up (all its files exist) keeps your edits and changes nothing. For a new feature, a file of yours in its way is a conflict, and the run stops before anything is written, with a diff.
- It writes the files, merges
package.jsondependencies and scripts, addsgio.tomltables and keys (a project withoutgio.tomlgets one),.envlines,.gitignorelines and a note inAGENTS.md, then prints the next steps.
Examples
Preview a feature
text
$ npx gio add docker --dry-run
Would create:
docker-compose.yml
.dockerignore
Dockerfile
Would update:
AGENTS.md
Next steps:
Docker:
- docker compose up --build (or: docker build -t my-app .)
- Server secrets go in .env.production.local (git- and docker-ignored), which docker-compose.yml passes to the container.Add a feature
text
$ npx gio add api
Did create:
components/forms.css
app/(site)/guestbook/page.tsx
app/api/guestbook/route.ts
lib/guestbook.server.ts
Did update:
AGENTS.md
Next steps:
API route + form:
- Open /guestbook for the form; the same entries are JSON at /api/guestbook.When a feature adds dependencies, the output ends with the install command to run (Run `npm install` to install ...); gio add does not install them itself.
A conflict
text
$ npx gio add docker
Nothing was written - these files differ from what the feature adds:
Dockerfile: exists with different content
- FROM node:22
+ # syntax=docker/dockerfile:1
+ # Production image for my-app: `gio build standalone` packs the app
...
Keep your version (rename or merge it by hand), or rerun with --force to overwrite.Run it again
text
$ npx gio add auth
Authentication is already set up - nothing to change.Good to know
- Exit codes:
0when the features were added (or previewed, or were already there);1when the run was refused - a conflict, a server feature for a static site, no project in the directory;2for an unknown option or feature, or no feature at all. - A server feature on a static site is refused:
Cannot add auth to a static site: it needs the GioJS server (build: gio export has none). --forceoverwrites conflicting files, but not a page of yours that serves the same URL from another folder: that conflict needs a manual fix.- Feature pages go into the
app/(site)/route group and importlib/by relative path, so a@/*alias of yours does not break them.
Related
- Starter Features
create-giojs addand the create-time flags- Guides: Tailwind, Authentication Example, Database, Docker
Version history
| Version | Changes |
|---|---|
v0.1.0-beta.8 | Introduced. |