npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cmstyx

v1.1.0

Published

Barebones Content Management System

Downloads

18

Readme

CMStyx Logo

Flexible Content Mangement System to help you keep your site upto date with ease.

npm version npm dependencies github issues

Installation

$ npm install cmstyx

Update Log

This is Beta Version 1, CMStyx is still under development and I will continue to add features and fix bugs

Please report any issues to the github page

This newest update has completly changed how the cms database is handled and is therefore not compatible with previous versions. Before using this version I suggest that the current 'web-elements' collection is deleted as it could interfere with the new version.

Patch Notes

Updates from Aug 19 V.II - Sep 1 V.XIV

  • Web UI for CMS controller
  • Ability to add element through the W.UI
  • Major database re-work
  • Modify current records through the W.UI
  • Elements can be removed through the W.UI
  • Login session tracked using cookies and secrets
  • Web UI for CMS login

Quick start

CMStyx sits between the routes and the page render calls. In order to setup the CMS it must finish building before routes are called.

App/Server.js
var cms = require('cmstyx');

//Works off users express app
var express = require('express');
var app = express();

cms.build(app)
.then(function (cmsRoute){

	//Routes are handled after cmstyx has been initiated
	app.use('/', router);

	//Choose where the admin panel is accessed from e.g. '/admin'
	app.use('/admin', cmsRoute);
	//OR
	//Use the route from the settings.json
	app.use(cms.rootAddress, cmsRoute);

	app.listen(3000);
})

CMStyx will need to grab information from the database before the page is rendered. To do this you will need to modify your routing functions:

Router.js
var router = require('express').Router();
var cms = require('cmstyx');

router.get('/', function (req, res){
	var obj = { User Varibles to pass to page };

	cms.render(page, req, res, obj);	
})

The first time that CMStyx is run it will be in setup mode. When visiting your choosen route you will be shown a settings form.

Once the form is submitted restart the server and CMStyx will run as normal, if all required settings have been changed.

CMStyx Control Panel

By logging in to the CMS via your choosen route and password you will be redirected to the control panel. From there you can create, remove and edit elements/records. By starting a property name with an input type then an underscore: color_picture. The property will have the required input type in the editor.

However files can not be modified once submitted, currently, they can only be added or removed and will not appear in the editor

Displaying elements in pages

When cms.render() is called it will grab elements from the database and append them to your current object. The elements will be named stx_YourElementName. The element object will contain all of the records and a few stx properties e.g.

stx_YourElementName : {
	[ { property1 : val1,
		property2 : val2,
		...       : ...,
		stx_element : 'YourElementName',
		stx_empty : false,
		stx_unique : 'Object Key In Database' },
	  { record2 },
	  { ... } ]
}

With this you can loop through the object and display the information with Jade e.g.

if stx_ELEMENT
	-var i = stx_ELEMENT.length;
	-for(var c = 0; c < i; c++)
		-var record = stx_ELEMENT[c];
		h2 record.title
		a(href=record.url) #{record.description}

Extras

Once cms.build() has been run you can access the url of the cms using:

var root = cms.rootAddress

The handler used to query the database can also be accessed using:

var handler = cms.dbController