Skip to content
KeystoneJS LogoKeystoneJSv5

Choosing an Adapter

KeystoneJS currently provides two adapters for connecting to either a MongoDB or PostgreSQL database. Choose the Mongoose Adapter for MongoDB or the Knex Adapter for PostgreSQL.

If you're following the quick start guide, simply select the appropriate adapter for your database of choice when prompted. More information on adapter configuration can be found under the Setup sections.

Note: PostgreSQL requires an additional step to create a database.

Installing MongoDB

MacOS

The simplest way to install MongoDB is using Homebrew. Refer the official guide for more information.

Windows

Follow the official guide for installing MongoDB on Windows.

Other Platforms

Downloads and instructions for installation on various Linux systems are also available.

Setup

By default the Mongoose Adapter will attempt to connect to MongoDB as the current user and create a new database using the project name. You can override these options when configuring the Mongoose Adapter.

Installing Postgres

MacOS

The simplest way to install Postgres is using Homebrew.

brew install postgres

Other Platforms

For Windows and other platforms see the download instructions on the postgresql.org website.

Setup

By default the Knex Adapter will attempt to connect to a PostgreSQL database as the current user. It will look for a a database matching the project name. You can override these options when configuring the Knex Adapter.

To create database run the following command:

createdb my-database-name

Have you found a mistake, something that is missing, or could be improved on this page? Please edit the Markdown file on GitHub and submit a PR with your changes.

Edit Page