Skip to content

xometry/fusebit

 
 

Repository files navigation

Table of Contents

Introduction

This mono-repository includes all of the private source code for the FiveQuarters.io products and services.

The repository uses the following frameworks and tools:

  • Yarn: A package manager; like npm but it supports mono-repositories with workspaces.
  • Typescript: Javscript with type information and compiler errors; TypeScript 3.0 introduced project references which we take advantage of with yarn's workspaces.
  • Jest: The testing library open-sourced by Facebook. It is feature rich and includes unit test coverage by default.
  • Prettier: Formats code in a reasonable way; we've configured it to format on saving a file
  • Ts-Lint: Linting for TypeScript

For web apps, this repository also uses the following additional frameworks and tools:

  • React: The popular front-end framework open-sourced by Facebook.
  • Enzyme: A testing framework from Airbnb that plays well with Jest and makes testing React components easy.
  • Webpack: A code bundler for React to create front-end bundles for SPA web applications (Single Page App).
  • Ngrok: a tunnel for HTTP/TCP that allows localhost endpoint to be accessed from the internet during development.

For server apis, this repository also uses the following additional frameworks and tools:

  • Koa: A web-server from the folks that made Express that is built about async/await.
  • nodemon: Reloads the web dev server automatically on file changes.

Getting Setup

To get setup, simply follow the few easy steps below:

  1. Install nvm (Node Version Manager):

Using curl

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

Using Homebrew

brew install nvm

Take into account that you need to add the NVM directory to your path, the instructions appears after you install nvm.

  1. Install zip using whatever package manager comes with the platform.

Ubuntu or Debian linux

sudo apt install zip

OSX

brew install zip
  1. Install the supported version of nodeJS:
nvm install 14.17.2
  1. Select the latest version of nodeJS to use:
nvm use 14.17.2
  1. Install the yarn node module globally, and lock the version to the supported version:
npm i -g yarn
yarn set version 1.21.1
  1. Install typedoc tool and plugins by running
npm i -g typedoc
  1. At the root of this repo, run the setup cmd:
yarn setup
  1. And lastly, build everything in the repo with the build cmd:
yarn build

Docker

Docker is a temporary hack to quickly create a monolithic deployment of flexd-functions and pubsub and run it EC2 behind an application proxy.

Key notes:

  • The image exposes two ports: 3001 for product APIs, and 5002 for the websocket endpoint that accepts real time logs from clients running in user Lambda functions.
  • Both endpoints are unsecured, so SSL needs to be terminated at the application proxy.
  • A new project /mono has been created that is the entry point of the image. It acts as a simple process manager: it starts flexd-functions and pubsub, watches for their termination, and if either exits, it folds down all other processes and exits itself. It also propagates SIGINT and SIGTERM from outside to children.

Install Docker for Mac from here.

Building the docker image:

docker build -t flexd .

Running the image:

docker run -it --rm -name flexd-functions --env-file .env -p 3001:3001 -p 5002:5002 flexd

Visual Studio Code

Using VSCode is highly recommended. This repository includes VSCode specific settings to hide some boiler-plate files that are required.

Also, it is highly recommended that you install the Prettier VSCode extension. This will ensure that source code is always formatted as configured in the repository whenever a file is saved.

Command Cheat Sheet

Here is a quick list of commands for working with the workspaces in the repository. (A workspace is single nodeJS module with it's own package.json)

Action Command
Build All Workspaces yarn build
Test All Workspaces yarn test
Launch a Web APP or API yarn start <{path}/name>
Create a New Workspace yarn new <path/name>
Build one or more Workspaces yarn build <{path}/name-filter>*
Test one or more Workspaces yarn test <{path}/name-filter>*
Lint one or more Workspaces yarn lint <{path}/name-filter>*
Get Unit Test Coverage for Workspaces yarn coverage <{path}/name-filter>*
Add a Dependency to a Workspace `yarn require {--dev
Rename a Workspace yarn rename <workspace-name> <new-name>
Move a Workspace yarn move <workspace-name> <new-path>
Delete a Workspace yarn delete <workspace-name> <new-path>
Generate API documentation yarn doc <workspace-name>
Generate a new proxy service yarn proxy-service

* These commands will execute for all workspaces that have a path/name that match the filter

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.6%
  • JavaScript 8.6%
  • Shell 0.9%
  • PLpgSQL 0.4%
  • HTML 0.3%
  • Makefile 0.2%