@clearcms/create
v0.4.0
Published
Scaffold a self-contained clear-powered site (admin + Astro frontend in one project).
Readme
@clearcms/create
Scaffold a self-contained clear-powered site.
npx @clearcms/create my-blog
cd my-blog
pnpm install
pnpm devTwo processes start:
- Admin (
@clearcms/admin) onhttp://localhost:3001 - Astro frontend on
http://localhost:4321
Both read/write the same ./data/storage/ bucket. Files are the source of truth. The SQLite index at ./data/clear.db is derived.
On first boot the admin auto-bootstraps (migrate + seed), prints a generated owner password if CLEAR_OWNER_PASSWORD is unset, and you're editing in seconds.
What gets generated
my-blog/
├── package.json admin + frontend deps in one
├── astro.config.mjs static output, fs-backed
├── data/ gitignored — created on first boot
├── public/
├── src/
│ ├── content.config.ts Astro Content Layer wired to the bucket
│ ├── layouts/Base.astro
│ ├── pages/index.astro lists `posts`
│ └── pages/[...slug].astro single-item route
├── .env.example
├── .gitignore ignores /data, /dist, /.astro, etc.
└── README.mdThe generated package.json runs admin + site together via concurrently:
"scripts": {
"dev": "concurrently -n admin,site -c blue,green -k \"pnpm dev:admin\" \"pnpm dev:site\"",
"dev:admin": "clear-admin start",
"dev:site": "astro dev",
"build": "CLEAR_BACKEND=fs CLEAR_BUCKET_ROOT=./data/storage astro build"
}Options
npx @clearcms/create <target-dir> [options]
--force Overwrite a non-empty target directory
--no-install (cosmetic) Skip the install hint in the next-steps banner
-h, --help Show this help<target-dir> is required. The directory's basename is normalized to a valid npm package name and substituted as the project name in package.json and README.md.
No git init, no auto-install — same convention as create-astro / create-next-app. Run git init and pnpm install yourself.
Two paths
- Single-site (this scaffolder) — for one project, one bucket, one admin. The default. The whole site is one repo you can commit, version, and deploy as a unit.
- Multi-project — for agencies / hosts running 5+ sites side-by-side. Lives upstream in the
clearcms/cloudrepo: a console UI that orchestrates manyclear-adminprocesses against a central registry at~/clear/registry.json.
The two paths share the same content protocol and the same admin code — @clearcms/create produces a project that uses @clearcms/admin exactly as the cloud console does when it spawns clear-admin start per project. Switching between the two later is just a matter of moving the ./data/ directory.
Workspace note
When developed inside the clear-platform monorepo, generated package.json deps stay as workspace:* so pnpm install resolves locally. When publishing to npm, pnpm rewrites those to real semver ranges at publish time.
