srcerer
Build light and modular web applications
Last updated 2 months ago by guilala .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install srcerer 
SYNC missed versions from official npm registry.

Srcerer

Npm package for building and serving light and modular web applications with Node.js and Nginx.

Purpose

With Srcerer you can build, and / or serve web applications written in vanilla Javascript:

  • With a modular Node.Js back- end.
  • And a modular client side; say "self-contained web components", or "ShadowDOM" avant la lettre.
  • Being lightweight, compatible with conventional browsers, and webviews.

You can also use Srcerer to help:

  • Create interfaces controlling a Raspberrypi, or any other Node.js capable hardware, with duplex interaction by use of integrated websocket server.
  • Build snappy mobile applications.

But only use Srcerer if you:

  • Can afford to be unconventional about application development.
  • Can aggree HTML is not meant to be written manually.
  • Contribute with missing functionality and improvements.
  • Favor fat client architectures.

Application

Srcerer can build multiple applications separately, generating the index and other static files automatically for each app.json file.

Server

Based on app.json settings and a template, Srcerer automatically creates Nginx configuration files. A simlink inside Nginx's 'sites-enabled', and you are hosting the application.

Back- end

Srcerer hosts interactivity by using Express's req, res, next api for blobs to send and receive interactive data in JSON format. It automatically mounts the scripts configured in the io.json files it finds.

Modular client

Srcerer builds each client- side application module by compiling 'blobs' from source directories. A single blob is a collection of minimized files, and can simultaneously serve a model, view, controller, destroyer, css (Less), and svg object. None of them mandatory. Svg is used as a transporter to deliver multiple vector, and / or pixel based graphics. In production, blob requests are cached for reuse at client- side.

Run example

npm install srcerer
cd node_modules/srcerer/examples/
npm install
node main.js

And open in a browser: localhost:2000/app/hello/ should look like:

helloWorld

Basic client side example

Srcerer provides modularity and inheritance with little convention

this.model = function(next, ctx, input) {
   // inherit something from a parent
   ctx.inheritedSomething = input.something;
   ctx.fadeOutFunction = input.fadeOut;

   // define something locally
   ctx.somethingNew = "world";

   // proceed synchronously or asynchronously when model is set
   next();
};

this.view = function(next, elm, ctx) {
   // dom elements
   elm([{
      // div with text node
      dom: "someId",
      str: "Hello " + ctx.somethingNew
   }, {
      // div with strong text node
      elm: [{
         tag: "strong",
         str: ctx.inheritedSomething
      }]
   }]);

   // proceed synchronously or asynchronously when dom elements are created
   next();
};

this.controller = function(next, ctx) {
   // do something with view
   ctx.dom.someId.style.color = "red";

   // proceed synchronously or asynchronously when controller is set up
   next();
};

this.destroy = function(next, ctx) {
   // do something before this context gets destroyed
   ctx.fadeOutFunction(ctx.dom.someId, next);
};

Todo

  • Feature, convention and api documentation.
  • Make build process extendable to support individual needs like CoffeeScript, TypeScript, etc.
  • Unit tests

Current Tags

  • 0.16.2                                ...           latest (2 months ago)

56 Versions

  • 0.16.2                                ...           2 months ago
  • 0.16.1                                ...           2 months ago
  • 0.16.0                                ...           3 months ago
  • 0.15.5                                ...           4 months ago
  • 0.15.4                                ...           8 months ago
  • 0.15.3                                ...           8 months ago
  • 0.15.2                                ...           8 months ago
  • 0.15.1                                ...           9 months ago
  • 0.15.0                                ...           9 months ago
  • 0.14.5                                ...           a year ago
  • 0.14.4                                ...           a year ago
  • 0.14.3                                ...           a year ago
  • 0.14.2                                ...           a year ago
  • 0.14.1                                ...           a year ago
  • 0.14.0                                ...           a year ago
  • 0.13.1                                ...           a year ago
  • 0.13.0                                ...           2 years ago
  • 0.12.1                                ...           2 years ago
  • 0.12.0                                ...           2 years ago
  • 0.11.0                                ...           2 years ago
  • 0.10.1                                ...           2 years ago
  • 0.10.0                                ...           2 years ago
  • 0.9.0                                ...           2 years ago
  • 0.8.12                                ...           2 years ago
  • 0.8.11                                ...           2 years ago
  • 0.8.10                                ...           2 years ago
  • 0.8.9                                ...           2 years ago
  • 0.8.8                                ...           2 years ago
  • 0.8.7                                ...           2 years ago
  • 0.8.6                                ...           2 years ago
  • 0.8.5                                ...           2 years ago
  • 0.8.4                                ...           2 years ago
  • 0.8.3                                ...           2 years ago
  • 0.8.2                                ...           2 years ago
  • 0.8.1                                ...           2 years ago
  • 0.8.0                                ...           2 years ago
  • 0.7.7                                ...           2 years ago
  • 0.7.6                                ...           2 years ago
  • 0.7.5                                ...           2 years ago
  • 0.7.4                                ...           2 years ago
  • 0.7.3                                ...           2 years ago
  • 0.7.2                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.13                                ...           3 years ago
  • 0.6.12                                ...           3 years ago
  • 0.6.11                                ...           3 years ago
  • 0.6.8                                ...           3 years ago
  • 0.6.7                                ...           3 years ago
  • 0.6.6                                ...           3 years ago
  • 0.6.5                                ...           3 years ago
  • 0.6.4                                ...           3 years ago
  • 0.6.3                                ...           3 years ago
  • 0.6.2                                ...           3 years ago
  • 0.6.1                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (11)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2018 © taobao.org |