Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This guidance is for all contributors. Repository maintainers are accountable fo
- [Jira Runbook](process/agile/jira.md)

### Architecture
- [Default Web Application Stack](architecture/web_stack.md)
- API design principles (planned)
- Testing philosophy (planned)
- Observability guidance (planned)
Expand Down
48 changes: 48 additions & 0 deletions architecture/web_stack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Default Web Application Stack

This guidance applies to web applications built at RMI, that is: anything that serves a browser-based UI backed by a server-side API and database.

## The Default Stack

New web applications **should** use:

- **Frontend:** [React](https://react.dev/)
- **Backend / API:** [FastAPI](https://fastapi.tiangolo.com/) (Python)
- **Database:** [PostgreSQL](https://www.postgresql.org/)

This is a default, not a mandate. But the default exists for a reason: shared tooling, transferable knowledge across teams, easier code review, and lower onboarding cost enable better engineer fungibility across repositories.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that this assumes python, rather than other languages that the project might want to use.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a feature, not a bug :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be targeting this stack (and Python) as a default for SPD. For both internal and contracted work.

A great counter-example of this is the PACTA web application built by Silicon Ally, which is written in Go (a language that precisely 0 of our engineers knows): https://github.com/RMI-PACTA/app

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or any of the demos I wrote in Ruby. Definitely did not help me sell those ideas :-)


## When to Deviate

Deviating from the default is allowed when there is a **strong, specific reason**, not a preference.

Examples of reasons that would justify a different choice:

- A hard technical constraint the default stack cannot meet (e.g., a data science workflow that fundamentally requires a different runtime, real-time requirements the default cannot satisfy, integration with a system that mandates a particular client library).
- An existing codebase or product being extended, where switching stacks would be more costly than living with the mismatch.
- A third-party or vendor requirement that dictates a particular framework or database.

Reasons that are **not** strong enough on their own:

- Personal familiarity or preference for a different framework.
- A newer framework being more exciting or trendy.
- Marginal performance differences at expected scale.

If you deviate, document the reason in the repository's `ARCHITECTURE.md` or equivalent so future maintainers understand the context.

## Suggested Adjacent Choices

Everything below are helpful suggestions for adjacent tooling. **"If you have no idea where to start, start here"**. These are reasonable defaults that will not surprise anyone who has worked in another RMI web application. Deviate freely when you have a reason.

- **Python packaging & dependencies:** [`uv`](https://docs.astral.sh/uv/) — fast, lockfile-based, workspace support for monorepos.
- **Python lint & format:** [`ruff`](https://docs.astral.sh/ruff/).
- **Python test runner:** [`pytest`](https://docs.pytest.org/).
- **Database migrations:** [Alembic](https://alembic.sqlalchemy.org/).
- **Frontend build tool:** [Vite](https://vite.dev/).
- **Frontend test runner:** [Vitest](https://vitest.dev/).
- **Local development environment:** Docker Compose: one command brings up the database, API, and frontend together.

## Reference Implementation

[RMI/stitch](https://github.com/RMI/stitch) is a working example of this stack and the adjacent suggestions above. When starting a new web application, it is often faster to skim stitch's `README.md`, `ARCHITECTURE.md`, and root configuration files than to assemble the pieces from scratch.
[RMI/pbtar](https://github.com/RMI/pbtar) is a static web application that *has no server-side API or DB*. It does however follow the stack in the sense that the front-end is written in [React](https://react.dev/).