|
| 1 | +# ADRxxx: Remove forms-api |
| 2 | + |
| 3 | +Date: 2025-08-19 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +> Accepted or Rejected |
| 8 | +> |
| 9 | +> Valid ADR statuses are: "Proposed", "Accepted", "Rejected", "Deprecated", "Superseded by ADRzzz", but since we use the GitHub Pull request mechanism to approve ADRs, "Proposed" isn't applicable. |
| 10 | +
|
| 11 | +## Context |
| 12 | + |
| 13 | +In [ADR004: Store form schemas in an API] we decided to implement a separate API app so that we could scale the services required for form submissions separately to the services required for building forms. |
| 14 | + |
| 15 | +However, maintaining multiple apps has resulted in increased toil. Having multiple services has also resulted in challenges around designing and maintaining the interface between forms-admin and forms-api. |
| 16 | + |
| 17 | +As the cost of compute is low at the moment, the cost of the additional developer time outweighs any savings due to efficient capacity management. |
| 18 | + |
| 19 | +We are currently refactoring forms-admin and forms-api to work with the v2 API described in [ADR034: API v2 for Forms]. We have an opportunity now as part of this work to make a large architectural change, namely using the forms-admin app to serve the v2 API endpoints needed for forms-runner, and removing the need for forms-api. |
| 20 | + |
| 21 | +[ADR004: Store form schemas in an API]: ADR004-store-form-schemas-in-an-api.md |
| 22 | +[ADR034: API v2 for Forms]: ADR034-api-v2-for-forms.md |
| 23 | + |
| 24 | +## Decision |
| 25 | + |
| 26 | +We will add endpoints to forms-admin that can be used to retrieve v2 API form documents in JSON format. |
| 27 | + |
| 28 | +We will change forms-runner to read form documents from these new endpoints in forms-admin. |
| 29 | + |
| 30 | +We will keep the new endpoints in forms-admin accessible from the private VPC only (keep them not accessible from the public internet), and not require authentication for their use. |
| 31 | + |
| 32 | +We will retire the forms-api app and remove it, its database, and associated systems, networks and configuration files. |
| 33 | + |
| 34 | +## Consequences |
| 35 | + |
| 36 | +Positives: |
| 37 | +- We will have fewer separate apps to maintain |
| 38 | + |
| 39 | + For each app we have to maintain we have additional maintenance workload, |
| 40 | + including regular security patches, keeping files common to all repositories |
| 41 | + in sync, and other causes of toil. Fewer apps means less toil for developers. |
| 42 | + |
| 43 | +Negatives: |
| 44 | +- forms-admin will be in the critical path for submitting a form |
| 45 | + |
| 46 | + The system will be less resilient (all other things being equal) because an |
| 47 | + issue in forms-admin could cause form submissions to fail. We could look at |
| 48 | + ways to mitigate this loss of resilience if it is thought to be necessary. |
| 49 | + |
| 50 | +- We won't have an external API for retrieving form documents |
| 51 | + |
| 52 | + This will make it harder for developers to debug and/or investigate the |
| 53 | + production system, but we have found that with the current API it is not |
| 54 | + common for developers to make API requests directly to forms-api. If we find |
| 55 | + that there is a need we can consider adding an external API with access |
| 56 | + control. |
| 57 | + |
| 58 | +### Consequences for costs and resource usage |
| 59 | + |
| 60 | +This change is likely to be resource-neutral, in the best case it may use |
| 61 | +slightly less resources, but it is more likely it will increase our resource |
| 62 | +usage. Currently we have fewer forms-admin instances than forms-api instances |
| 63 | +running in production, but each forms-api instance uses more compute. It is |
| 64 | +difficult to predict what the right number of instances for the forms-admin app |
| 65 | +including API endpoints would be, we will probably over-provision initially and |
| 66 | +optimise resource usage later. |
| 67 | + |
| 68 | +In terms of costs we are currently on a [compute savings plan] that has pay a |
| 69 | +fixed annual cost for a pre-agreed amount of compute, so we may not see an |
| 70 | +increase of cost. |
| 71 | + |
| 72 | +In terms of CO2 usage our AWS systems are currently nominally carbon-neutral, |
| 73 | +as Amazon has "purchased renewable energy that compensated all or part of the |
| 74 | +emissions associated with [our] usage", and the change in this ADR is unlikely |
| 75 | +to increase our emissions beyond the point of being carbon-neutral. |
| 76 | + |
| 77 | +If we do find that we need to improve the scaling properties of the system, we |
| 78 | +could consider cache layers between forms-admin and forms-runner rather than a |
| 79 | +full API. |
| 80 | + |
| 81 | +[compute savings plan]: https://aws.amazon.com/savingsplans/compute-pricing/ |
0 commit comments