dev-cms is a light-weight, modular Content Management System written in TypeScript & Deno using Oak for the HTTP server, and Denjucks for templating.
-
Install Deno version
1.3.2or higher -
Clone the project using
git clone https://github.com/thegamingninja/dev-cms -
CD into
dev-cmsby runningcd dev-cmsin the terminal of your choice -
Run the application using
denon start
dev-cms can be configured using enviroment variables. You can set them in denon.json in the env section, or by setting them in the terminal for your OS.
PORT={number}- Sets the port of the Application. Default3000.CACHE-DURATION={number}Sets themax-ageproperty in theCache-Controlheader for static files. Default1800.ALLOWED-EXTENTSIONS={extentions}Comma separated list of allowed extentions. Default'.css,.js,.png,.svg,.otf,.ttf,.woff'.
Pages are file based routed, and can be created by creating a yaml file in the pages folder or sub-folder. (Example: pages/examples/example1.yml will be accessible at https://domain.com/examples/example1)
The index yaml file will be the default for that folder. (both .yml and .yaml files are supported)
Example: index.yml
title: Home
type: markdown
style: landing
content: |
### Welcome
This is my website contentYou can use any other storage format by creating an implementation of the PageStore interface and setting an instance of it to pageStore in the app.state record.
Plugins can be created by creating a folder in plugins with a plugin.json, and plugin.ts file, example:
plugins
└── example-plugin
├── plugin.json
└── plugin.ts
Example plugin.json
{
"name": "Example",
"version": "1.0.0",
"base": "/example", // optional. base route for plugin router
"description": "This is an example plugin", // optional
"enabled": true // optional. true or false, defaults to true if not specified
"options": { // optional. any options you want to pass to your plugin when it's loaded
"test": true,
"can_be": "whatever_you_want"
}
}
Check out the admin-panel plugin for an example of what you can do with plugins.
Themes are not fully implemented, only an idea for the file structure is in place.
See the Upcoming Features section below for more information.
View Engines can be created by implementing the ViewEngine interface, can use rendering function you want as long as it can take in a string, and return HTML.
Example: Basic Denjucks View Engine
export default class BasicDenjucksEngine implements ViewEngine {
config?: ViewConfig;
constructor(config?: ViewConfig) {
this.config = config;
}
async render(template: string, data?: any): Promise<string> {
if (this.config && this.config.root) denjucks.configure(this.config.root);
return denjucks.renderString(template, data);
}
}- Admin Plugin Security
- (Improved) Site Settings
- More Tests
- Media Library (A plugin that's page independant for user uploaded content)
- Theme Layouts (Load any file in the theme folder named
[name].layout.[extention]as a possible layout)
The main purpose of dev-cms is giving me a place to host my portfolio as well as a another project for it, so I don't recommend using this project in any production situations as I won't be designed to support anything more than what I want to do with it. If you need a CMS like this I'd recommend using something like Grav, or Pagekit.
If you think this is a good starting point for your own project, or want to continue developing it, feel free to submit a pull request with your changes, or fork it and continue working on it, just make sure to credit me.