vorja / sleekdbvcms
SleekdbVCMS - The missing & simple SleekDB CMS Content Management System
Requires
- php: >=8.1
- ext-json: *
- jenssegers/blade: ^2.0
- rakibtg/sleekdb: 2.15
README
Version 3.0
A lightweight, modern PHP CMS on top of SleekDB — a flat-file NoSQL database. No MySQL/Postgres: every "table" is a folder under storage/stores/ containing JSON files.
Two front-ends on the same domain:
- Admin CMS at
/cms/— server-rendered Tailwind CSS views, mobile-first, dark mode. - Public front at
/— auto-discovers stores, configurable menu/header/footer, rendered with Blade.
Features
- Flat-file NoSQL: no database server required — SleekDB stores JSON documents on disk.
- Dynamic content types: define stores in
.default_storeswith 20 field types (text, textarea, rich text/Quill, image, color, url, link picker, number, decimal, email, date/datetime, checkbox, select, password, file, join relations, repeater, modules, form builder, module schema). - Pages & modules: pages are built from reusable module templates (hero, text, store list, store item, lead form, CTA, split, features, stats, testimonials, FAQ, pricing, logos, video). Templates hold only configuration; each page instance stores its own values.
- Menus: header/footer navigation with sub-menus, internal-link picker and external URLs.
- Forms & leads:
lead_formmodules reference form templates; submissions are stored in theleadsstore and optionally emailed via SMTP. - SEO: pretty URLs, XML sitemap, and a
redirectsstore for 301/302/307/308 rules. - Media: raster uploads are downscaled and converted to WebP (GD, EXIF orientation applied).
- JSON API: lightweight endpoints in
public/api/(e.g.?users=1). - Tailwind CSS + dark mode: compiled at build time, no CDN on page.
- Secure auth: password hashing, session-based login, protected
usersstore.
Requirements
- PHP >= 8.1 (ext-json, ext-gd for image processing, ext-fileinfo)
- Composer
- Node.js + npm (only to rebuild the Tailwind stylesheet)
Installation
git clone https://github.com/borjajimnz/SleekDBVCMS.git cd SleekDBVCMS composer install npm install npm run build:css # compiles tailwind/input.css -> public/dist/tailwind.css chmod -R 777 storage backups
Start the dev server:
cd public
php -S localhost:8000
Access the admin CMS at http://localhost:8000/cms/ and the public front at http://localhost:8000/.
Default credentials:
- Username: admin
- Password: password
Production (nginx + PHP-FPM)
- Web root is
public/; route all non-file paths topublic/index.php. - PHP-FPM must be able to write to
storage/(SleekDB createscache//data/folders lazily). Runchmod -R 777 storage backups; on permission errorschownthem to the PHP-FPM user. - Rebuild the stylesheet after changing templates:
npm run build:css(the CSS URL is versioned by file mtime, so a rebuild busts browser caches).
Configuration
Config.php
Config.php (required from Bootstrap.php) sets a global $config array — it does not return:
$config = [ 'app_name' => 'SleekDBVCMS', 'public_path' => __DIR__ . '/public', 'locale' => 'es', 'upload_files_extensions_allowed' => [...], 'options' => [ 'image_max_side' => 1920, 'image_quality' => 80, ], ];
Runtime settings
storage/settings.json holds site settings editable from the dashboard: site_name, tagline, blog_enabled (when off, posts/categories are hidden everywhere), plus SMTP notification settings for lead emails.
Public front config
public/config.php (returns an array) controls the front-end: site_name, tagline, home (featured store + items per store), menu (only stores listed here are publicly reachable), labels (nav display names), header_html / footer_html (raw HTML), image_fields / html_fields (how fields render in cards), and theme (auto | light | dark).
Content types
Define content types in .default_stores (JSON). Field types: text, textarea, rich_textarea, password, image, color, url, number, decimal, email, datetime, date, checkbox, select, link, modules, form_fields, repeater, module_schema, and join blocks:
{
"posts": {
"title": "text",
"body": "rich_textarea",
"category": { "join": { "key": "category", "foreing_table": "categories", "foreing_key": "_id", "foreing_display": ["name"] } }
}
}
URL scheme
Admin CMS (/cms/):
GET /cms/— dashboardGET /cms/?p=<store>— table listing (POSTsearch=filters)GET /cms/?p=<store>&insert=1— create formGET /cms/?p=<store>&update=1&id=N— edit formGET /cms/?p=<store>&view=1&id=N— read-only viewPOST insert_row/update_row/delete— mutationsPOST update_config— save content typesGET /cms/?backup=1— zip backup ofstorage/GET /cms/?logout=1
Public front (/):
GET /— home page (is_homein thepagesstore)GET /<page-slug>— a page (page wins over a store with the same name;?preview=1previews drafts with an admin session)GET /<store>— store listing (used bystore_listmodules)GET /<store>/<id>— item detailGET /sitemap.xml— XML sitemap
Front-end templating
The public front uses jenssegers/blade v2 (standalone Laravel Blade). Views live in public/views/*.blade.php, module partials in public/views/modules/*.blade.php. The admin CMS stays plain PHP templates in src/Views/.
Tailwind is compiled at build time to public/dist/tailwind.css (npm run build:css). No CDN is used on any page.
Architecture
Bootstrap.php— composition root; builds theCorecontainer, seeds the admin user, wires error handlers.src/Core.php— DI container:getDatabase(),getAuth(),getConfig(),getFileManager(),getFormBuilder(),getLogger(),getBlade().src/Services/—SleekDBManager(SleekDB wrapper),AuthenticationService,ConfigurationService,BladeRenderer,EmailService,FileManager,Logger.src/Controllers/AdminController.php— all admin routes/actions.src/Forms/FormBuilder.php+src/Forms/Types/*— input rendering per field type.src/Views/— admin templates (layout.php,login.php,dashboard.php,table.php,form.php).src/Interfaces/—DatabaseInterface,AuthenticationInterface.
Directory structure
public/
├── index.php # public front (path router + Blade rendering)
├── config.php # public menu/labels/header/footer/theme
├── views/ # Blade templates (public front)
├── cms/index.php # admin CMS entry
├── api/index.php # JSON API
└── dist/tailwind.css # compiled stylesheet
src/
├── Controllers/
├── Forms/Types/
├── Interfaces/
├── Services/
└── Views/
storage/
├── stores/ # SleekDB JSON collections
├── public/ # uploaded media (served at /storage/...)
├── logs/cms.log
└── blade-cache/
Pages, modules, menus & forms
pages— system + protected store. Fields includetitle,slug,published,show_in_menu,menu_order,is_home,seo_title,seo_description, andmodules(per-page module instances).modules— module templates (configuration only, never values). Supported types:hero,text,store_list,html,store_item,lead_form,cta,split,features,stats,testimonials,faq,pricing,logos,video.menus— header/footer navigation items withlabel,location,parent(self-join for sub-menus),url(internal-link picker or external URL),order,enabled.forms— form templates referenced bylead_formmodules:title,subtitle,fields(field builder),notify_to,notify_cc,button_text,success_message.leads— submissions oflead_formmodules.redirects— SEO redirect rules (source→target, HTTP code, enabled).- System stores re-merged on every boot:
users,pages,modules,posts,categories,redirects,leads,forms,menus. Onlyusersis protected from deletion.
Changelog
See CHANGELOG.md for the version history.
Screenshots
Login Screen
Dashboard
Content Management
Content Editing
Building a Page with Modules
The modules field on a page lists the module instances it uses (type badges like HERO, STORE_ITEM, ...). Clicking the pencil opens an inline editor to fill each module's values:
Public Front
Contributing
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature/my-feature - Submit a pull request
License
This project is licensed under the MIT License — see the LICENSE file for details.
Credits
- SleekDB created by Timu57 with support from rakibtg
- CMS implementation by borjajimnz