# juanjcardona13/graphene_django_cruddals architecture

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

- Interactive diagram: https://gitdiagram.com/juanjcardona13/graphene_django_cruddals
- Repository: https://github.com/juanjcardona13/graphene_django_cruddals

## Overview

##### Project type and purpose
- This is an open-source Python library (a Django extension) named graphene-django-cruddals.
- Its purpose is to auto-generate a full CRUD+DALS GraphQL API from Django models using Graphene.

##### File structure
- Top-level directories and files:
- graphene_django_cruddals/ – core code:
– client/ – JS client builder functions
– converters/ – logic to convert Django model fields into Graphene types (input, filters, relations, order-by, output)
– resolvers/ – GraphQL resolver implementations for CRUD operations
– scalars_type/ – custom scalars (DateTime, IntOrAll)
– utils/ – shared utilities
– views/ – Django GraphQL views (file uploads, etc.)
– main.py – entry point that ties converters, resolvers, schema generation
- docs/ – MkDocs-based documentation site
- tests/ – pytest suite covering converters, client builder, schema, integration
- setup.py, setup.cfg, Makefile, CI configs – package build, linting, testing, deployment

##### README for additional insights
- Confirms that users subclass `DjangoModelCruddals` and reference its `.Query` and `.Mutation` in their project’s Graphene schema.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Project Layer
    subgraph "User's Django Project" 
        direction TB
        UM["Django Models"]:::user
        SM["Subclass of\nDjangoModelCruddals"]:::user
    end

    %% Core Library Layer
    subgraph "graphene_django_cruddals Package" 
        direction TB
        subgraph "Core Modules"
            direction TB
            CONV["Converters Module\n(field→Graphene types)"]:::core
            click CONV "https://github.com/juanjcardona13/graphene_django_cruddals/tree/main/graphene_django_cruddals/converters/"
            SCHEMA_GEN["Schema Generator\n(main.py)"]:::core
            click SCHEMA_GEN "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/graphene_django_cruddals/main.py"
            RES["Resolvers\n(CRUD operations)"]:::core
            click RES "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/graphene_django_cruddals/resolvers/main.py"
            SCALARS["Custom Scalars"]:::core
            click SCALARS "https://github.com/juanjcardona13/graphene_django_cruddals/tree/main/graphene_django_cruddals/scalars_type/"
            UTILS["Shared Utilities"]:::core
            click UTILS "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/graphene_django_cruddals/utils/main.py"
        end
        subgraph "Client & Views"
            direction TB
            CB["Client Builder\n(JS SDK)"]:::core
            click CB "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/graphene_django_cruddals/client/build_functions.py"
            VIEWS1["GraphQL Views\n(cruddals_views)"]:::core
            click VIEWS1 "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/graphene_django_cruddals/views/cruddals_views.py"
            VIEWS2["File Upload View"]:::core
            click VIEWS2 "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/graphene_django_cruddals/views/file_upload_graphql_view.py"
        end
    end

    %% GraphQL Schema and Endpoint
    GS["Generated Graphene Schema"]:::core
    API["/graphql/ Endpoint"]:::external

    %% GraphQL Client SDK
    GQL_CLIENT["GraphQL JS Client"]:::external

    %% Supporting Infrastructure
    subgraph "Supporting Infrastructure"
        direction TB
        TESTS["Tests Suite (pytest)"]:::support
        click TESTS "https://github.com/juanjcardona13/graphene_django_cruddals/tree/main/tests/"
        DOCS["Documentation (MkDocs)"]:::support
        click DOCS "https://github.com/juanjcardona13/graphene_django_cruddals/tree/main/docs/"
        CI["CI/CD & Config"]:::support
        click CI "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/setup.py"
        click CI "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/setup.cfg"
        click CI "https://github.com/juanjcardona13/graphene_django_cruddals/tree/main/Makefile"
        click CI "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/.github/workflows/deploy.yml"
        click CI "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/.github/workflows/lint.yml"
        click CI "https://github.com/juanjcardona13/graphene_django_cruddals/blob/main/.github/workflows/tests.yml"
    end

    %% Flows
    UM -->|"introspect"| CONV
    SM -->|"binds Meta.model"| SCHEMA_GEN
    CONV -->|"produce types"| SCHEMA_GEN
    SCHEMA_GEN -->|"assemble types"| GS
    GS -->|"uses Resolvers"| RES
    GS -->|"exposed by"| VIEWS1
    GS -->|"exposed by"| VIEWS2
    VIEWS1 -->|serves| API
    VIEWS2 -->|serves| API
    GS -->|"generate JS"| CB
    CB -->|"outputs SDK"| GQL_CLIENT

    %% Supporting flows
    TESTS -->|"validate"| CONV
    TESTS -->|"validate"| SCHEMA_GEN
    TESTS -->|"validate"| RES
    DOCS -->|"document"| CONV
    DOCS -->|"document"| SCHEMA_GEN
    DOCS -->|"guide usage"| SM
    CI -->|"build/test"| CONV
    CI -->|"build/test"| SCHEMA_GEN
    CI -->|"build/test"| RES

    %% Styles
    classDef core fill:#AED6F1,stroke:#1B4F72,color:#000;
    classDef user fill:#ABEBC6,stroke:#196F3D,color:#000;
    classDef external fill:#F5B041,stroke:#A04000,color:#000;
    classDef support fill:#D7DBDD,stroke:#626567,color:#000;
```
