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

bared

v0.0.49

Published

Headless NodeJS CMS for better developer experience

Downloads

5

Readme

Lightweight, headless CMS fromework for NodeJS

Quick Start

Installation -> npm install @bared/core

File Structure, see demoApp folder as an example, we only support mysql for now, databases supported by knex should be supported in the future

const Bared = require('@bared/core')
const WechatLogin = require('@bared/plugin-wechat-login')

async function startServer () {
  await Bared({
    databaseConfig: {},
    plugins: [
      WechatLogin(),
    ],
    schemas: [],
    routers: []
  })
}

startServer()

Admin Panel

You can go to public admin panel site here: https://cms.baredigit.com or build your own admin panel.

Clone Admin panel here: https://github.com/baredigit/bared-admin

cd bared-admin

npm install // or yarn
npm start // or yarn

API endpoint is set when you login, for example default API expose -> http://localhost:9293

Progress

Inspired by strapi (https://strapi.io/) but want to be more lightweighted and mobile friendly, developer friendly.

  • [x] Connect mysql database
  • [x] Use knex to dynamicly create databases / tables
  • [x] Better folder structure
  • [x] Services, routes for DAPI (developer api, CRUD operations)
  • [x] Basic auth process
  • [x] Register routes for application developers
  • [x] Policy management, config application router policy in router config file.
  • [x] Basic developer dashboard frontend (WIP)
  • [x] Basic register process
  • [x] Alert column if anything changed in schema file
    • required and default is editable
    • type and unique need migration and TBD
  • [x] Error logging in database
  • [ ] Plugin system
    • [x] Defined basic layout of plugin files and exports
    • [ ] Write email plugin and register from main library
    • [ ] Research to see if there are good ways to add custom plugin page in admin panel
  • [ ] Joins / Relation fields
  • [x] 3rd party auth (wechat)
  • [x] Expose config outside (CORS or some other configs)
  • [ ] Basic server security check

Built-in queries in Bared CMS

  • Default services are bound into koa ctx, and you can use following services directly anywhere in your application:
    • get - ctx.queries.get("user", { id: 1 })
    • getList - ctx.queries.getList("user")
    • create - ctx.queries.create("user", { name: "" })
    • update - ctx.queries.update("user", 1, { name: "" })
    • count - ctx.queries.count("user")
    • delete - ctx.queries.delete("user", { id: 1 })
    • upsert - ctx.queries.upsert("user", { id: 1 }, { name: "" })

API category:

/api for enduser, public API, all users can access /papi for enduser, private API, need to login (with authorization header "Bearer xxxxx") /dapi for developer, general CURD operations

DAPI (Developer API endpoint):

Exposed by library out of box, need authorization and user auth_type=developer

GET - /dapi/{content-type}/1 get content where id=1

GET - /dapi/{content-type} get list of content

  • /dapi/user?_limit=2&_start=2 set limit and start
  • /dapi/user?_sort=age:desc sort
  • /dapi/user?age~eq=21 select user age=21
  • /dapi/user?age~gt=21 select user age>21, gte for >=
  • /dapi/user?age~lt=21 select user age<21, lte for <=
  • /dapi/user?id~in=[1,2,3] select user id in [1,2,3], nin for not in
  • /dapi/user?_q=username:test search users with column username contains test

GET - /dapi/{content-type}/count count table, query same as get list

POST - /dapi/{content-type} create a new content item

DELETE - /dapi/{content-type}/1 delete content where id=1

PUT - /dapi/{content-type}/1 update data for content where id=1

GET - /dapi/routes/{content-type} get routes config for post, to generate API document for developer in dev dashboard

GET - /dapi/schema/all get routes config for post, to generate API document for developer in dev dashboard