# londonappdev/profiles-rest-api architecture

> Architecture diagram of the GitHub repository londonappdev/profiles-rest-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/londonappdev/profiles-rest-api
- Repository: https://github.com/londonappdev/profiles-rest-api

## Overview

##### Project type and purpose
- This is a backend REST API built in Python using Django and the Django REST Framework.
- It exposes endpoints for user profile data (profiles and profile feed items).
- The code is intended as course material for “Build a Backend REST API with Python & Django.”

##### File structure
- Top-level files:
– manage.py: Django’s command-line utility
– hello_world.py: simple test script
– requirements.txt: Python dependencies
– Vagrantfile: development VM configuration
– deploy/: contains deployment scripts and config for Nginx & Supervisor
- profiles_project/
– settings.py, urls.py, wsgi.py — the Django project configuration and entrypoint
- profiles_api/ (the core app)
– models.py, serializers.py, views.py, permissions.py, urls.py — defines REST resources
– migrations/: database schema versioning
– tests.py — unit tests

##### README for additional insights
- Confirms that this is sample code for a Udemy course on building REST APIs.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Clients
    Client["Clients (Postman, curl, mobile/web)"]:::external

    %% Development Environment
    Vagrant["Vagrant VM (env vars)"]:::deployment

    %% Reverse Proxy Layer
    Nginx["Nginx (80/443)"]:::proxy

    %% Process Management & WSGI
    Supervisor["Supervisor"]:::process
    Gunicorn["Gunicorn (WSGI Server)"]:::process

    %% Application Layer
    subgraph "Django Application" 
        direction TB
        subgraph "Project Configuration" 
            direction TB
            Settings["settings.py"]:::app
            URLsProj["urls.py"]:::app
            WSGI["wsgi.py"]:::app
        end
        subgraph "Core App: profiles_api"
            direction TB
            Models["models.py"]:::app
            Serializers["serializers.py"]:::app
            Views["views.py"]:::app
            Permissions["permissions.py"]:::app
            URLsApp["urls.py"]:::app
            Admin["admin.py"]:::app
            Apps["apps.py"]:::app
            subgraph "Migrations"
                direction TB
                MigInit["__init__.py"]:::app
                Mig1["0001_initial.py"]:::app
                Mig2["0002_profilefeeditem.py"]:::app
            end
            Tests["tests.py"]:::app
        end
    end

    %% Database Layer
    Database["SQLite/PostgreSQL"]:::db

    %% Deployment Scripts
    subgraph "Deployment Scripts & Config"
        direction TB
        NginxConf["nginx_profiles_api.conf"]:::deployment
        SupervisorConf["supervisor_profiles_api.conf"]:::deployment
        SetupScript["setup.sh"]:::deployment
        UpdateScript["update.sh"]:::deployment
    end

    %% Simple Files
    Manage["manage.py"]:::app
    Hello["hello_world.py"]:::app
    Requirements["requirements.txt"]:::app

    %% Flow
    Client -->|HTTP request| Nginx
    Nginx -->|forward to| Supervisor
    Supervisor -->|manage| Gunicorn
    Gunicorn -->|WSGI call| Settings
    Settings --> URLsProj
    URLsProj --> WSGI
    WSGI --> Views
    Views -->|ORM SQL| Database
    Database -->|data| Views
    Views -->|JSON response| Gunicorn
    Gunicorn -->|response| Nginx
    Nginx -->|HTTP response| Client

    Vagrant -->|env vars| Settings

    %% Click Events
    click Manage "https://github.com/londonappdev/profiles-rest-api/blob/master/manage.py"
    click Hello "https://github.com/londonappdev/profiles-rest-api/blob/master/hello_world.py"
    click Requirements "https://github.com/londonappdev/profiles-rest-api/blob/master/requirements.txt"
    click Vagrant "https://github.com/londonappdev/profiles-rest-api/tree/master/Vagrantfile"
    click NginxConf "https://github.com/londonappdev/profiles-rest-api/blob/master/deploy/nginx_profiles_api.conf"
    click SupervisorConf "https://github.com/londonappdev/profiles-rest-api/blob/master/deploy/supervisor_profiles_api.conf"
    click SetupScript "https://github.com/londonappdev/profiles-rest-api/blob/master/deploy/setup.sh"
    click UpdateScript "https://github.com/londonappdev/profiles-rest-api/blob/master/deploy/update.sh"
    click Settings "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_project/settings.py"
    click URLsProj "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_project/urls.py"
    click WSGI "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_project/wsgi.py"
    click Models "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/models.py"
    click Serializers "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/serializers.py"
    click Views "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/views.py"
    click Permissions "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/permissions.py"
    click URLsApp "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/urls.py"
    click Admin "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/admin.py"
    click Apps "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/apps.py"
    click MigInit "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/migrations/__init__.py"
    click Mig1 "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/migrations/0001_initial.py"
    click Mig2 "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/migrations/0002_profilefeeditem.py"
    click Tests "https://github.com/londonappdev/profiles-rest-api/blob/master/profiles_api/tests.py"

    %% Styles
    classDef external fill:#ccffcc,stroke:#006600,stroke-width:1px
    classDef proxy fill:#cce5ff,stroke:#004080,stroke-width:1px
    classDef process fill:#e5ccff,stroke:#800080,stroke-width:1px
    classDef app fill:#ffffcc,stroke:#808000,stroke-width:1px
    classDef db fill:#ffe5cc,stroke:#804000,stroke-width:1px
    classDef deployment fill:#f2f2f2,stroke:#666666,stroke-width:1px
```
