Convert Figma logo to code with AI

keystonejs logokeystone

The superpowered headless CMS for Node.js β€” built with GraphQL and React

9,122
1,143
9,122
132

Top Related Projects

62,681

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.

27,065

The Modern Data Stack 🐰 β€” Directus is an instant REST+GraphQL API and intuitive no-code data collaboration app for any SQL database.

23,131

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

5,149

Sanity Studio – Rapidly configure content workspaces powered by structured content

17,783

A Git-based CMS for Static Site Generators

Quick Overview

Keystone is a powerful and flexible headless CMS and application framework built with Node.js, GraphQL, and React. It provides a scalable and customizable solution for content management, allowing developers to create robust web applications and APIs with ease.

Pros

  • Highly customizable and extensible architecture
  • Built-in GraphQL API for efficient data querying and manipulation
  • Powerful Admin UI for content management out of the box
  • Supports various database backends, including MongoDB and PostgreSQL

Cons

  • Steeper learning curve compared to some simpler CMS solutions
  • Documentation can be overwhelming for beginners
  • Limited themes and templates available for quick setup

Code Examples

  1. Defining a Keystone schema:
import { list } from '@keystone-6/core';
import { text, relationship } from '@keystone-6/core/fields';

export const lists = {
  User: list({
    fields: {
      name: text({ validation: { isRequired: true } }),
      email: text({ isUnique: true, validation: { isRequired: true } }),
      posts: relationship({ ref: 'Post.author', many: true }),
    },
  }),
  Post: list({
    fields: {
      title: text(),
      content: text({ ui: { displayMode: 'textarea' } }),
      author: relationship({ ref: 'User.posts' }),
    },
  }),
};
  1. Querying data using the GraphQL API:
query {
  users {
    name
    email
    posts {
      title
    }
  }
}
  1. Customizing the Admin UI:
import { config } from '@keystone-6/core';

export default config({
  ui: {
    isAccessAllowed: (context) => !!context.session?.data,
  },
  // ... other configuration options
});

Getting Started

To get started with Keystone, follow these steps:

  1. Install Keystone:
npm init keystone-app my-app
  1. Navigate to the project directory:
cd my-app
  1. Start the development server:
npm run dev
  1. Open your browser and visit http://localhost:3000 to access the Admin UI.

  2. Begin defining your schema and customizing your application in the schema.ts file.

Competitor Comparisons

62,681

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.

Pros of Strapi

  • User-friendly admin panel with a visual content builder
  • Extensive plugin ecosystem for easy customization
  • Built-in authentication and user management system

Cons of Strapi

  • Less flexible data modeling compared to Keystone
  • Higher resource consumption, especially for larger projects
  • Steeper learning curve for developers new to Node.js

Code Comparison

Strapi (Content-Type definition):

module.exports = {
  attributes: {
    title: {
      type: 'string',
      required: true,
    },
    content: {
      type: 'richtext',
    },
  },
};

Keystone (Schema definition):

const { Text, Relationship } = require('@keystonejs/fields');

module.exports = {
  fields: {
    title: { type: Text, isRequired: true },
    content: { type: Text, multiline: true },
  },
};

Both Strapi and Keystone are powerful headless CMS solutions, but they cater to different needs. Strapi excels in providing a user-friendly interface and quick setup, making it ideal for content managers and smaller projects. Keystone, on the other hand, offers more flexibility in data modeling and is better suited for complex, custom applications. The code comparison shows that both systems use JavaScript for configuration, but Keystone's approach is more code-centric, while Strapi leans towards a more declarative style.

27,065

The Modern Data Stack 🐰 β€” Directus is an instant REST+GraphQL API and intuitive no-code data collaboration app for any SQL database.

Pros of Directus

  • User-friendly interface with a modern, intuitive design
  • Supports multiple database types (MySQL, PostgreSQL, SQLite, etc.)
  • Built-in REST and GraphQL APIs for easy integration

Cons of Directus

  • Less flexible for custom backend logic compared to Keystone
  • Steeper learning curve for developers familiar with Node.js frameworks
  • Limited extensibility options compared to Keystone's plugin system

Code Comparison

Directus (REST API example):

const { Directus } = require('@directus/sdk');
const directus = new Directus('https://api.example.com');

const items = await directus.items('articles').readByQuery({
  limit: 5,
  sort: '-date_created'
});

Keystone (GraphQL API example):

const { gql } = require('@keystone-6/core');

const GET_ARTICLES = gql`
  query {
    articles(orderBy: { createdAt: desc }, first: 5) {
      id
      title
      content
    }
  }
`;

const articles = await context.query.Article.findMany({
  orderBy: { createdAt: 'desc' },
  take: 5,
});

Both Directus and Keystone offer powerful headless CMS capabilities, but they cater to different developer preferences and project requirements. Directus excels in user-friendliness and database flexibility, while Keystone provides more control over backend logic and extensibility.

23,131

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

Pros of Payload

  • More flexible and customizable admin UI
  • Better TypeScript support and type safety
  • Simpler setup and configuration process

Cons of Payload

  • Smaller community and ecosystem compared to Keystone
  • Less mature and fewer out-of-the-box features
  • Limited GraphQL support (primarily REST-focused)

Code Comparison

Keystone schema definition:

const User = list({
  fields: {
    name: text({ isRequired: true }),
    email: text({ isRequired: true, isUnique: true }),
    password: password(),
  },
});

Payload collection definition:

const Users = {
  slug: 'users',
  fields: [
    {
      name: 'name',
      type: 'text',
      required: true,
    },
    {
      name: 'email',
      type: 'email',
      required: true,
      unique: true,
    },
    {
      name: 'password',
      type: 'text',
      required: true,
    },
  ],
};

Both Keystone and Payload are headless CMS platforms, but they have different approaches and strengths. Keystone offers a more established ecosystem and GraphQL-first approach, while Payload focuses on flexibility, TypeScript support, and a simpler setup process. The code comparison shows similarities in defining data models, but Payload's approach is more JSON-like, while Keystone uses a more declarative style.

5,149

Sanity Studio – Rapidly configure content workspaces powered by structured content

Pros of Sanity

  • Real-time collaboration features for content editing
  • Flexible content modeling with customizable schemas
  • Powerful querying capabilities with GROQ (Graph-Relational Object Queries)

Cons of Sanity

  • Steeper learning curve for developers new to the platform
  • Less control over the underlying database structure

Code Comparison

Sanity schema definition:

export default {
  name: 'author',
  type: 'document',
  fields: [
    {
      name: 'name',
      type: 'string',
      title: 'Name'
    },
    {
      name: 'bio',
      type: 'text',
      title: 'Biography'
    }
  ]
}

Keystone schema definition:

import { list } from '@keystone-6/core';
import { text } from '@keystone-6/core/fields';

export const lists = {
  Author: list({
    fields: {
      name: text({ validation: { isRequired: true } }),
      bio: text({ ui: { displayMode: 'textarea' } }),
    },
  }),
};

Both Sanity and Keystone offer powerful content management capabilities, but they differ in their approach. Sanity provides a more flexible content modeling system with its schema definitions, while Keystone offers a more traditional database-oriented structure. Sanity's real-time collaboration features make it attractive for teams working on content-heavy projects, while Keystone's integration with Node.js and GraphQL may be preferred by developers looking for a more customizable backend solution.

17,783

A Git-based CMS for Static Site Generators

Pros of Decap CMS

  • Simpler setup and configuration, especially for static sites
  • Better integration with popular static site generators like Gatsby and Hugo
  • More user-friendly interface for content editors

Cons of Decap CMS

  • Less flexible for complex data structures and relationships
  • Limited customization options compared to Keystone's extensibility
  • Fewer built-in features for user management and authentication

Code Comparison

Decap CMS configuration (in YAML):

backend:
  name: git-gateway
  branch: main
collections:
  - name: "blog"
    label: "Blog"
    folder: "content/blog"
    create: true
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}

Keystone schema definition:

const { Text, Relationship } = require('@keystonejs/fields');

module.exports = {
  fields: {
    title: { type: Text },
    content: { type: Text, multiline: true },
    author: { type: Relationship, ref: 'User' },
  },
};

Both CMSs offer different approaches to content management. Decap CMS is more suited for simple static sites, while Keystone provides greater flexibility and power for complex applications.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Keystone: The superpowered CMS for developers



Keystone helps you build faster and scale further than any other CMS or App Framework. Describe your schema, and get a powerful GraphQL API & beautiful Management UI for your content and data.

No boilerplate or bootstrapping Ҁ“ just elegant APIs to help you ship the code that matters without sacrificing the flexibility or power of a bespoke back-end.

Contents

Usage & Documentation

Keystone 6 is published to npm under the @keystone-6/* namespace.

You can find our extended documentation on our website, but some quick links that might be helpful:

  • Read Why Keystone to learn about our vision and what's in the box.
  • Getting Started walks you through first steps with the create-keystone-app CLI.
  • Our Examples contain a growing collection of projects you can run locally to learn more about a Keystone feature.
  • An API Reference contains the details on Keystone's foundational building blocks.
  • Some Guides offer practical walkthroughs on how to build with those blocks.

Γ°ΒŸΒ’Β‘ While our API Reference is generally complete, we are are still working hard on increasing the fidelity of our guides and examples. If you have an example you'd like see, please open a GitHub discussion!

Our @keystone-6/* packages are written for the Node Maintenance and Active LTS versions of Node; and our continuous integration seamlessly tracks that. You may have success with Node versions that are Pending or End-of-Life, but you may have problems too.

Looking for Keystone 5?

The Keystone 5 codebase is now in maintenance mode and lives at keystonejs/keystone-5. For more information read Keystone 5 and beyond.

Enjoying Keystone?

Interested in what's new?

For a birds-eye view of what the Keystone project is working towards, check out our Roadmap.

Feedback

Share your thoughts and feature requests on Slack (preferred) or Twitter. Bugfixes and issues always welcome.

Versioning

Keystone follows semver.

Code of Conduct

Keystone adheres to the Contributor Covenant Code of Conduct.

Security

For vulnerability reporting, please refer to our security policy.

License

Thinkmill

Copyright (c) 2024 Thinkmill Labs Pty Ltd. Licensed under the MIT License.

NPM DownloadsLast 30 Days