-
Notifications
You must be signed in to change notification settings - Fork 1
core cli HowTo
This guide explains how to leverage the core CLI to build and structure your Quatrain applications effortlessly.
To start a new Quatrain project from scratch, use the scaffold command. This will generate a monorepo folder architecture ready to use.
npx @quatrain/core-cli scaffold MyProject
cd MyProject
yarn installWhat it does:
- Creates a
package.jsonfor Yarn Workspaces. - Sets up alias paths in
tsconfig.json. - Creates placeholder directories for
apps,packages,data, andconfig.
The @quatrain/app bootloader requires a quatrain.json file to auto-instantiate the required adapters.
Run the interactive wizard from the root of your new project:
npx @quatrain/core-cli generate configAnswer the prompts to select your preferred Backend (e.g., PostgreSQL), Authentication (e.g., Supabase), Storage, and Queue systems.
Resulting quatrain.json:
The file will contain configurations mapping to environment variables:
{
"backend": {
"adapter": "PostgresAdapter",
"package": "@quatrain/backend-postgres",
"config": {
"host": "env(PG_HOST)",
"port": "env(PG_PORT)"
}
}
}To safely upgrade the database schema, generate migration files directly from the CLI.
npx @quatrain/core-cli generate migration initialize_usersThis generates migrations/20260427XXXXXX_initialize_users.ts. Open this file and fill in the up() and down() functions using the Quatrain Backend singleton.
When developing or modifying the CLI locally, you can run and test the tool in several ways:
From the root of the Core monorepo:
yarn workspace @quatrain/core-cli core <command>
# Example:
yarn workspace @quatrain/core-cli core deployTo use the core command directly from any directory without installing it globally, add an alias to your Zsh configuration (~/.zshrc):
echo 'alias core="node /Users/crapougnax/CODE/QUATRAIN/Core/packages/core-cli/bin/core.js"' >> ~/.zshrc
source ~/.zshrcYou can then run:
core deployAlternatively, link the package to your global Node bin directory:
cd packages/core-cli
npm install -g .Note
When modifying TypeScript source files, make sure to compile them with yarn build or keep the compiler in watch mode with yarn wbuild inside the packages/core-cli directory.
Recommendation: Ensure that all logs, commit messages, console outputs, and code comments are written in International English. This convention aligns with the official Quatrain standard to support a globally distributed engineering team.