GithubHelp home page GithubHelp logo

one-aalam / microcosm Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 1.62 MB

๐Ÿฆ„ Micro Cosmos of Microservices aspiring to be seen as a well-ordered whole

JavaScript 100.00%
micro lerna techstack nodejs microservice microservices-architecture lerna-monorepo graphql apollo apollo-server

microcosm's Introduction

MICRO.COSM

A very minimal micro-service monorepo

Table of Contents

Introduction

A very minimal micro-service monorepo

The project has 3 packages (inside packages directory)

  • micro-one (http server - based on Micro)
  • micro-two (http server - based on Micro)
  • micro-three (http server - based on Express)

Techstack

  • Lerna - A tool for managing JavaScript projects with multiple packages
  • Micro - Asynchronous HTTP microservices or,
  • Express - 'Coz everybody uses it
  • Jest - Jest is a delightful JavaScript Testing Framework with a focus on simplicity
  • Supertest - High-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by it

Design Principles

The list of community contributed modules used in the micros is kept at minimum. I tried to keep it that way to show the power of the approach and, of course, the language itself.

Data/Domain Models

Search/Discover, Order, Delivery, Payment/Checkout, Restautaurant

Install

Checkout the repo and run

lerna bootstrap

in the project's directory

That's it ๐Ÿš€.

You'll find the dependenices installed and resolved now

lerna needs to be available globally for this

Usage

Go to the root of the project and run

lerna run start

That's it ๐Ÿš€.

You'll find the services available on their respective ports. Visit the respective ports and see `em in action.

lerna suppresses log output of npm scripts by defualt. To allow for that, run the above script with --stream flag

Jest

Reasons to use Jest

  • Jest is easy to setup
  • The watch-mode is amazing
  • When you console.log something, it actually shows up without any difficulty (this is a bit tricky with many existing Frameworks ).

Lerna Quick-Reference

Since most of the micros will share some common characterstics and behavior, Lerna is levaraged to manage community and cross-micro depenedencies so that it's DRY and less boring DX for ya!

Here are few of the commands you may find yourselves looking up quite often

# Adds the module-1 package to the packages in the 'prefix-' prefixed folders
lerna add module-1 packages/prefix-*

# Install module-1 to module-2
lerna add module-1 --scope=module-2

# Install module-1 to module-2 in devDependencies
lerna add module-1 --scope=module-2 --dev

# Install module-1 to module-2 in peerDependencies
lerna add module-1 --scope=module-2 --peer

# Install module-1 in all modules except module-1
lerna add module-1

# Install babel-core in all modules
lerna add babel-core

Visit https://github.com/lerna/lerna for more..

microcosm's People

Contributors

one-aalam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.