Welcome to KeystoneJS! This quick start guide will get you up and running in just a few minutes. Let's build a simple Todo app with a fresh install of Keystone!
Before we start, make sure that you have a basic development environment set up, with the following tools installed on your system.
- yarn or npm: yarn and npm are different package managers which can be used to install Keystone.
$ node --version v12.11.0 $ npm --version 6.9.0 $ yarn --version 1.17.3
You will also need to have a database for Keystone to store your application data in.
You can use either
- MongoDB >= 4.x: MongoDB is a powerful NoSQL document storage database.
- PostgreSQL >= 9.x: PostgreSQL is an open source relational database that uses the SQL language.
Follow the database setup instructions to install and configure your database, and to find out what your
connection string is.
Important: You will need to make sure you have a valid
connection stringfor your database in order to set up Keystone.
To create a new Keystone application, run the following command in your terminal:
npm init keystone-app my-app # or yarn create keystone-app my-app
You'll be prompted with a few questions:
- What is your project name? Pick any name for your project. You can change it later if you like.
- Select a starter project. These are some preconfigured projects you can use as the base of your own application. Select the
Todoapplication if you wish to follow the rest of the Keystone tutorials.
- Select a database type. Choose between
- Where is your database located? Provide the
connection stringfor your database.
- Test your database connection. Test that Keystone can connect to your database.
Once you have answered these questions, Keystone will be installed in a project directory. This will take a few minutes, as there are a number of dependencies which need to be downloaded and installed.
Once your project has been set up you should move into its directory so that you can start using it
If you are using
PostgreSQL then you will need to create the tables in your database for Keystone to use.
yarn create-tables # or npm run create-tables
You can now start your development server with the following command:
yarn dev # or npm run dev
If you run into database related errors at this stage, follow the Database Setup and Adapters instructions.
You are now running your very own Keystone application! Here's what you get out of the box:
Your simple todo application is up and running:
Your application also has an Admin UI, which lets you directly manipulate the data in your database:
Both your application and the Admin UI are powered by a GraphQL API. Keystone provides a web interface for this API at this URL:
This todo app is a good introduction to Keystone, but chances are you'll want to build something a bit more complex and secure than that!