Skip to content

rjrodger/startupdeathclock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Startup Death Clock

The startup death clock tells you what day your startup will run out of money.

This is a micro-services example for the Seneca toolkit.

This systems consists of four services:

  • doc-srv: JSON document store
  • hist-srv: history story to record document updates over time
  • real-srv: live business statistics on usage of the website
  • index: the web server

The web server is provided in four alternative versions, one each for

This shows you how to integrate seneca into each web framework.

Requirements

This is a Node.js app, using the Seneca toolkit.

You will need to install Redis (for pub-sub messages) and beanstalk (for queued messages). Just run the basic servers with default configuration.

You will also need Docker to run the full deployment scenario. However you can run without it.

Structure

The service implementations are wrapped as Seneca plugins and placed in the lib folder. This is where your main business logic goes

The service processes are in the srv folder. These are small scripts to configure the connections between processes. In a production system you will have many of these and they will change over time.

To demonstrate integration with a number of different Node.js web frameworks, integrations are provided for express, kraken, hapi, and sails in their respectively named folders.

Running the Test App

To test the system, you can run the test app. This app includes all the services into one process for convenience:

$ node test-app.js

Or with full logging (see seneca logging):

$ node test-app.js --seneca.log.all

Or just action logging:

$ node test-app.js --seneca.log=type:act

Once running, you can access the api end points:

http://localhost:3000/api/1.0/live

Running the services in development

To run each service separately, use separate terminal windows and run:

$ node srv/doc-srv.js --seneca.log.all
$ node srv/hist-srv.js --seneca.log.all
$ node srv/real-srv.js --seneca.log.all

The run your framework of choice:

express

$ cd express
$ node index.js --seneca.log.all

kraken

$ cd kraken
$ node index.js --seneca.log.all

hapi

$ cd hapi
$ node index.js --seneca.log.all

sails

$ cd sails
$ node index.js --seneca.log.all

And access the main site at:

http://localhost:3000

Releases

No releases published

Packages

No packages published