# unlmaestriasw/sistemagcp architecture

> Architecture diagram of the GitHub repository unlmaestriasw/sistemagcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unlmaestriasw/sistemagcp
- Repository: https://github.com/unlmaestriasw/sistemagcp

## Overview

This repository is a Django-based management system for software test cases, organized with a DDD-flavored, multi-app structure. The main business areas are separated into three Django apps: `seguridad` for authentication/authorization and audit features, `proyecto` for project/test-management workflows, and `core` for shared infrastructure and generic application support.

#### High-level architecture

The system is split into these main layers:

1. **Configuration/bootstrap**
   - `cfg/` contains the Django project configuration (`settings.py`, `urls.py`, `asgi.py`, `wsgi.py`).
   - `manage.py` is the Django entry point.
   - `ddd/` contains cross-cutting project helpers such as custom app config and template/static finders.

2. **Domain/Application/Infrastructure/Presentation per app**
   - Each major app follows a layered structure:
     - `domain/` for business entities and domain types
     - `application/` for use-case orchestration and service classes
     - `infraestructure/` for persistence concerns, mainly Django migrations and model evolution
     - `presentation/` for views, forms, templates, static JS/CSS, admin integration, and template tags
   - `proyecto` additionally has a `services/` package that exposes API-oriented endpoints and serializers alongside the classic server-rendered MVC views.

3. **Shared presentation assets**
   - A top-level `presentation/` directory holds shared base templates, layout fragments, and plugin includes.
   - A top-level `static/` directory contains global front-end assets and third-party libraries.

4. **Persistence**
   - The repository includes `db.sqlite3`, indicating SQLite is the current backing database for development or lightweight deployment.
   - Persistence is managed through Django models and migrations; there is no separate database service defined in the tree.

#### Main subsystems

##### 1) Seguridad: identity, sessions, notifications, and audit
The `app/seguridad` app is the security and user-management subsystem. It includes:

- **Application services**
  - `usuario_app_service.py`
  - `session_app_service.py`
  - `log_app_service.py`
  - `notificacion_app_service.py`
  - `signals.py`
  - `tasks.py`

- **Domain**
  - `domain/models.py` defines the security-related entities.

- **Infrastructure**
  - Migrations for audit/log evolution and user-related persistence.

- **Presentation**
  - Login, password change, email flow, dashboard pages, user/notification templates.
  - JS modules for log/session dashboards and notification/user screens.
  - Custom forms and template tags.

- **Security boundary**
  - `security/middleware.py` and `security/permissions.py` enforce request-level behavior and authorization rules.
  - This is the main boundary between anonymous/public access, authenticated users, and restricted management views.

**Architectural role:** this app centralizes access control, user interaction with authentication flows, activity logging, and notifications. It likely acts as the cross-cutting security layer for the rest of the system.

##### 2) Proyecto: test-case management domain
The `app/proyecto` app is the core business subsystem for managing projects and the testing lifecycle.

It is split into multiple functional areas:

- **Project management**
  - `proyecto_app_service.py`
  - `domain/models.py`
  - Presentation templates/views/static for create, list, detail, and edit workflows.

- **Test case management**
  - `caso_pruebas_app_service.py`
  - Forms, views, templates, and JS for case listing and creation.

- **Test cycle management**
  - `ciclo_pruebas_app_service.py`
  - Forms, views, templates, and JS for cycle creation/listing.

- **Test execution management**
  - Presentation and application support for execution editing and listing.

- **API/service boundary**
  - `services/api_views.py`
  - `services/api_urls.py`
  - `services/serializers.py`
  - `services/mvc_urls.py`

This indicates two interaction modes:
- **Traditional server-rendered MVC** via Django views/templates.
- **API-style endpoints** for programmatic access or asynchronous UI calls.

**Architectural role:** this is the main business workflow boundary where a project is associated with test cases, cycles, and execution records. It is the repository’s primary domain.

##### 3) Core: shared foundation
The `app/core` app contains shared abstractions and generic functionality:

- `application/BaseAppService.py` and `core_app_service.py` suggest common service behavior reused by other app services.
- `domain/dto/datatable.py` indicates shared DTO support for table/listing responses.
- `presentation/views/views.py`, template tags, admin integration, and tests.
- Migrations and domain models exist here as well, so core is not only utility code; it also has its own persistent entities.

**Architectural role:** this is the shared foundation layer, likely used for generic CRUD/listing behavior and reusable UI/backend helpers across the other apps.

#### Data flow by layer

##### Typical request flow for server-rendered screens
1. A browser requests a page through Django URL routing in `cfg/urls.py`.
2. The request is dispatched to an app-specific URL module, such as:
   - `seguridad/services/urls/*.py`
   - `proyecto/services/mvc_urls.py`
3. A presentation view handles the request and may use a form class.
4. The view delegates business operations to an application service in the same app.
5. The application service interacts with domain entities and persistence-backed Django models.
6. The response is rendered using templates, often extending shared base layouts from the top-level `presentation/templates/`.
7. Static assets from `static/` or app-specific static folders provide JS behavior, AJAX calls, table controls, and UI feedback.

##### API/data-serialization flow in `proyecto`
1. Client-side JS under `app/proyecto/presentation/static/js/...` issues requests to API endpoints.
2. `services/api_views.py` handles these requests.
3. `services/serializers.py` translates domain/persistence data into API-friendly structures.
4. Responses are returned to the frontend to update tables, forms, or detail screens dynamically.

##### Security/audit flow
1. Authentication and session-related interactions start in `seguridad/presentation/views/views_autenticacion.py`.
2. Permission and middleware layers intercept requests and determine access.
3. Signals and background tasks in `seguridad/application/` can react to events such as user actions, logging, or notifications.
4. Audit records are persisted via the security domain/infrastructure layer and later visualized in dashboard templates.

#### UI and front-end structure

The repository is strongly template-driven, with significant client-side enhancement:

- Shared base templates live in `presentation/templates/`.
- App-specific templates live under each app’s `presentation/templates/`.
- There is extensive use of:
  - Bootstrap
  - AdminLTE
  - jQuery
  - DataTables
  - SweetAlert2
  - Font Awesome
- JS is organized per feature area, especially in `proyecto/presentation/static/js/` and `seguridad/presentation/static/js/`.

This suggests the UI architecture is centered around CRUD dashboards with table-heavy interaction patterns, modal or form-driven editing, and client-side convenience behavior.

#### Important boundaries to show in an architecture diagram

##### 1) Django project boundary
- `cfg/` is the top-level composition root.
- All apps plug into Django through settings, app configs, and URL routing.

##### 2) App boundaries
- `core`, `proyecto`, and `seguridad` are separate business modules.
- Each has its own internal layering and templates/static assets.
- `proyecto` is the most feature-rich and includes both MVC and API surfaces.

##### 3) Presentation vs application vs domain vs infrastructure
- Presentation: HTTP views, forms, templates, admin, static JS/CSS, template tags.
- Application: use-case services and orchestration.
- Domain: entities and DTOs.
- Infrastructure: migrations and persistence evolution.

##### 4) Security cross-cutting boundary
- Middleware, permissions, signals, and tasks in `seguridad` affect multiple other modules.
- This layer should be drawn as a cross-cutting concern spanning the whole app, not just one feature module.

##### 5) Shared UI foundation
- Top-level `presentation/` and `static/` should be shown as shared resources consumed by all apps.

#### Overall system shape

At a glance, the system is a monolithic Django application with:
- a shared project shell,
- multiple bounded business modules,
- layered internal structure,
- a mix of server-rendered and API-driven screens,
- and a strong emphasis on security, auditability, and table-based CRUD workflows.

If you draw it, the clearest diagram is a layered monolith:
- **Entry points:** Django URL routing, middleware, and app views
- **Business modules:** Seguridad, Proyecto, Core
- **Use-case orchestration:** application services
- **State and persistence:** Django models + migrations + SQLite
- **UI delivery:** shared templates + app templates + static JS/CSS

Main entry points: [`cfg/settings.py`](https://github.com/unlmaestriasw/sistemagcp/blob/main/cfg/settings.py) (Settings), [`app/seguridad`](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad) (Seguridad), [`app/proyecto`](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto) (Proyecto), [`app/core`](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core) (Core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_bootstrap["Bootstrap"]
  node_manage_py(("manage.py<br/>entrypoint<br/>[manage.py]"))
  node_cfg_settings["Settings<br/>django-config<br/>[settings.py]"]
  node_cfg_urls["URL routes<br/>django-routing<br/>[urls.py]"]
  node_ddd_helpers["DDD helpers<br/>project-helpers<br/>[__init__.py]"]
end

subgraph group_group_apps["Django apps"]
  node_core_app["Core<br/>shared-app"]
  node_core_services["Core services<br/>service-layer"]
  node_core_domain["Core domain<br/>domain-layer"]
  node_core_ui["Core UI<br/>presentation-layer"]
  node_seguridad_app["Seguridad<br/>security-app"]
  node_seguridad_security{{"Security boundary<br/>middleware-permissions"}}
  node_seguridad_services_app["Security services<br/>service-layer"]
  node_seguridad_domain["Security domain<br/>domain-layer"]
  node_seguridad_ui["Security UI<br/>presentation-layer"]
  node_seguridad_routes["Security URLs<br/>routing"]
  node_proyecto_app["Proyecto<br/>business-app"]
  node_proyecto_services["Project API<br/>api-and-routing"]
  node_proyecto_services_app["Project services<br/>service-layer"]
  node_proyecto_domain["Project domain<br/>domain-layer"]
  node_proyecto_ui["Project UI<br/>presentation-layer"]
end

subgraph group_group_shared["Shared UI"]
  node_shared_templates["Base templates<br/>ui-foundation"]
  node_shared_static["Global static<br/>asset-pack"]
end

subgraph group_group_data["Persistence"]
  node_sqlite_db[("SQLite DB<br/>database<br/>[db.sqlite3]")]
end

node_manage_py -->|"bootstraps"| node_cfg_settings
node_cfg_settings -->|"wires"| node_cfg_urls
node_cfg_settings -->|"uses"| node_ddd_helpers
node_cfg_settings -->|"installs"| node_core_app
node_cfg_settings -->|"installs"| node_seguridad_app
node_cfg_settings -->|"installs"| node_proyecto_app
node_cfg_settings -->|"maps"| node_shared_templates
node_cfg_settings -->|"serves"| node_shared_static
node_cfg_urls -->|"routes to"| node_seguridad_routes
node_cfg_urls -->|"routes to"| node_proyecto_services
node_seguridad_security -.->|"protects"| node_cfg_urls
node_core_app -->|"orchestrates"| node_core_services
node_core_app -->|"defines"| node_core_domain
node_core_app -->|"renders"| node_core_ui
node_seguridad_app -->|"guards"| node_seguridad_security
node_seguridad_app -->|"coordinates"| node_seguridad_services_app
node_seguridad_app -->|"models"| node_seguridad_domain
node_seguridad_app -->|"presents"| node_seguridad_ui
node_seguridad_ui -->|"extends"| node_shared_templates
node_seguridad_ui -->|"uses"| node_shared_static
node_proyecto_app -->|"coordinates"| node_proyecto_services_app
node_proyecto_app -->|"models"| node_proyecto_domain
node_proyecto_app -->|"presents"| node_proyecto_ui
node_proyecto_app -->|"exposes"| node_proyecto_services
node_proyecto_services -->|"feeds"| node_proyecto_ui
node_proyecto_ui -->|"extends"| node_shared_templates
node_proyecto_ui -->|"uses"| node_shared_static
node_seguridad_domain -->|"persists"| node_sqlite_db
node_proyecto_domain -->|"persists"| node_sqlite_db
node_core_domain -->|"persists"| node_sqlite_db

click node_manage_py "https://github.com/unlmaestriasw/sistemagcp/blob/main/manage.py"
click node_cfg_settings "https://github.com/unlmaestriasw/sistemagcp/blob/main/cfg/settings.py"
click node_cfg_urls "https://github.com/unlmaestriasw/sistemagcp/blob/main/cfg/urls.py"
click node_ddd_helpers "https://github.com/unlmaestriasw/sistemagcp/blob/main/ddd/__init__.py"
click node_core_app "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core"
click node_core_services "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core/application"
click node_core_domain "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core/domain"
click node_core_ui "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core/presentation"
click node_seguridad_app "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad"
click node_seguridad_security "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/security"
click node_seguridad_services_app "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/application"
click node_seguridad_domain "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/domain"
click node_seguridad_ui "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/presentation"
click node_seguridad_routes "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/services/urls"
click node_proyecto_app "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto"
click node_proyecto_services "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/services"
click node_proyecto_services_app "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/application"
click node_proyecto_domain "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/domain"
click node_proyecto_ui "https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/presentation"
click node_shared_templates "https://github.com/unlmaestriasw/sistemagcp/tree/main/presentation/templates"
click node_shared_static "https://github.com/unlmaestriasw/sistemagcp/tree/main/static"
click node_sqlite_db "https://github.com/unlmaestriasw/sistemagcp/blob/main/db.sqlite3"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_manage_py,node_cfg_settings,node_cfg_urls,node_ddd_helpers toneBlue
class node_core_app,node_core_services,node_core_domain,node_core_ui,node_seguridad_app,node_seguridad_security,node_seguridad_services_app,node_seguridad_domain,node_seguridad_ui,node_seguridad_routes,node_proyecto_app,node_proyecto_services,node_proyecto_services_app,node_proyecto_domain,node_proyecto_ui toneAmber
class node_shared_templates,node_shared_static toneMint
class node_sqlite_db toneRose
```

## Components

### Bootstrap

Django project shell and cross-cutting configuration

- [manage.py](https://github.com/unlmaestriasw/sistemagcp/blob/main/manage.py): entrypoint · Django command entrypoint · `manage.py`
- [Settings](https://github.com/unlmaestriasw/sistemagcp/blob/main/cfg/settings.py): django-config · Project settings and composition root · `cfg/settings.py`
- [URL routes](https://github.com/unlmaestriasw/sistemagcp/blob/main/cfg/urls.py): django-routing · Root URL dispatcher · `cfg/urls.py`
- [DDD helpers](https://github.com/unlmaestriasw/sistemagcp/blob/main/ddd/__init__.py): project-helpers · Custom app config and template/static finders · `ddd/__init__.py`

### Django apps

Business modules with layered internal structure

- [Core](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core): shared-app · Shared application services and UI helpers · `app/core`
- [Core services](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core/application): service-layer · Base service abstractions and generic app services · `app/core/application`
- [Core domain](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core/domain): domain-layer · Shared DTOs and core entities · `app/core/domain`
- [Core UI](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/core/presentation): presentation-layer · Shared views, admin, and template tags · `app/core/presentation`
- [Seguridad](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad): security-app · Identity, sessions, notifications, and audit · `app/seguridad`
- [Security boundary](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/security): middleware-permissions · Request interception and authorization · `app/seguridad/security`
- [Security services](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/application): service-layer · User, session, log, notification services and events · `app/seguridad/application`
- [Security domain](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/domain): domain-layer · Security and audit entities · `app/seguridad/domain`
- [Security UI](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/presentation): presentation-layer · Authentication, dashboard, and security screens · `app/seguridad/presentation`
- [Security URLs](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/seguridad/services/urls): routing · Authentication and security route modules · `app/seguridad/services/urls`
- [Proyecto](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto): business-app · Project, test case, cycle, and execution workflows · `app/proyecto`
- [Project API](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/services): api-and-routing · MVC and API endpoints plus serializers · `app/proyecto/services`
- [Project services](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/application): service-layer · Project, case, and cycle use-case services · `app/proyecto/application`
- [Project domain](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/domain): domain-layer · Project and test-management entities · `app/proyecto/domain`
- [Project UI](https://github.com/unlmaestriasw/sistemagcp/tree/main/app/proyecto/presentation): presentation-layer · Forms, views, templates, and feature JS · `app/proyecto/presentation`

### Shared UI

Repository-wide templates and front-end assets

- [Base templates](https://github.com/unlmaestriasw/sistemagcp/tree/main/presentation/templates): ui-foundation · Shared layouts and page fragments · `presentation/templates`
- [Global static](https://github.com/unlmaestriasw/sistemagcp/tree/main/static): asset-pack · Global CSS, JS, and third-party libraries · `static`

### Persistence

Local database storage

- [SQLite DB](https://github.com/unlmaestriasw/sistemagcp/blob/main/db.sqlite3): database · Local development database file · `db.sqlite3`

## Connections

- manage.py → Settings: bootstraps · Django command flow starts with project settings
- Settings → URL routes: wires · Settings activate the root routing table
- Settings → DDD helpers: uses · Registers custom project helpers
- Settings → Core: installs · Loads shared app into Django
- Settings → Seguridad: installs · Loads security app into Django
- Settings → Proyecto: installs · Loads business app into Django
- Settings → Base templates: maps · Exposes shared template base
- Settings → Global static: serves · Exposes global static assets
- URL routes → Security URLs: routes to · Dispatches security and authentication URLs
- URL routes → Project API: routes to · Dispatches project MVC and API URLs
- Security boundary → URL routes: protects · Applies cross-cutting access control
- Core → Core services: orchestrates · Shared service layer for common behavior
- Core → Core domain: defines · Shared DTOs and core entities
- Core → Core UI: renders · Shared presentation helpers and views
- Seguridad → Security boundary: guards · Request interception and authorization boundary
- Seguridad → Security services: coordinates · Application services and event reactions
- Seguridad → Security domain: models · Security and audit entities
- Seguridad → Security UI: presents · Authentication and security screens
- Security UI → Base templates: extends · Uses shared layouts and fragments
- Security UI → Global static: uses · Uses global front-end assets
- Proyecto → Project services: coordinates · Use-case services for project workflows
- Proyecto → Project domain: models · Project and test management entities
- Proyecto → Project UI: presents · Server-rendered CRUD and feature UI
- Proyecto → Project API: exposes · API and MVC service boundary
- Project API → Project UI: feeds · Supports AJAX and dynamic screens
- Project UI → Base templates: extends · Uses shared base templates
- Project UI → Global static: uses · Uses shared JS/CSS and libraries
- Security domain → SQLite DB: persists · Security and audit state stored in SQLite
- Project domain → SQLite DB: persists · Project and test data stored in SQLite
- Core domain → SQLite DB: persists · Shared core state stored in SQLite
