Overview

A multi-tenant Posts CMS built almost entirely with createCRUD - isolation fields, lifecycle notifications, and a custom soft-delete.

This example builds a small but realistic multi-tenant Content Management System for blog posts - using almost nothing but createCRUD. It shows how flexible the helper is in a real project.

What You'll Build

A posts API where:

  • Multi-tenancy is handled with isolationFields and thunder-core's withTenant
  • Reads are public, writes are protected - anyone can read posts, only an authenticated tenant can create/update/delete
  • An afterCreate lifecycle hook fires a "new post" notification
  • A generated route (del) is disabled and replaced with custom soft-delete logic
  • The full API is reviewed through generated OpenAPI docs

This example relies on thunder-core for authentication and tenancy. You'll install it during Setup.

Final Project Structure

posts.ts
post.ts

Steps

Comfortable with the basics? This example goes deeper than the Todo App. If createCRUD is new to you, read the createCRUD reference first.


On this page