A First Look at KeystoneJS
All of this project’s code can be found in the First Look monorepo on my GitHub.
KeystoneJS is a CMS for developers that provides a GraphQL API & Management UI for content and data based on your schema. In this tutorial we will use
create-keystone-app to scaffold a basic blog dashboard with users. In a future part we will deploy this project.
Create Keystone App
create-keystone-app is a CLI app for getting started with Keystone. It will generate a couple of files for you and install all the dependencies you need to run the Admin UI and start using the GraphQL API.
Give your project a name. Mine will be called
You can follow the first half of this guide to see how to spin up the database. The only important difference is when you copy your connection string from Railway, change the first part from
Your connection string will look like this with a password instead of
This will create the app and provide further instructions.
Develop Keystone App Locally
yarn dev to start your local development server.
This will run
Create a user
You are then asked if you want to sign up for the KeystoneJS newsletter. Bold move!!!
After you decide whether to reward such brash behavior you will be taken to the Keystone dashboard where you can view your users and posts.
You will see the user you initially created.
Create a Post
You will see that there are no posts yet. What ever shall we do?
After clicking “Create Post” you will be able to create a post.
Write a post. Make it a masterpiece.
Look back at your database to make sure it didn’t explode.
Query your GraphQL API
Open localhost:3000/api/graphql and run the following
Deploy Keystone App
Turns out deploying a Keystone app is kind of complicated unless you follow a separate guide called How to embed Keystone + SQLite in a Next.js app. If it’s possible to deploy this thing to Vercel, then in theory it should be possible to deploy it to Netlify. Tune in next time for that!
You can also view all the code for this project on my GitHub but if you clone it then it’s not actually gonna work if you try and spin it up cause by default
create-keystone-app hardcodes your
DATABASE_URL and figuring out how to make it work without doing that is kind of complicated.