Jason CMS

Jason CMS

A small, self-hosted CMS for people who want a real site without a real circus.

Jason CMS is a lightweight PHP CMS that stores content in plain JSON. Posts and pages, search, pagination, plugins, and a simple admin—no database to babysit, no framework to fight. Open your data in a text editor. Back it up by copying a folder. Built for single-owner sites that should stay fast, clear, and under your control.

Jason CMS is intentionally small. It doesn't try to be WordPress, and it doesn't need a database, a build pipeline, a collection of external services, or a subscription. It's designed to do a handful of things well and leave the rest to you.

Requirements: PHP 8.5+ with the extensions required by the enabled features. Apache or LiteSpeed recommended for .htaccess rules. Optional: APCu for in-memory caching of the JSON store.


Who it's for

Not aimed at: multi-author editorial workflows, complex roles and permissions, or sites that have outgrown "edit, publish, done."


Design philosophy


Features


Layout

/
├── public_html/              # web root: the only public directory
│   ├── index.php             # public site
│   ├── init.php              # locates and loads jason-cms/
│   ├── admin/                # admin.php, uploads.php (optional Basic Auth: htaccess.txt)
│   ├── assets/               # public CSS and JS
│   ├── uploads/              # uploaded images/videos (script execution disabled)
│   └── vendor/               # PHPMailer
└── jason-cms/                # private, outside the web root
    ├── config.php
    ├── data/                 # posts.json, links.txt (writable by PHP)
    ├── logs/                 # error.log (writable by PHP)
    ├── templates/
    ├── plugins/              # server-side only
    └── *.php                 # functions, hooks, uploads, Parsedown

Everything except public_html/ is outside the web root, so no deny rules are needed for the private application files. data/ and logs/ must be writable by PHP.


Installation

  1. Upload the contents of public_html/ to your hosting account's document root.
  2. Upload jason-cms/ alongside the document root directory, outside the web root.
  3. Edit jason-cms/config.php:
    • Set SITE_TITLE.
    • Set a new ADMIN_PASSWORD_HASH (see below).
    • Optionally configure ENABLED_PLUGINS and APCu options.
  4. Ensure the web server can write to jason-cms/data/ and jason-cms/logs/. Appropriate permissions depend on your hosting configuration; 750 or 770 may be suitable.
  5. Visit admin/admin.php and log in.
  6. Use HTTPS in production.

The public init.php locates and loads the private jason-cms/ directory. Keep the private directory outside the web root.

Generate an admin password hash

Generate a password hash from the command line:

php -r "echo password_hash('YOUR-NEW-PASSWORD', PASSWORD_DEFAULT), PHP_EOL;"

Put the resulting hash in ADMIN_PASSWORD_HASH in jason-cms/config.php.

Change the starter password before putting your site online.


Configuration

Configuration is stored in jason-cms/config.php.

Constant Purpose
SITE_TITLE Site name in UI and titles
POSTS_PER_PAGE Page size for lists and search
DATA_FILE Path to posts.json
ADMIN_PASSWORD_HASH Password hash for admin login
APCU_CACHE_ENABLED Use APCu when available
APCU_CACHE_TTL Cache lifetime in seconds (0 = until replaced on save)
ENABLED_PLUGINS List of plugin folder names under plugins/

Content model

Each entry in data/posts.json includes roughly:

id, type (post | page), slug, title, excerpt, content, published, date, updated

Post body

The editor stores the body as a string. It may include HTML, CSS, JavaScript, and PHP.

For example:

<h2>A heading</h2>
<p>Today is <?= date('l, F j, Y') ?>.</p>

HTML, CSS, and JavaScript are rendered as page content. PHP is executed server-side when a published entry is viewed.

Only trusted admin content should contain executable PHP. A compromised post can execute arbitrary PHP as the web server user, potentially compromising the entire site.


Public URLs

URL Meaning
index.php Latest posts
index.php?page=2 Pagination
index.php?p=<id> Single post or page
index.php?pages=1 All pages
index.php?q=term Search

Legacy slug URLs still resolve and redirect to the ID form.


Storage and performance

Writes to posts.json use a lock file, a temporary file, and an atomic rename so concurrent admin saves don't clobber each other.

This is designed for a small, single-owner site, not concurrent multi-author editing.

With APCu enabled, decoded post data is served from shared memory when possible and updated after a successful save. If APCu is missing or disabled, Jason CMS falls back to reading the file directly.

Why JSON?

For a lightweight CMS, content you can open in a text editor, back up as files, and move between hosts without a database server is a feature.

JSON storage stays comfortable for personal and small sites. If you later need heavy querying or many concurrent editors, a database becomes the better engine—not before.

Backups

Back up the following regularly:

These contain the content, configuration, customizations, and uploaded media needed to restore your site, apart from the PHP runtime and any separately installed dependencies.


Plugins

Plugins extend Jason CMS through actions and filters without modifying the core files.

  1. Create plugins/<name>/plugin.php.
  2. Add '<name>' to ENABLED_PLUGINS in jason-cms/config.php.
  3. Register hooks only—no output on load.

Actions

Hook When
plugins_loaded After enabled plugins load
init Request bootstrap (public and admin)
header_nav Extra markup in the public nav
footer Extra markup in the public footer
admin_menu Extra controls on the admin list screen
admin_save_post After save (array $post, bool $isNew)
admin_delete_post After delete (string $id)

Filters

Hook Role
posts_loaded Full posts array after load
post_content Body before render (string $html, array $post)

See plugins/README.md and the sample plugins/hello-world/ plugin for examples.


Security

Jason CMS is designed to keep application files and content outside the public web root wherever possible.

If you enable additional plugins, review their code and permissions. Plugins execute server-side and should be treated as trusted application code.


Templates

Public site chrome lives in:

index.php sets $pageTitle / $query and includes these through render_header() / render_footer().

Modify these templates to customize the public site's appearance without changing the core application logic.


License

Jason CMS is released under the MIT License.

You are free to use, modify, distribute, and adapt it, subject to the terms of the license. See the included LICENSE file for the full license text.

← All posts · Home