docs/content/docs/getting-started.md
create-keystone-app is a CLI app that makes it easier for you to initiate a Keystone project.
It generates the files you need to run the Admin UI and start using the GraphQL API.
npm create keystone-app@latest
cd my-app
npm install
npm run dev
Open your preferred shell and make sure you’re in the folder you want to create your new project in.
create-keystone-app will generate a new folder with your new Keystone files in it.
npm create keystone-app@latest
Use npm's npx:
npx create-keystone-app@latest
The CLI will ask you to name your app. Once named, it will create a new SQLite database.
{% hint kind="warn" %} You can switch to another database such as PostgreSQL once your project is created, check out the docs on Database Setup. {% /hint %}
You can now cd into the folder that was created for you, install dependencies, and start Keystone:
cd my-app
npm install
npm run dev
This will generate the Admin UI pages via Next.js on http://localhost:3000. The first time the project starts, it creates an initial user and logs its email address and randomly generated password in the terminal.
Use those credentials to sign in. You’ll see a new Keystone Admin UI that comes with two lists. From here you can explore and interact with the data in your system, and understand how Keystone’s schema relates to your GraphQL API which you can explore at http://localhost:3000/api/graphql.
Keystone creates the following files in your newly generated folder. The most important ones are keystone.ts and schema.ts.
.
├── auth.ts # Authentication configuration for Keystone
├── keystone.ts # The main entry file for configuring Keystone
├── node_modules # Your dependencies
├── generated/prisma # Generated Prisma Client (ignored by Git)
├── package.json # Your package.json with three scripts prepared for you
├── package-lock.json # Your npm lock file
├── prisma.config.ts # Prisma CLI datasource and migration configuration
├── README.md # Additional info to help you get started
├── schema.graphql # GraphQL schema (automatically generated by Keystone)
├── schema.prisma # Prisma schema (automatically generated by Keystone)
├── schema.ts # Where you design your data schema
└── tsconfig.json # Your typescript config
package.json includes the following npm scripts you can run locally:
dev runs Keystone in development mode at http://localhost:3000.start runs Keystone in production mode.build will build the project and is required to be run before start.postinstall ensures files that Keystone generates exist and are kept up to date.{% hint kind="tip" %} Read more about the CLI in our command line guides. {% /hint %}
{% related-content %}
{% well
heading="Keystone CLI Guide"
href="/docs/guides/cli" %}
Keystone’s CLI helps you develop, build, and deploy projects. This guide explains all you need to standup a new backend in the terminal.
{% /well %}
{% well
heading="Lists API Reference"
href="/docs/config/lists" %}
The API to configure your options used with the list() function.
{% /well %}
{% well
heading="Config API Reference"
href="/docs/config/config" %}
The API to configure all the parts of your Keystone system.
{% /well %}
{% well
heading="DB API Reference"
href="/docs/config/config#db" %}
Configure Keystone to use another database to store data in your system.
{% /well %}
{% /related-content %}