npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lucidcms/core

v0.5.0-alpha.1

Published

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

Downloads

212

Readme

Lucid CMS

NPM Version Tests

A TypeScript-first, fully extensible headless CMS. Constructed using Fastify and SolidJS, it features sophisticated collection and brick builders, a wide range of plugins, and database adapters for PostgreSQL, LibSQL, and SQLite. It achieves the perfect balance of developer experience and an intuitive, easy-to-use interface for creators and end-users alike, without compromising on performance and flexibility.

Effortlessly configure Lucid to meet your content needs with our flexible configuration options, and an array of first-party plugins including LocalStorage, Resend, Nodemailer, S3, and more.

Installation

npm install @lucidcms/core

Features

  • PostgreSQL, LibSQL and SQLite DB adapters
  • Collection & Brick Builder w/ 15 Custom Fields
  • Media library w/ Custom Stategies
  • Emails w/ Custom Stategies
  • On Request Image Optimisation/Resizing
  • Users and Roles
  • Full Localisation Support
  • Plugin Support
  • Hook Support

First Party Plugins

lucid.config.ts/js

import lucid, { LibsqlAdapter } from "@lucidcms/core";
// Plugins
import LucidNodemailer from "@lucidcms/plugin-nodemailer";
import LucidS3 from "@lucidcms/plugin-s3";
import LucidLocalStorage from "@lucidcms/plugin-local-storage";
// Collections
import { PageCollection, SettingsCollection } from "./collections.js";

export default lucid.config({
  host: "http://localhost:8393",
  db: new LibsqlAdapter({
    url: "libsql://localhost:8080?tls=0",
  }),
  keys: {
    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,
  },
  localisation: {
    locales: [
      {
        label: "English",
        code: "en",
      },
      {
        label: "French",
        code: "fr",
      },
    ],
    defaultLocale: "en",
  },
  hooks: [
    {
      service: "collection-documents",
      event: "beforeUpsert",
      handler: async (props) => {},
    },
  ],
  collections: [PageCollection, SettingsCollection],
  plugins: [
    LucidNodemailer({
      from: {
        email: "[email protected]",
        name: "Lucid",
      },
      transporter: transporter,
    }),
    LucidLocalStorage({
      uploadDir: "uploads",
    }),
  ],
});

Collection Example

Collections in Lucid allow you to define a type content. Within these collections exist documents. A collection can either contain multiple, or just a single document depending on the mode flag. Collections give you the flexibility to add fields, builder bricks and fixed bricks against them. The custom fields these contain will then be available on the document page builder.

import { CollectionBuilder } from "@lucidcms/core";
// Bricks
import Banner from "./bricks/banner.js";
import SEO from "./bricks/seo.js";

export const PageCollection = new CollectionBuilder("page", {
  mode: "multiple",
  title: "Pages",
  singular: "Page",
  description: "Pages are used to create static content on your website.",
  translations: true,
  hooks: [
    {
      event: "beforeUpsert",
      handler: async (props) => {},
    },
  ],
  bricks: {
    fixed: [SEO],
    builder: [Banner],
  },
})
  .addText({
    key: "page_title",
    collection: {
      list: true,
      filterable: true,
    },
  })
  .addTextarea({
    key: "page_excerpt",
    collection: {
      list: true,
      filterable: true,
    },
  })
  .addCheckbox({
    key: "page_featured",
    translations: true,
    collection: {
      filterable: true,
    },
  })
  .addUser({
    key: "author",
    collection: {
      list: true,
    },
  });

export const SettingsCollection = new CollectionBuilder("settings", {
  mode: "single",
  title: "Settings",
  singular: "Setting",
  description: "Set shared settings for your website.",
  translations: false,
  bricks: {
    fixed: [],
    builder: [],
  },
}).addMedia({
  key: "site_logo",
  title: "Logo",
});

Brick Example

Bricks at their core are just groups of custom fields. They can only be consumed through collections.

import { BrickBuilder } from "@lucidcms/core";

const Banner = new BrickBuilder("banner", {
  description: "A banner with a title and intro text",
  preview: {
    image: "https://placehold.co/600x400",
  },
})
  .addTab({
    title: "Content",
    key: "content_tab",
  })
  .addText({
    key: "title",
    description: "The title of the banner",
    validation: {
      required: true,
    },
  })
  .addWysiwyg({
    key: "intro",
  })
  .addRepeater({
    key: "cta",
    validation: {
      maxGroups: 3,
    },
  })
  .addText({
    key: "cta_title",
  })
  .addText({
    key: "cta_url",
  })
  .endRepeater()
  .addTab({
    title: "Config",
    key: "config_tab",
  })
  .addCheckbox({
    key: "fullwidth",
    description: "Make the banner full-width",
  });

export default Banner;

Roadmap

  • Implement a collection document reference custom field type.
  • App integration system.
  • Public endpoints so collection documents etc can be called via the app auth.
  • Core library to export an API to programatically update content.
  • Endpoint caching with config support to swap out the stategy.
  • Customisable view document link support.
  • Collection document lock if a user is editing the document.
  • Collection level permission support.
  • Blur hash and average colour generation on media image upload.
  • Nested collection plugin (adds slugs and full slugs based on parent document relations).
  • Form builder plugin.
  • Menu builder plugin.
  • Cookie consent plugin.
  • Brick pattern support with a fixed and template mode. If its fixed values cant be mutated, if its template they can be.
  • Collection revision system so changes can be reverted.
  • Sitemap generation plugin.
  • SEO plugin.
  • Brick and document live previews.
  • Document search indexing w/ endpoint to search document content.
  • An AI document fill tool (takes in a prompt and context of available bricks and the collection to generate all of the content for a document).
  • An AI custom field fill tool.
  • An AI alt tag generation on media images.
  • Support to extend the CMS frontend to add new pages, swap out components add custom features etc.