Skip to content
/ cubic Public

📦 Easy to scale, zero-config, real-time focused app platform for node.js

License

Notifications You must be signed in to change notification settings

cubic-js/cubic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cubic

npm Node version dependencies build


Cubic is a simple wrapper that integrates node.js frameworks into one platform that's easy to scale in docker or kubernetes.

This project is still very much in development and lacks documentation in some places, but you can already check out how we've built NexusHub with the help of Cubic.


Features

Cubic comes with everything needed to create a full-size web application for modern standards:

  • Automatically routed API endpoints to HTTP and WebSockets
  • Webpack for optimal dev & prod bundling
  • Full OAuth2 integration
  • Pub/Sub model for real-time data
  • Rate limits and caching on a per-endpoint basis
  • Concise endpoint schema for automated unit tests

We provide all of these features regardless of which http/ws server you choose to use under the hood.


Usage

Before you get started, make sure you have redis and mongodb running on their default ports.

To install cubic to your project:

npm init
npm install cubic cubic-api cubic-auth cubic-ui cubic-client cubic-defaults

This looks like a lot of things, but that's because you don't actually need more than cubic and cubic-api for a minimal API server. Everything else only extends the base functionality for the sake of showing you a fully working web-app.

Entrypoint

Next we'll create index.js as our entrypoint to the server

// index.js
const Cubic = require('cubic')
const cubic = new Cubic()

// Load auth, view and api nodes needed for a basic setup
cubic.bootstrap()

Ready to go

Now all we need to do is run

node index.js

And Cubic will automatically create some default API endpoints and views that you can learn the basics from.
You'll now find your web-app on localhost:3000 🎉


License

MIT