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

collectio-cms

v0.10.0

Published

A lightweight headless CMS built on top of the classic KeystoneJS

Downloads

19

Readme

CollectIO

Build Status Azure DevOps coverage Azure DevOps tests npm

A lightweight headless CMS built on top of the classic KeystoneJS. The main purpose is to providing convenient services in order to automate following features:

  • auth management
  • token management
  • providing model mapping
  • security management
  • service connections

As mentioned before, this framework is based on the classic version of Keystone.js offering nested lists.

The server is customized so that the system is maintainable easily by the admin panel.

Getting Started

Installation

git clone https://github.com/AhmetCavus/Collect.IO.git

or

git clone [email protected]:AhmetCavus/Collect.IO.git

cd .\Collect.IO\

or

cd Collect.IO

npm i

Configuration

First of all, you have to provide an env file '.env' in your project root folder. This file should contain following keys:

Mandatory fields

MONGO_URI=mongodb://user:pass@host:port/collection?authSource=admin
JWT_SECRET=do.not.read.it.is.jwt.secret
VERIFY_SIGNATURE=i.can.open.doors
CLIENT_ID=alone.i.am.useless
SECRET_ID=do.not.read.it.is.client.secret

Fields for cloudinary

COOKIE_SECRET=do.not.read.it.is.cookie.secret
CLOUDINARY_NAME==cloudinary
CLOUDINARY_API_SECRET=secret
CLOUDINARY_URL=cloudinary://sample
API_KEY=apikey

Be aware of commiting this file in the repository!!!

Database

Check this README for setting up the database.

Initial Data

Before running the server for the first time, you can initially add data to the database by providing a js script under the updates folder. Here you can add more scripts in order to update the database. Therefore, consider the semantic versioning.

A sample is already placed in this directory initdata

Architecture

Here you can see a briefly sketch of the architecture:

Running the server

npm start, nodemon start or from VS Code select dev start or prod start.

Usage

const CollectIO = require("../core/collectio.app")
const collectio = new CollectIO.App()

collectio.start({autoDbStart: false, adminPort: 8181}).then(() => {
  console.log("Collectio is up and running")

  collectio.config((app, express) => {
    app.get("/test", (req, res) => {
      res.sendFile(__dirname + "/core/public/index.html")
    })
  })
})

For more information check the unit test project folder.

Options

In order to configurate the server and ports, you can specify following values on startup:

collectio.start(options)

| Key | Description | Default | | ----------- | :------------------------------------------------------------------------- | :----------------------------------------- | | adminPort | Specify the port for the admin panel | 3000 | | restPort | Specify the port for the rest API | 8080 | | autoDbStart | Whether auto start the db engine or not | false | | autoUpdate | Whether auto update the db with the scripts from the updates folder or not | false | | updatePath | The path of the directory, where the update scripts are placed | updates | | nav | A JSON Object representing the nav graph regarding to the models | { account: ["admins", "clients", "roles"]} | | modelPath | The path of the models, that should be registered in the db | | | secureRestApi | Whether to auto secure the Rest API with the secrets in the environment | true |

Open the Admin panel

In order to get access into the admin panel, you have to open following link

[admin panel](http://[host]:[specified admin port]/keystone/signin)

The credentials are the one you have provided in the script placed in the updates folder. Moreover, if you customized the admin port, you have to set the correct port number.

Accessing to collections

In order to access the collection provided in the models, you can simply call the code below

const device = collectio.collection("device")
// device.model is the mongoose schema

After that, collectio provides you convenient methods to notify observers

| Function | Description | | ----------- | :------------------------------------------------------------------------- | | sendBroadcast(message, channelName) | Send a broadcast to all oberservers registererd to the given channel name | | notifyAddItemCollection(schema, item) | Notify all oberservers listening to changes for the given schema and provide the new created item | | notifyRemoveItem(schema, item) | Notify all oberservers listening to changes for the given schema and provide the removed item | | notifyUpdateCollection(schema, items) | Notify all oberservers listening to changes for the given schema and provide the items of the changed collection | | notifyUpdateCollectionItem(schema, item) | Notify all oberservers listening to changes for the given schema and provide the updated item of the collection |

For every model schema in your models path, a collection will be created in the database. In addition, it will be supplied with bi-directional communication through sockets. You can get further detail in the API calls section.

API calls

An OpenAPI Spec will be provided here. TBD

Creating models

For instructions of creating models, you can check the docu of the classic KeystoneJS How to create models

In order to create nested list, check following sample file: TodoModel

Playground

You can enter the playground by calling localhost:8080 in your browser.

Tests

npm test

Requirements

Node:

  • NodeJS >= 10.16 <=14
  • NPM >= 6.x

Database:

  • MongoDB >= 3.6
  • ...

We recommend always using the latest version of minio to start your new projects.

Features

  • Auth service:
  • Token service:
  • Auto db connection:
  • Model service:
  • Web socket support:
  • CollectIO REST Api:

Roadmap

License

See the LICENSE file for licensing information.