Alliance Platform Frontend

The frontend package provides a number of tools to help you build a frontend for your Django project. It includes:

  • Integration with bundlers (currently just Vite) to make embedding assets in your Django templates easy.

  • The component template tag to make it easy to include React components in your templates.

  • The stylesheet template tag to make it easy to include CSS generated by Vanilla Extract in your templates.

To make these work there is some corresponding infrastructure required on the frontend side. This is currently supplied in the template-dango repository, but will be split out into a published package at some point. Specifically this provides

  • A Vite dev server that provides some extra endpoints to support the Django integration, including SSR in development.

  • A renderComponent.tsx file used by the component template tag to render components.

  • A build script that extracts the required assets to build from django using a management command.

  • Some code to handle the SSR of components, including a minimal production SSR server to be run with node.

The Codegen package is used to generate javascript code snippets that are embedded in the template with the component tag.