Lapis Docs

Getting started

Introduction

Lapis is a content management system with file-based routing and in-place editing, built on Tempest PHP. Tempest provides the kernel (the container, discovery, the router, views, the console and the database), and Lapis adds its own project layout on top.

As a developer, you write the pages as templates. Every file in pages/ is a route, and every <x-block> in a template is a piece of content that editors may change. As an editor, you sign in and change the text and the images right on the page. There is no separate admin area.

The content lives in a single SQLite file (MySQL and PostgreSQL work too). JavaScript and CSS come through an import map, so a Lapis site needs neither Node nor a build step, and it runs on plain PHP hosting.

A site's folders

A Lapis site is a Composer project. These are the folders you will work with:

assets/            JS, CSS, images: import map + versioned URLs
  js/ css/ images/ vendor/   (vendor: ./lapis importmap:require)
components/        x-*.view.php: Tempest view components
pages/             the files are the routes (Next.js style)
data/              data tables (data/products.php)
forms/             forms (forms/contact.php)
app/               optional: the site's own classes (App\ namespace), texts (localization.de.yml)
storage/
  content/         lapis.sqlite (pages, blocks, settings, users)
  cache/           views, page cache, route cache, Tempest internal cache
  uploads/         uploaded files
  logs/            lapis-YYYY-MM-DD.log
public/index.php   Lapis::web(dirname(__DIR__))->run();
lapis              console: Lapis::console(__DIR__)->run();
lapis.config.php   settings schema, page types, locale
importmap.php      modules

Editing on the page

After signing in at /_lapis/login, the editable blocks appear on the page itself, together with a floating toolbar at the bottom of the screen. Every change is saved as a draft first, and it goes live when an editor publishes it. You can read more about this in Editable content and The editor and users.

Where to go next