Code Monkey home page Code Monkey logo

microservice-core's Introduction

Table of Contents generated with DocToc

MICROSERVICE CORE

1. OVERVIEW

Reusable microservice core.

2. REQUISITES

  • Operating System - OS: Ubuntu 20.04 LTS.
  • Node.js v17.x
  • Yarn v3.x
  • Docker v20.x
  • Docker Compose v1.29.x
  • Insomnia

Beware, the following instructions may not work in a different OS.

3. SETUP

From the root directory:

./scripts/install.sh

The script won't work if you move to /scripts and execute it from there.

4. STARTUP

./scripts/start.sh

5. ENVIRONMENTS

There are 4 environments:

  • dev
  • test
  • stage
  • prod

The files for dev and test are in the repo, ask the team for stage and prod if needed.

6. DEPENDENCY MANAGEMENT

The dependency manager is Yarn v3.

7. DATABASE

The database is MongoDB, non-relational. MongoDB is run inside a Docker container. To get inside the Docker container which runs MongoDB:

docker exec -it db bash

To get a JavaScript REPL terminal inside MongoDB:

mongo

To add a user manually to MongoDB:

db
use talent-sourcery-db
db.users.insertOne({ email: '[email protected]', password: 'password' })
db.users.find({}).pretty()

8. CODE STYLE

The code style extends AirBNB with some custom rules. ESLint is used to lint the codebase. To lint the code:

yarn lint

It is recommended you install the ESLint extension in VSCode, which will show errors and warnings as you write the code. Errors must be removed, warnings are optional and may stay depending on the case.

9. QUALITY ASSURANCE

Quality is guaranteed via Behavior Driven Development - BDD. Jest is employed for tests. To test, run:

yarn test

10. LOGS

The core has a simple logging system, which writes info to src/logs/info.log and errors to src/logs/error.log.

11. EXECUTION FLOW

index > middleware > router > controller > service

12. CONTINUOUS INTEGRATION

GitHub actions automatically run tests for Pull Requests - PRs, and code pushes. View the Actions tab in GitHub.

13. APPLICATION PROGRAMMING INTERFACE

There's an API collection request in /src/utils/core_api.insomnia.json. You can import and test it Insomnia.

microservice-core's People

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.