Docs

lightcms.config.ts

This is the main config file of light-cms. It holds the types, and information about the orm, and mainly the infomation about the users and their roles. Let's explore them one by one.

ORM

It helper the script know which ORM you are using so it can generation the server actions that follow it's patterns. We only support drizzle for now, but we will add support for more ORMs as the project grows.

const config: LightCmsConfig = {
  orm: "drizzle", 
 // ...
};

enableSidebarIcons

This is an optional attribute. All this does is make the admin sidebar collapse to an icon-only state instead of the default offcanvas state. You should enable this if you wish to add icons for each section in the admin panel.

const config: LightCmsConfig = {
  // ...
  enableSidebarIcons: true, // true or false : default false
  // ..
};

adminCredentials

This is the most important data that you will store. You can create an array of users (use environment variables for the passwords) and assign them roles. The roles allow you to manage permissions. Read more about them in the permissions docs.

const config: LightCmsConfig = {
  // ..
  adminCredentials: [
    {
      username: process.env.ADMIN_USERNAME!,
      password: process.env.ADMIN_PASSWORD!,
      role: "admin",
    },
    // ...more users
  ],
};

RoleType

This is a typescript type to make the role management type-safe. Whenever you create a new role, make sure to extend or modify this type.

export type RoleType = "admin" | "seo-manager" | "blog-writer";

Learn more about permissions