Cubic is a modular full-stack framework for real-time applications that puts the developer first. Be it frontend development in ES7+, hot-module-replacement for your view, or component-based API endpoints to keep your backend tidy - Cubic gives you all of that out of the box with no tedious setups. It just works.
Cubic comes with everything needed to create a full-size web application for modern standards:
- Vue.js as UI rendering engine
- 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
- Automatically routed API endpoints to HTTP and WebSockets
- Decoupled API servers from CPU intensive endpoints for efficient scaling with docker
Cubic is kept fairly opinionated, because it allows us to focus on one solution and make its usage as convenient and effective as possible. However, the fully modular nature of the framework allows to easily modify existing nodes, so you'll never be locked in with what we think is best.
Getting started in 5 minutes
Before you get started, make sure you have redis and
mongodb running on their default ports.
If you have to install these first, I apologize for lying about the "5 minutes" in the title. If not, you'll have a blast!
Select your project folder and run the following:
npm init npm install cubic cubic-loader cubic-api cubic-core cubic-auth cubic-ui cubic-client cubic-defaults
We're aware that this looks like a lot of stuff, but trust us, it's gonna make it much easier to update individual modules for features/bugfixes in the future.
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
And Cubic will automatically create some default API endpoints and views
that you can learn the basics from.
localhost:3000 to have a look at the view server.
If everything went right, you'll find an interactive tutorial on that server, asking you to hack the site. You'll have to work on the site's own code to fulfill some objectives and proceed. There'll be plenty of tips though, so it shouldn't be too hard. In fact, there's always a full solution available to each objective at all times.