-
Notifications
You must be signed in to change notification settings - Fork 59
Backend Stack Overview
TomNUSDS edited this page Dec 12, 2020
·
12 revisions
The backend application has a number of components that can be grouped roughly into layers. These are listed here, from the HTTP side to the database side. While some leakage is inevitable (the DB models will tend to exist everywhere, for example), the goal should be to keep layers ignorant of each other's implementation details, with increasing emphasis the further apart those layers are.
- The GraqphQL schema - defines types, queries and mutations for the graphql API, and is our coordination point with the client.
- The API package tells the graphql package how to resolve requests, through a combination of wrapper models and specialized Spring components that implement a graphql resolver interface. This layer should contain the minimum possible logic to bridge between the GraphQL view of reality and the rest of the application. Good: choosing which form of patient data to display. Bad: fetching multiple different entities and stitching them together. (That’s hypothetical, haven’t seen anything actually bad yet.) Components in this layer should not interact with Repository objects, but should understand database models. Models in this layer should only be used by resolver components.
- The service package is where all the actual logic in the application should live. All of the classes on in this package should ideally be labeled as
@Transactional(readOnly=true)
, but at least@Transactional
is required. Most query and mutation resolutions should require a single service call. Internal models for the application that are neither part of the API nor the persistence layer live here. - The DB layer contains the model and the repository package.
- The JPA/Hibernate persistence schema is defined in the model package, with each object that has an
@Entity
annotation corresponding to one primary data table. Best practices and/or local conventions for how to map your database tables in JPA are worthy of an entire page, which they may even get some day. - The repository package defines how we fetch data from the database: it should contain only interfaces, which are wired up into implementation classes by Spring Data JPA under the hood. (It is possible we will add some weird abstract class partial implementations at some point, but we have not yet needed to.)
- The JPA/Hibernate persistence schema is defined in the model package, with each object that has an
- The liquibase database changelog defines the underlying structure of our postgresql database. Once a changeset in this file is merged to master, it basically cannot be modified (other than adding comments and tweaking settings about when a given migration runs), so please take extreme care when adding things to this. (Also, the wrong change here could wipe our database instantly. Just FYI.)
- config package
- profiles
- YAML files
- Getting Started
- [Setup] Docker and docker compose development
- [Setup] IntelliJ run configurations
- [Setup] Running DB outside of Docker (optional)
- [Setup] Running nginx locally (optional)
- [Setup] Running outside of docker
- Accessing and testing weird parts of the app on local dev
- Accessing patient experience in local dev
- API Testing with Insomnia
- Cypress
- How to run e2e locally for development
- E2E tests
- Database maintenance
- MailHog
- Running tests
- SendGrid
- Setting up okta
- Sonar
- Storybook and Chromatic
- Twilio
- User roles
- Wiremock
- CSV Uploader
- Log local DB queries
- Code review and PR conventions
- SimpleReport Style Guide
- How to Review and Test Pull Requests for Dependabot
- How to Review and Test Pull Requests with Terraform Changes
- SimpleReport Deployment Process
- Adding a Developer
- Removing a developer
- Non-deterministic test tracker
- Alert Response - When You Know What is Wrong
- What to Do When You Have No Idea What is Wrong
- Main Branch Status
- Maintenance Mode
- Swapping Slots
- Monitoring
- Container Debugging
- Debugging the ReportStream Uploader
- Renew Azure Service Principal Credentials
- Releasing Changelog Locks
- Muting Alerts
- Architectural Decision Records
- Backend Stack Overview
- Frontend Overview
- Cloud Architecture
- Cloud Environments
- Database ERD
- External IDs
- GraphQL Flow
- Hibernate Lazy fetching and nested models
- Identity Verification (Experian)
- Spring Profile Management
- SR Result bulk uploader device validation logic
- Test Metadata and how we store it
- TestOrder vs TestEvent
- ReportStream Integration
- Feature Flag Setup
- FHIR Resources
- FHIR Conversions
- Okta E2E Integration
- Deploy Application Action
- Slack notifications for support escalations
- Creating a New Environment Within a Resource Group
- How to Add and Use Environment Variables in Azure
- Web Application Firewall (WAF) Troubleshooting and Maintenance
- How to Review and Test Pull Requests with Terraform Changes