• Stars
    star
    178
  • Rank 214,989 (Top 5 %)
  • Language
    JavaScript
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

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

Repository Details

Isomorphic React + Flux film database example

Isomorphic React + Flux film database example

Complete application example including user authentication using koa on server side, and React/Flux(Alt) on frontend. Also uses koa-mongo-rest to generate REST API, and restful.js to consume them. With a healthy dose of Bootstrap, using react-bootstrap.

Demo: https://react-example-filmdb.herokuapp.com

Libraries Included

TL;DR

Use with iojs^1.8.0 or nodejs^0.12.0, clone the repo, npm install and npm run dev.

Learn React (react-prime-draft), learn Flux and Alt (alt guide).

Build for production with npm run build.

Concepts

Koa will be our server for the server side rendering, we use alt for our Flux architecture and react-router for routing in our app.

With iso as helper we can populate alt flux stores before the first rendering and have a complete async isomorphic React application.

For a more comprehensive guide to the source code, see wiki

Flux

We use alt singleton as Flux implementation.

On the server, it's similar but Flux is initialized using alt.bootstrap and for next rendering, the data are emptied using alt.flush

Installation / How-to

I recommend to use io.js to take advantages of ES6 without --harmony flag on NodeJS.

It's super easy to do with nvm:

  • $ nvm install iojs
  • $ nvm use iojs
  • $ nvm alias default iojs (to make node default to iojs)

But it works well with nodejs^0.12.0 as well :)

Run the project in development:

  • $ npm run dev

Run tests

  • $ npm test will run the tests once
  • $ ./node_modules/.bin/karma start will watch for changes and run the tests on change

Build project:

Just run $ npm run build, it will produce these tasks:

  • Run tests from test/spec/**/*.jsx
  • Concat & minify styles to /dist/app-[hash].css
  • Concat & minify scripts to /dist/js/app-[hash].js

Run in production

Build the project first:

  • $ npm run build

Then start the koa server:

  • $ NODE_ENV=production node server/index.js (iojs)
  • $ NODE_ENV=production node --harmony server/index.js (nodejs 0.12.x)

You can also use processes.json to run the application with PM2 Monitor on your production server (customize it for your use):

  • $ pm2 start processes.json

More Repositories

1

shoutboard-react

React example for Angular vs. React article
TypeScript
49
star
2

shoutboard-angular

Angular example for Angular vs. React article
TypeScript
35
star
3

mobx-input

Form library for MobX, with observable state and validations
JavaScript
23
star
4

axios-status

Network requests status tracking for Axios
JavaScript
13
star
5

entheogen

Colorful Sublime Text 3 color scheme based on Monokai and Next. ES6 ready.
10
star
6

mobx-translate

Simple library for translating React UI powered by MobX
JavaScript
10
star
7

svg-text-editor

Angular based text editor for SVG with forth-and-back conversion to contenteditable HTML
CSS
6
star
8

mytodo

Adobe AIR todo app
ActionScript
3
star
9

gaeo

a project, which aims to make the Google's webapp framework more rails-like
Python
3
star
10

testguru

simple app for generating pdf tests for students
JavaScript
2
star
11

gaeotest

testing project for GAEO
Python
2
star
12

svg-engine-es6

Proof-of-concept project aiming to replace svg-edit with Angular view-model approach.
CSS
2
star
13

dpmap

Erlang
2
star
14

mobx-di-example

How to inject stores into components AND other stores using this and react context
TypeScript
2
star
15

svg-reactor

svg editor proof of concept using React
JavaScript
2
star
16

lameshop

testing eshop project
Ruby
2
star
17

sample_app_rails3

Michael Hartl's demo app using Rails 3
Ruby
1
star
18

EuroSignalApp

Android application for EuroSignal
Java
1
star
19

tomsherokutest

Ruby
1
star
20

rethinkdb-benchmark

RethinkDB benchmark application with koa middleware and thinky ORM
JavaScript
1
star
21

isomorphic-articles

JavaScript
1
star