• Stars
    star
    106
  • Rank 325,871 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Basic Isomorphic Boilerplate for secondary development

Lantern

An isomorphic web application built with "Universal JavaScript" and modern technologies, which contains basic functionality, fundamental design and workable architecture. Good to be used to create your project quickly.

The architecture design was already done for isomorphic. The views and frontend stuffs which are implemented with React can be rendered on server-side and client-side both and using the same configuration of routes. The good news is, there is no need to learn anti-pattern flux framework(e.g., redux) for isomorphic. Lantern provided an easy way for developers who are already familar with flux pattern.

Besides, the callback hell are not there anymore. The generator is widely used in this project, which is the new technology in new version of ECMAScript(JavaScript) for flow control. The Backend is using generator with Koa web framework, and frontend is using generator in flux framework as well.

Not only technique things, but also UI design is pretty cool in Lantern project. The framework that Semantic UI bring us fantastic frontend user interface, even better than bootstrap and other UI framework.

Documentation

See our Wiki for more information.

Installation

In order to support ES6+ and using a lots of new technologies (ex, generator and classes), Node.js 0.12+ or io.js is required. Once you have such environment, you can start to install modules needed via NPM.

npm install .

Then you can use webpack to compile and combine all of frontend source code for service.

webpack

Finally, you can start this web service:

node app.js

Development

Starting up in development mode is able to enable hot loading mechanism, you can start service with:

node app.js dev

Run in Production

For production, all of JavaScript will be minimized and optimized with no debug messages and symbols. You should use specific configuration file:

webpack --config webpack.production.config.js

Then you can direct run app with environment variable like this:

NODE_ENV=production node app.js

If the PM2 you are using for production, just run it with process.json provided and --env production options.

pm2 start process.config.js --env production

Features

  • Fast to setup and easy to customize
  • UI is pretty cool and fantasic
  • Widely use ES6 and ES7+ (Generator, classes and decorator)
  • Provided a lot of universal JavaScript solutions for development
  • Isomorphic Architecture (React server-rendering by using universal JavaScript)
  • Provided a lot useful extensions to speed up the development.
  • Efficient server rendering
  • Support permission management
  • Support user database system
  • Support Hot loading without webpack-dev-server
  • Support i18n for multiple language
  • Support third-party Authorization (Facebook/Github/Google/Linkedin)
  • Support Hot-load mechanism

Dependencies

  • Node.js v4.0+
  • Koa web framework 1.0
  • MongoDB
  • Fluky - Event-based framework for flux data flow pattern
  • babel 6 - Used to support ES6/ES7+
  • React v15.0.0+
  • react-router 2.0.0+ - router for React
  • Semantic UI - Front-end UI toolkit
  • Webpack
  • Passport

Efficient Server Rendering

Server rendering machanism of React is synchronous and slow against Node.js event-loop performance. It causes that reduces the number of concurrent connections for single process.

A implementation in Lantern architecture is individual renderer processes for server rendering of react. All of React rendering work is separated from main process to avoid blocking server. (The default number of renderer process is 2)

Benchmarks

Testing for rendering page with React on server side.

Environment:

  • Apple MacBook Pro Retina 2013 (i7 2.4 GHz/8GB RAM)
  • 1 Node.js process

Results:

$ ab -r -c 100 -n 1000 http://localhost:3001/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        
Server Hostname:        localhost
Server Port:            3001

Document Path:          /
Document Length:        4584 bytes

Concurrency Level:      100
Time taken for tests:   2.193 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      4721000 bytes
HTML transferred:       4584000 bytes
Requests per second:    456.00 [#/sec] (mean)
Time per request:       219.300 [ms] (mean)
Time per request:       2.193 [ms] (mean, across all concurrent requests)
Transfer rate:          2102.30 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.7      0       5
Processing:    16  216 100.0    213     418
Waiting:       16  215 100.0    213     418
Total:         16  216 100.1    213     419
WARNING: The median and mean for the initial connection time are not within a normal deviation
        These results are probably not that reliable.

Percentage of the requests served within a certain time (ms)
  50%    213
  66%    268
  75%    298
  80%    320
  90%    353
  95%    369
  98%    397
  99%    404
 100%    419 (longest request)

Showcases

License

Licensed under the MIT License

Authors

Copyright(c) 2015 Fred Chien <[email protected]>

More Repositories

1

npk

Node.js packaging utility
JavaScript
137
star
2

Shijing

Document editing engine
JavaScript
60
star
3

jsdx-toolkit

A graphical toolkit on JSDX framework. It aims to provide a node.js module for 3D user interface development.
C++
43
star
4

makerboard

Utility and emulator for development boards
JavaScript
41
star
5

mdsfs

Middle Stone Filesystem - An encrypting filesystem based on FUSE
C
26
star
6

fake-data-generator-taiwan

Generate fake data for testing
JavaScript
26
star
7

node-array

Extending the array object for Node.js
JavaScript
24
star
8

restpack

Library to pack/unpack data for restful API
JavaScript
22
star
9

fluxer.js

Powerful front-end framework for Flux
JavaScript
21
star
10

shell-based-mask-registration

Just for fun
Shell
21
star
11

fluky

Framework with flux data flow pattern
JavaScript
19
star
12

AppHouse

Hosting platform for node.js application
JavaScript
16
star
13

redtea

RedTea Web Framework
JavaScript
15
star
14

Kamalan

Kamalan Web Framework
JavaScript
12
star
15

jsdx-connman

JSDX Connection Manager API
JavaScript
11
star
16

wag.js

Feature-oriented based application Framework
JavaScript
11
star
17

courser

Route manager for express web framework
JavaScript
10
star
18

brig-example-app

Example App which is based on brig
QML
10
star
19

QML-Example

Example code in QML
9
star
20

FishFarmingBrowser

Web Browser which is based on Brig
QML
9
star
21

bootchart-lite

Bootchart-lite is a tool for performance analysis and visualization of the Linux boot process. Basicly, bootchart-lite is same with Bootchart project but more lightweight than Bootchart.
C
7
star
22

node-weather-taiwan

Node.js module to get weather data for Taiwan
JavaScript
6
star
23

frex.js

A framework for creating modern web applications
JavaScript
6
star
24

timewindow

collect all records that fill within the time window
JavaScript
5
star
25

grpc-connection-pool

Connection pool implementation for gRPC
Go
5
star
26

stemmer

Build system for Stem OS
JavaScript
4
star
27

jsdx-disk

Disk API of JSDX Framework
JavaScript
4
star
28

node-gcontext

Provide API to use GMainContext in Node.js
C++
4
star
29

juice-panel

Panel of Juice Desktop Environment
JavaScript
4
star
30

democooper

Utility for demo show
QML
4
star
31

bootstrap-tagsinput

Tags input jQuery plugin, based on bootstrap front-end framework
JavaScript
4
star
32

parallel-chunked-flow

Parallel chunked flow for processing sequential data
Go
3
star
33

barbarian

Node.js Module for running node.js in browser
C++
3
star
34

AppHouse-Manager

Management of AppHouse
JavaScript
3
star
35

Node-Traning-20160601

JavaScript
3
star
36

Garlic

Modern UI Components
QML
3
star
37

fulfill

Fulfill is a web service template, based on Node.js, frex.js and Semantic UI.
JavaScript
3
star
38

jsdx-ofono

oFono API to support SMS/VoiceCalling/SIM and Modem Management
JavaScript
3
star
39

qantacy

Graphical UI Framework with Node.js
JavaScript
2
star
40

twd97-to-latlng

Node.js module to convert TWD97 to latitude-longitude
JavaScript
2
star
41

backlogger

Backlog API in Node.js
JavaScript
2
star
42

zipcode-taiwan

Used to fetch Taiwan's zip code table
JavaScript
2
star
43

jsdx-app-voicecall

VoiceCall Application on JSDX Framework
2
star
44

jsdx-display

Display API of JSDX Framework
C++
1
star
45

grandpa

An Fantastic 3D X11 Window Manager for Mobile Device
C
1
star
46

wm.js

Window-based UI framework
1
star
47

MQStack

Message queueing framework
JavaScript
1
star
48

DarkFortress

Application to identify member
QML
1
star
49

jsdx-power

Power Manager API for JSDX Framework
JavaScript
1
star
50

jsdx-widget-pdfviewer

1
star
51

gosharding

Library to provide a way to process data in parallel by sharding
Go
1
star
52

courlan

Middleware manager for express web framework
JavaScript
1
star
53

inder

Application architecture for building user interface
JavaScript
1
star
54

MQoo

A lightweight message queuing framework
1
star
55

brig-pdf

brig module for PDF parsing and rendering
1
star
56

traffic-accidents-taiwan

Fetch traffic accidents data in taiwan
JavaScript
1
star
57

CophotoSurface

A service that people can take and upload photo
JavaScript
1
star
58

fanout-stream

fan out from source to streams and collect its output
JavaScript
1
star
59

jsdx-systray

Systray API for JSDX framework
C++
1
star
60

jushelf

Automatically exported from code.google.com/p/jushelf
C
1
star
61

taskflow

library to manage task flow
Go
1
star
62

weather-taiwan-autoupdater

An auto-updater to sync weather information per hours
JavaScript
1
star
63

owa

Useful utility to create a new project
JavaScript
1
star
64

jsdx-soundman

Sound Manager API of JSDX Framework
C++
1
star
65

apical

Restful API builder
HTML
1
star
66

shiver

Unconventional Front-end Framework
JavaScript
1
star
67

protoman

Framework to create your own network protocol for different purposes
JavaScript
1
star
68

suit-builder

Web UI builder
JavaScript
1
star
69

node-dtmdem

DTM-DEM Data Parser
JavaScript
1
star
70

fred-opensource

Automatically exported from code.google.com/p/fred-opensource
1
star
71

DarkNight

Hackathon membership system
JavaScript
1
star
72

lampion

Universal Web Application Integration Framework
JavaScript
1
star
73

oasis

API Document Viewer for OAS (OpenAPI Specification) format
JavaScript
1
star