# nubank/nuvigator architecture

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

- Interactive diagram: https://gitdiagram.com/nubank/nuvigator
- Repository: https://github.com/nubank/nuvigator

## Overview

##### Main Components

a) Core Navigation Layer:
- Nuvigator Core (Central component)
- Route Management System
- Deep Link Handler
- Screen Type Manager

b) Screen Types:
- Material Screen Type
- Cupertino Screen Type

c) Integration Components:
- Flutter Navigation Bridge
- Deep Link Parser
- Nested Navigation Handler

##### Key Architectural Elements

- Router Hierarchy (Parent-Child relationship)
- Screen Type Abstraction
- Deep Link Processing Pipeline
- Route Registration System

**Rectangle: Core Components**
**Hexagon: Screen Types**
**Diamond: Integration Points**

##### Component Relationships

- [Flutter Navigation System]
- ↑

**[Deep Link Handler] →  [Nuvigator Core] ← [Route Management]**
- ↓                    ↓                    ↓
**[Deep Link Parser]    [Screen Type Manager]  [Route Registry]**
- /        \
- [Material]  /          \  [Cupertino]
- /            \
- [Screen Types]  [Nested Navigation]

##### Implementation Details

- Route registration flow
- Navigation request processing
- Screen type selection logic
- Deep link resolution pipeline

##### Additional Notes

Annotations for:
- File locations for key components
- Configuration points
- Extension mechanisms
- Testing integration points

Remember to include a section showing how the package integrates with a typical Flutter application, demonstrating the relationship between the MaterialApp, Nuvigator, and custom routes.

This architecture should reflect the project's structure as seen in the lib/src directory, where core components are separated into distinct files (deeplink.dart, nu_router.dart, nuvigator.dart, etc.), while maintaining the modularity that allows for easy extension and customization.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef screen fill:#4CAF50,stroke:#2E7D32,color:white
    classDef integration fill:#FF9800,stroke:#EF6C00,color:white
    classDef deeplink fill:#9C27B0,stroke:#6A1B9A,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Screen Types]:::screen
        L3[Integration Points]:::integration
        L4[Deep Link Components]:::deeplink
    end

    %% Main Components
    FNS[Flutter Navigation System]:::integration
    NC[Nuvigator Core]:::core
    RMS[Route Management System]:::core
    DLH[Deep Link Handler]:::deeplink
    STM[Screen Type Manager]:::core
    DLP[Deep Link Parser]:::deeplink
    RR[Route Registry]:::core
    RSH[Route Settings Handler]:::core
    SRM[Screen Route Manager]:::core
    TDS[Type Definitions System]:::core

    %% Screen Types
    MST[Material Screen Type]:::screen
    CST[Cupertino Screen Type]:::screen
    NNH[Nested Navigation Handler]:::integration

    %% Relationships
    FNS --> NC
    NC --> STM
    NC --> RMS
    DLH --> NC
    DLH --> DLP
    RMS --> RR
    RMS --> RSH
    RMS --> SRM
    STM --> MST
    STM --> CST
    STM --> NNH
    
    %% Click Events
    click NC "https://github.com/nubank/nuvigator/blob/master/lib/src/nuvigator.dart"
    click RMS "https://github.com/nubank/nuvigator/blob/master/lib/src/nu_router.dart"
    click DLH "https://github.com/nubank/nuvigator/blob/master/lib/src/deeplink.dart"
    click STM "https://github.com/nubank/nuvigator/blob/master/lib/src/screen_type.dart"
    click MST "https://github.com/nubank/nuvigator/blob/master/lib/src/screen_types/material_screen_type.dart"
    click CST "https://github.com/nubank/nuvigator/blob/master/lib/src/screen_types/cupertino_screen_type.dart"
    click RSH "https://github.com/nubank/nuvigator/blob/master/lib/src/nu_route_settings.dart"
    click SRM "https://github.com/nubank/nuvigator/blob/master/lib/src/screen_route.dart"
    click NNH "https://github.com/nubank/nuvigator/blob/master/test/nested_nuvigator_test.dart"
    click TDS "https://github.com/nubank/nuvigator/blob/master/lib/src/typings.dart"
```
