-
Notifications
You must be signed in to change notification settings - Fork 0
2. Development Guide
- Run
yarn install
. The packages in this repo are linked via Yarn Workspaces, so you only need to runyarn install
once in the main root folder to install all the dependencies in the monorepo. - Copy the
.env.example
file to.env
in theconfig
folder. - Ask a team member for the secret
google-cloud-credentials.json
file and place it in theconfig
folder. - Update the
GOOGLE_CLOUD_CREDENTIALS
environment variable with the path to the secretgoogle-cloud-credentials.json
file you just added. (An example would be/Users/john/Coding/api/config/google-cloud-credentials.json
on MacOS) - Update the database URI connections for Postgres, MongoDB, and Redis for your system. Defaults are provided.
- Run
yarn setup
to start the setup script. Complete the steps in the command line to initialize your local development.
Finally, after you're setup:
- Run
yarn start:all
to start all the services- Even though you may only be wanting to edit one service, you'll need to start all of them as they all communicate heavily with each other to perform their tasks
- Run
cd services/<SERVICE_NAME>
and then runyarn dev
to start a specific service (though this should be used rarely)
Each service will be hosted on its own port, which will be printed to the console. So for example,
if you want to access the checkin service, this service is on port 8003, so you would make a request
to localhost:8003
an access the appropriate path.
Here's a breakdown of the major folders you'll interact with and what each one does:
This packages handles the configuration for all the gateway and services. It specifies port numbers,
database URLs, rate limiting, etc. Use this to setup and add new services. It has information for dev
and prod
in different files.
This package has a bunch of shared code that can be used across all of our services. This includes things like common types, common authentication middleware, error handling, etc.
Each of the services in this folder has a unique and distinct job. They each are setup with their own database and have their own routing system.
This is where our docs site is written. It contains the server to run the docs site and also the config .json
file that holds all our API info. When you're making a change to a service, you'll need to update the docs site here.
This folder contains one-off scripts that can be run to perform various tasks. These things include updating secrets, updating prod data, etc.
The gateway handles all incoming requests. Based on the url format, it will forward the request to
the appropriate service to handle it. For example, all requests starting with /users
will be sent
to the users service.