jumprope-cms

0.0.6 • Public • Published

CMS/framework. Think something between WordPress and Node.js on Rails. Allows real developers to develop and allows their stakeholders to manage their content. (Looking at you WordPress "developers")

Opinionated like Rails.

Uses MongoDB to manage backend.

Has an admin page like WordPress.

TODO:

  • Admin page
  • How to change what is editable on the backend with admin page?
    • One potential solution would be to predefine services that are editable on the admin page. For instance: products and blog
  • Connect DB
  • Create and use options passed into init()
  • Allow editing of options passed into init() and then reboot server

Object returned (like Express)

Features to test

  • Error handling if services are not configured. (API and routes).

Options Passed Into Init()

Four categories

  • ENV - Replaces environment variables
  • DB - Options for Mongoose and the DB
  • Build - Options for the gulp build task that will be inline
  • Server - Options applicable to the Web/App/API server

Within the context of the three sub-objects that are not ENV the options object will have access to a copy of ENV. We create this copy in the boot function so don't set options.build.env else it will be overwritten.

ENV Options

  • NODE_ENV: Pretty self explanatory. Either null or 'production'.
  • PORT: Port for server to listen on. If not specified defaults to 3030.

DB Options

Build Options

Server Options

Options Ideas
  • Options of each package
  • Logging options

DB

You can specify all the models you want. Once you specify a User model you need to be careful because the default user model will no longer be applicable. This can totally destroy your admin page logins if you aren't careful. For convenience I have provided the original User Schema and Model below.

const mongoose = require('mongoose');
const Schema   = mongoose.Schema;
const bcrypt   = require('bcrypt-nodejs');
 
const UserSchema = mongoose.Schema({
 
    local         : {
        email       : String,
        password    : String
    },
 
    facebook      : {
        id          : String,
        token       : String,
        email       : String,
        name        : String
    },
 
    twitter       : {
        id          : String,
        token       : String,
        displayName : String,
        username    : String
    },
 
    google        : {
        id          : String,
        token       : String,
        email       : String,
        name        : String
    }
 
    accessLevel   : Number
 
});
 
//
// Methods
//
// Generating a hash
userSchema.methods.generateHash = function(password) {
    return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
 
// Checking if password is valid
userSchema.methods.validPassword = function(password) {
    return bcrypt.compareSync(password, this.local.password);
};
 
//
// Create the User model and expose it to the CMS
//
module.exports = mongoose.model('User', userSchema);

Readme

Keywords

none

Package Sidebar

Install

npm i jumprope-cms

Weekly Downloads

1

Version

0.0.6

License

MIT

Last publish

Collaborators

  • dkimot