Skip to content

Latest commit

 

History

History

db-service

E2E Tests GitHub Releases TypeScript

@juno/api-gateway

Bits of Good's central infrastructure API, integrating several in-house services to simplify and streamline project development.


« Back to main README

DB Service

An internal service that interfaces with the database layer (Postgres). Handles all schema structuring and object relations (users, projects, api keys, etc.). This was kept as a single service to provide an interface for all other services to perform CRUD operations on the data they work with without needing to know the underlying storage internals.

Package Structure

Juno packages are built with Nest.js and follow a standard 3-tier architecture: controllers, service layer, and data access layer. The documentation is fairly comprehensive and a recommended read, but here are the highlights:

  • Modules - .module.ts files splitting the package into capabilities, allowing feature encapsulation. There will always be a root module within the package importing all other modules.

  • Controllers - .controller.ts files for handling and sending HTTP requests .

  • Middleware - .middleware.ts files for intercepting a client request before it gets routed to a controller. An example for this would be logging middleware, where a request could be sent to a logging mechanism before reaching the route handler.

  • Models - files defining the data used in all nest files, typically taking a proto as an input. For more information on proto files, see the proto package.

  • E2E Tests - .*.spec.ts specification files testing a particular model or behavior.

Folder Structure

├── src
│   ├── middleware
│   ├── models
│   └── modules
│       ├── auth
│       ├── email
│       ├── project
│       └── user
└── test

Development

Make sure to check out the main installation instructions first!

Run E2E tests in watch mode:

api-gateway: `yarn test:e2e:api-gateway-live`