Skip to content

Getting Started

Ready to jump into Lucid? Follow the steps below to get your brand-new Lucid project up and running and take your content to the next level.

Prerequisites

  • Node.js v20.12.2 or higher.

1. Setup a TS/JS Node.js Project

Before you can start working with Lucid, first things first, you need a Node.js project. It doesn’t matter if you want to use JavaScript or TypeScript, what package manager you use, etc. The only requirement here is that it’s Node.js and you’re set up to use ESM. Lucid does not support CommonJS and will not work with it.

2. Install Lucid Core

Run the following command in your terminal to install Lucid Core.

Terminal window
npm i @lucidcms/core

3. Create lucid.config.ts/js

You need to create a lucid.config.ts or lucid.config.js file in the root of your project.

The lucid.config file is the heart of Lucid and is where you will define everything from the collections you have, the locales you support, all the way to defining your email and media strategies.

Here is the minimum required file to get Lucid up and running:

lucid.config.ts
import lucid from "@lucidcms/core";
import { SQLiteAdapter } from "@lucidcms/core/adapters";
import Database from "better-sqlite3";
export default lucid.config({
host: "http://localhost:8080",
db: new SQLiteAdapter({
database: async () => new Database("db.sqlite"),
}),
keys: {
encryptionKey: process.env.LUCID_ENCRYPTION_KEY as string,
cookieSecret: process.env.LUCID_COOKIE_SECRET as string,
refreshTokenSecret: process.env.LUCID_REFRESH_TOKEN_SECRET as string,
accessTokenSecret: process.env.LUCID_ACCESS_TOKEN_SECRET as string,
},
collections: [],
plugins: [],
});

4. Importing & Starting Lucid

Now that you have Lucid installed, before you can run your project, there is one final step. You need to import it into your project and call the start function.

index.ts
import lucid from "@lucidcms/core";
// lucid.start({
// port: 8080,
// host: "localhost",
// });
lucid.start();

Calling the lucid.start() function will start the Lucid Fastify server.

Once this is done, you can run your start script and navigate to http://localhost:8080/login to see Lucid in action. The default username is admin and the password is password. You will be prompted to change this password on first login.