Jump to main content

About DxSvelte

High-level summary and introduction to the package.


What is DxSvelte?

Warning: This project is in early Alpha and key features are still under active development. Please note that, for the time being, you will need to delete the automatically generated tsconfig.json and dxsvelte.py files from your project's root directory. The current behaviour is to not overwrite these files.

DxSvelte is Django x Svelte - an integration package which brings together the Django framework and it's batteries-included goodness to your Single Page Application, armed with SSR and seamless builds.

It builds an application using the existing Django router, so you don't need to think about building out separate REST endpoints using DRF. Simply use Django's Views as you normally would, and keep your logic together with any routes which aren't within the SPA's scope.

This documentation assumes you have some familiarity with both Django and Svelte. If you're unsure, refer to the following resources:

For an example of something you might build with DxSvelte, you're looking at one right now.


Features

  • Automatic SPA Generation: DxSvelte integrates tightly with Django's route resolvers, allowing you to easily build SPAs with Svelte without manually connecting the dots through DRF. The whole philosophy here is that SPA functionality can and should be a 'first class citizen' in Django.
  • Efficient Rendering: DxSvelte uses Svelte's efficient rendering approach to deliver fast and responsive user experiences, without sacrificing the power and flexibility of Django. SSR (Server Side Rendering) is also taken care of, meaning the HTML is an accurate representation of the page from your very first page-load.
  • Fast Compilation: DxSvelte uses ESBuild, a powerful JS compiler written in Rust. This helps facilitate the best possible compile times, so you can iterate and preview your changes rapidly.
  • Incremental Adoption: The default behaviour when it comes to navigation makes it easy to adopt the SPA incrementally. If you have an existing project you don't want to rewrite or only want for a specific portion of the site to be an SPA, then just keep going as you are; the SPA will honour any a href=..> tags which lead away from the SPA by checking itself against the automatically generated routing table.