System architecture
Our system architecture, at a high level, will be the same as in the REST API version of our sample application. Requests from the web will hit the CloudFront CDN, which is backed by S3. Our JavaScript code from the served-up HTML files will query the serverless API, which itself will communicate with the RDS-backed data layer:
Thinking through this application from a top-down approach, the steps in fetching data will be the same regardless of how the logic layer is implemented:
- End-user requests a website
- Static assets are served to the user from CloudFront and S3
- Static assets request data via logic layer/web APIs (GraphQL in this case)
- Logic layer fetches/writes data from/to Postgres database in the data layer
Moving our example web application from a REST design to GraphQL means focusing on the logic layer, as the presentation and data layers won't change much, if at all. Of course, any changes to our API mean that our presentation layer (that is, the client) will need...