| description | Quick start guide |
|---|
import StackBlitzGithub from '@site/src/components/StackBlitzGithub'; import ZModelStarter from '../_components/_zmodel-starter.md'; import PackageInstall from '../_components/PackageInstall.tsx'; import PackageExec from '../_components/PackageExec.tsx';
:::info All v3 packages are currently published under the "@next" tag. :::
There are several ways to start using ZenStack ORM.
Run the following command to scaffold a new project with a pre-configured minimal starter:
npm create zenstack@next my-projectOr simply use the interactive playground to experience it inside the browser.
To add ZenStack to an existing project, run the CLI init command to install dependencies and create a sample schema:
Then create a zenstack/schema.zmodel file in the root of your project. You can use the following sample schema to get started:
Finally, run zen generate to compile the schema into TypeScript. Optionally, run zen db push to push the schema to the database.
You can also always configure a project manually with the following steps:
- Install dependencies
<PackageInstall devDependencies={['@zenstackhq/cli@next']} dependencies={['@zenstackhq/runtime@next']} />
- Create a
zenstack/schema.zmodelfile
You can use the following sample schema to get started:
- Run the CLI
generatecommand to compile the schema into TypeScript
:::info
By default, ZenStack CLI loads the schema from zenstack/schema.zmodel. You can change this by passing the --schema option. TypeScript files are by default generated to the same directory as the schema file. You can change this by passing the --output option.
You can choose to either commit the generated TypeScript files to your source control, or add them to .gitignore and generate them on the fly in your CI/CD pipeline.
:::