Skip to content

Backend Architecture

├── .github/
│   └── ISSUE_TEMPLATE/
├── app/ # Backend
│    ├── config/  # Backend
│          └── settings.py
│    ├── frontend/ # Backend
│    ├── server/  # Backend
│    ├── .babelrc
│    ├── manage.py
│    ├── requirements.txt  # Backend
│    ├── package.json
│    ├── package-lock.json
│    └── webpack.config.js
├── dev/
│    ├── django.dockerfile
│    ├── webpack.dockerfile
│    └── dev.env
├── .dockerignore
├── .gitignore
├── jsconfig.json
├── CONTRIBUTING.md
├── docker-compose.yml
├── LICENSE
└── README.md

Overall project structure

├── config/
│   ├── <Django Project Files>
├── frontend/
│   └── <Django App Files>
├── server/
│   ├── <Django App Files>
│   ├─── <RESTFramework Files>
|   └── templates
├── manage.py
└── requirements.txt

Backend Architecture

Summary

Backend Tech Stack: Django, DjangoRESTFramework

The backend architecture is consists the the Django config/ project, and the frontend/ and server/ Django apps. In addition to serving as part of our backend, the frontend/ directory also serves our frontend architecture. More about the frontend/ directory as it relates our frontend architecture can be found in our guide on Frontend Architecture.

Overview of Directories and Files

  • config/: houses the Django project files.
  • <Django Project Files>: More on the files in this directory can be found in Django's documentation.
  • <Django App>: currently we have two directories that are Django apps: frontend/ and server/. Within these directories are the default <Django App Files> that are created with every app as well as <RESTFramework Files>.
  • <Django App Files>: These files make up a Django App. To know more about these apps, read the section about Django App Files.
  • <RESTFramework Files>: Currently consists of only serializers.py, these files are additional files that support Django via the DjangoRestFramework library.
  • temaples/: contains swagger templates to host the swagger ui representation of our API.
  • manage.py: Part of Django, this is the entry point file for starting the Django server. This file handles a lot of critical settings, so be sure to read up on it in Django's documentation.
  • requirements.txt: A Python file that contains all dependencies for a project. It is the Python equivalent to Javascript's package.json.

Django App Files

├── migrations/
│   └── __init__.py
├── __init__.py
├── admin.py
├── apps.py
├── models.py
├── tests.py
├── urls.py
└── views.py

Files generated by Django when creating a new Django app

These files uses DjangoRestFramework in order to quickly create an API. The most often editted files here are models.py, urls.py, and views.py. The models define the schema for our database tables. Once the models are made, they are router to views.py where the data is transformed and exposed to our API. It is in views where we create handlers to manage REST operations.

Please refer to Django's documentation for more information.

Django REST Framework Files

├── serializers.py

RESTFramework files used to create a Django REST API

Serializers turn the data from the database into a Python-readable form.

Please refer to DjangoRESTFramework's documentation for more information.

Additional Resources

Django Documentation
DjangoRestFramework Documentation