K KodePressdocumentation
Laravel 11 · MySQL 8 Specification Built 2026-10-10

CLAUDE.md — KodePress project rules#

These rules are binding for every change in this repository. Read this file first, at the start of every session and at the start of every phase. If a rule here conflicts with an instruction in a prompt, say so before writing code.

1. What we are building#

KodePress — a website CMS a non-technical owner can operate alone. Pages, blog posts, menus, mega menus, header, footer and theme are all built from the admin panel, with no code.

Success is measured by one number: a new user, with no training, publishes a first page in under 10 minutes. Every design decision loses to that goal.

The owner is not technical. Keep explanations simple. Add short plain-language comments in code where a non-developer might one day read it (block schemas, settings screens, Artisan commands).

2. Hard constraints#

3. Core concept — everything is a block#

A page is a tree: Page → Sections → Columns → Blocks. The whole tree is stored as one JSON document in page_versions.content. Headers, footers, mega-menu panels and reusable global blocks use the same tree and the same editor, so the user learns one tool only.

{
  "version": 1,
  "sections": [
    {
      "id": "s1",
      "settings": { "background": "light", "padding": "large" },
      "columns": [
        {
          "width": 12,
          "blocks": [
            { "id": "b1", "type": "heading", "data": { "text": "Hello", "level": 1 } }
          ]
        }
      ]
    }
  ]
}

The canonical, versioned definition of this format is docs/04-block-system.md. Never change the shape without an ADR and a content migration.

4. Block system#

Each block is a folder: app/Blocks/<Name>/ containing schema.php (fields), view.blade.php (output) and preview.png. BlockRegistry scans app/Blocks, caches the result, and feeds the editor. The admin edit form is generated from schema.php.

Field types: text, textarea, richtext (TipTap), image, gallery, link, color, select, toggle, number, repeater.

Adding a new block must never require editing admin code. If a change to the editor is needed to support a new block, the field type is missing — add the field type, not a special case.

5. Admin panel — exactly 7 sidebar items#

Dashboard, Pages, Blog, Media, Menus, Design (theme, header, footer, saved sections), Settings (site info, SEO, forms, users, backup, redirects).

Adding an eighth sidebar item requires an ADR. New features go inside one of the seven.

6. Editor rules#

7. Rendering and cache#

On Publish, the JSON tree is rendered to HTML through Blade components and written to the file cache. Visitors are served the cached file.

Images are auto-compressed, converted to WebP, and given thumbnail/medium/large variants; output is lazy-loaded and the editor prompts for alt text.

8. Roles and security#

9. UI rules (house style)#

10. Working method#

  1. Keep this file current. It is the contract.
  2. Work phase by phase (docs/16-roadmap-phases.md). At the start of a phase write a short plan, then implement.
  3. Write Pest feature tests for every phase. Run php artisan test. Fix failures before moving on.
  4. Seed demo data so the site is visibly working right after php artisan kodepress:install.
  5. End a phase with a summary under 15 lines, in simple English: what was built, exactly how to try it in the browser (URLs and clicks), and how to deploy that phase to cPanel.
  6. Ask at most one question at a time, and only when no reasonable default exists.

11. Deployment#

Production is always a git checkout. Deploy = git pull in the live directory, then composer install --no-dev -o, php artisan migrate --force, cache clears. Never rsync, never edit files on the server, never deploy from an unpushed commit. After deploying, verify the live HEAD equals origin/<branch>. Details: docs/14-installation-and-deployment.md.

12. Fixing bugs#

KodePress documentation · generated from the Markdown sources by tools/build-docs-site.py · internal preview, not indexed.