Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paradiso

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paradiso

A common way to write reactive and isomorphic apps on any js framework.

  • 1.0.21-debug.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Paradiso

An adapter-based, library-agnostic framework for building web applications.

Features

Switch out underlying libraries without changing application code.

Build resuable component, framework, and server adapters that operate transparently.

Adapters for Express, Mithril, Browserify, Coffeeify, Envify, Uglify, and more.

Install

npm install -g paradiso

Getting started

First, let's create a very simple project with the following structure:

app/
  components/
    - home.coffee
  initializers/
    - build.coffee
    - client.coffee
    - routes.coffee
    - server.coffee

(Protip: Feel free to organize your files how you like. Paradiso is unopinionated.)

Initializers

The app/initializers directory includes:

  • build.coffee - builds the client js asset
  • client.coffee - defines the client js asset
  • routes.coffee - routes for client and server
  • server.coffee - starts the web server
Build initializer

app/initializers/build.coffee:

build      = require "paradiso-build"
browserify = require "paradiso-build-browserify"
coffeeify  = require "paradiso-build-coffeeify"

browserify paths:
  "public/client": "app/initializers/client"

build browserify, coffeeify
Routes initializer

app/initializers/routes.coffee:

routes = require "paradiso-routes"

module.exports = routes map:
  "/": require "../components/home.coffee"
Client initializer

app/initializers/client.coffee:

routes = require "./routes"
client = require "paradiso-client"

client routes
Server initializer

app/initializers/server.coffee:

routes  = require "./routes"
server  = require "paradiso-server"
express = require "paradiso-server-express"

server routes, express,
  port:   9000
  static: "public"

Component

components/home.coffee:

module.exports = -> "hello!"

Build assets

Build your client js assets:

coffee app/initializers/build.coffee

or with gulp:

gulp     = require "gulp"
paradiso = require "paradiso"

gulp.task "build", -> require "app/initializers/build"

Start server

Start the web server:

coffee app/initializers/server.coffee

or with gulp:

gulp     = require "gulp"
paradiso = require "paradiso"

gulp.task "server", -> require "app/initializers/server"

Now you have a functioning Paradiso project up and running at 127.0.0.1:9000.

This project is available in the getting-started branch of the example repo.

Components

Paradiso ships with paradiso-component, an object oriented approach to writing components.

Initializers

Add component functionality through the initializers:

app/initializers/client.coffee:

routes    = "./routes"
client    = require "paradiso-client"
component = require "paradiso-component"
mithril   = require "paradiso-component-mithril"

client routes, component, mithril

app/initializers/server.coffee:

routes    = require "./routes"
server    = require "paradiso-server"
express   = require "paradiso-server-express"
component = require "paradiso-component"
mithril   = require "paradiso-component-mithril"

server routes, component, express, mithril,
  port:   9000
  static: "public"
Component

Let's build a valid HTML page with content:

components/home.coffee:

module.exports = class

  constructor: ->
    @title   = "Home"
    @content = [
      H1 @title
      P  if @server "server" else "client"
    ]

  view: ->
    if @server
      @layoutView @
    else
      @content
  
  LayoutView: class
    constructor: ({ @content, @title }) ->

    view: ->
      HTML [
        HEAD @title
        BODY @content
      ]

FAQs

Package last updated on 01 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc