/daily-gateway

API gateway service also for authentication and user management

Primary LanguageJavaScriptGNU Affero General Public License v3.0AGPL-3.0

Daily Gateway

API gateway service also for authentication and user management

Build Status License StackShare

The core concept of this service was to serve a gateway to all the incoming traffic. As the traffic grew the service introduced some performance spikes so I decided to distribute the traffic through the main load balancer. Now, this service is focused on user management. Registration, login, logout, referrals, and other user oriented functionality.

Stack

  • Node v18 (a .nvmrc is presented for nvm users).
  • Yarn for managing dependencies.
  • Koa as the web framework
  • MySQL and knex as a database layer

Project structure

  • test - There you can find all the tests and fixtures. Tests are written using mocha.
  • helm - The home of the service helm chart for easily deploying it to kubernetes.
  • seeds - JSON files with seed data for local development.
  • migrations - Knex migrations folder.
  • src - This is obviously the place where you can find the source files.
    • middlewares - Custom Koa middlewares.
    • models - Database layer functions split by entity type.
    • routes - Koa endpoints.
    • scripts - Utility scripts for administration tasks.
    • workers - Pub/Sub message handlers.

Local environment

Daily Gateway requires a running instance of MySQL.

Make sure to apply the latest migrations by running: yarn db:migrate:latest

Check out the config.js file to see the environment variables list. Some of the variables have a default value preconfigured.

Finally run yarn watch to run the service and listen to port 4000.

Want to Help?

So you want to contribute to Daily Gateway and make an impact, we are glad to hear it. 😍

Before you proceed we have a few guidelines for contribution that will make everything much easier. We would appreciate if you dedicate the time and read them carefully: https://github.com/dailydotdev/.github/blob/main/CONTRIBUTING.md