Skip to content

Development guide

Atul Varma edited this page Dec 21, 2020 · 15 revisions

This development guide is intended to provide a high-level overview of developing on the JustFix.nyc Tenant Platform.

Before reading this, please make sure you've read Core principles and Architecture.

Note: This guide also doesn't cover how to get the Tenant Platform up and running on your system; for details on that, see the project's README.

Introduction

The Tenant Platform's codebase consists primarily of its Django-based Python back-end, its React-based TypeScript front-end, and various layers of "glue" that tie the two together.

The back-end

The back-end attempts to be largely idiomatic Django code. You'll want to make sure you have gone through, at the very least, the official Django tutorial (part of the Django documentation) before embarking on any adventures there.

Additionally, the back-end uses Python's optional type annotations and checks them via Mypy.

Server-side rendering

By and large, our codebase use Django's template engine very little. Instead, as mentioned in Architecture, most user-facing view logic is actually done via a JSX rendering service: a separate NodeJS-based process that receives requests for pages to render, and returns the results.

On the Django side, this rendering service is invoked a view called react_rendered_view in frontend/views.py. This is used in project/urls.py to handle almost any kind of path that the Django server doesn't handle natively.

The JSX rendering service itself is implemented in frontend/lambda/lambda.tsx.

When invoked, the JSX rendering service is passed a blob of contextual information about the kind of view it's being asked to render, such as what URL needs to be rendered, who is currently logged-in, how the server is configured, and so on. For more details on this information, see the type definitions for AppProps defined in frontend/lib/app.tsx.

The results returned by the JSX rendering service include details such as the HTTP status code that should be returned, the HTML that was rendered, any extra HTTP headers to be included in the response, and so forth. The full specification is documented in the LambdaResponse type defined in frontend/lambda/lambda.tsx.

GraphQL

The main place our codebase diverges from idiomatic Django is with respect to the way the front-end communicates with the back-end.

TODO: finish this!

Celery

TODO: finish this!

Clone this wiki locally