Fullstack JavaScript Microservice Web App in Minutes

Create project

$ npm install -g sokyra-microservice-factory
$ smf new test-app
$ cd test-app

Add back-end service

$ smf add service back-endSelect service template:
1) Basic worker
2) Back-end (Express.js)
3) Front-end (React.js)
prompt: number: 2
0) exit selection
1) (message broker) RabbitMQ
2) (database) Memcached
3) (database) MongoDB
4) (database) MySQL
5) (database) PostgreSQL
6) (database) Redis
7) (search engine) Elasticsearch
prompt: number: 3Selected clients:
[MongoDB]
Select another client:
0) exit selection
1) (message broker) RabbitMQ
2) (database) Memcached
3) (database) MongoDB
4) (database) MySQL
5) (database) PostgreSQL
6) (database) Redis
7) (search engine) Elasticsearch
prompt: number: 1

Add front-end service

$ smf add service front-endSelect service template:
1) Basic worker
2) Back-end (Express.js)
3) Front-end (React.js)
prompt: number: 3Select a back-end service to connect to:
1: demo
2: back-end
prompt: number: 2

Add worker service

$ smf add service workerSelect service template:
1) Basic worker
2) Back-end (Express.js)
3) Front-end (React.js)
prompt: number: 1==================================================Select third-party services clients that your service "worker" connects to (one at a time),0) exit selection
1) (message broker) RabbitMQ
2) (database) Memcached
3) (database) MongoDB
4) (database) MySQL
5) (database) PostgreSQL
6) (database) Redis
7) (search engine) Elasticsearch
prompt: number: 1

Run app

$ smf up
$ docker ps
$ smf down

Project structure

Back-end structure

Front-end structure

Worker structure

Fetch data from database

$ smf up

Message broker

Develop / debug mode

$ docker stop test-app-back-end
$ smf debug back-end
$ docker stop test-app-front-end
$ cd services/front-end/app
$ npm start

Deploy

$ smf deploy
$ ssh -i "/Users/me/.ssh/aws-key.pem" ubuntu@ec2-x-x-x-x.compute1.amazonaws.com$ docker ps
(gives the list of services)

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store