# medicotary/medicotary architecture

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

- Interactive diagram: https://gitdiagram.com/medicotary/medicotary
- Repository: https://github.com/medicotary/medicotary

## Overview

##### Project Type & Purpose
- Medicotary is a front-end web application built with React, using Redux for state management. Based on the README and file structure, its purpose is “a platform which empowers pharmacists with new age technology”, indicating it’s a full-featured user interface targeting the pharmacy domain.
- The provided Figma links suggest the design and prototyping work has been done externally, which reinforces the focus on robust UI/UX design.

##### Major Components
a. Frontend (Presentation Layer):
- Components: Show the reusable UI components (located under src/components) such as headers, footers, sidebars, forms, charts, and product tiles. Use clear labels (e.g., “LoginForm”, “Sidebar”, “Invoice Component”) to indicate their roles.
- Public Assets: Illustrate assets (public folder with index.html, manifest, etc.) responsible for bootstrapping the React application.

b. State Management & Business Logic:
- Redux Store: Include Redux configuration, demonstrating separate handling of actions, reducers (src/redux/reducers), sagas for asynchronous operations (src/redux/sagas), and selectors. Mark ‘redux’ as a central hub that interacts with UI components.
- Services: Represent the redux/services folder which encapsulates API calls or business logic. For example, services related to authentication, products, billing, and vendor management.

c. Configuration & Theming:
- Craco and Tailwind: Illustrate configuration files such as craco.config.js and tailwind.config.js to indicate theming and build customizations.

##### Relationships & Data Flow
- Data Flow: Emphasize the interaction between routes & components and the core state management. For example, indicate that the “LoginForm” component dispatches an action that is managed by the auth.saga, which in turn interacts with auth.service and relies on types from auth.types.
- Component Hierarchy: Separate components into “page-level” (e.g., dashboard, billing pages) and “reusable components” (e.g., charts, forms, headers) for clarity.

##### Architectural Patterns
- MVC (or variant): Represent the Model-View-Controller pattern implicitly by showing state (Redux "model"), UI components (View), and action/saga layers (Controller).
- Modular Structure: The file structure is modular and organized by functionality (authentication, billing, dashboard, etc.). Indicate these modules clearly.
- Separation of Concerns: Illustrate that styling (Tailwind), configuration (craco, Tailwind config), and business logic (Redux services and sagas) are clearly separated.

##### Additional Elements
- GitHub Workflows & Development Practices: Optionally, note the existence of development infrastructure (CI/CD pipelines in .github/workflows) which impacts deployment and development.

## Diagram (Mermaid)

```mermaid
graph TD
    User("User"):::user

    subgraph "Presentation Layer"
        Routes("Views & Routing"):::presentation
        Components("UI Components"):::presentation
        Assets("Public Assets"):::assets
    end

    subgraph "State Management & Business Logic"
        Redux("Redux Store"):::state
        Services("Services"):::state
    end

    subgraph "Configuration & Theming"
        Craco("Craco Config"):::config
        Tailwind("Tailwind Config"):::config
        ReduxConfig("Redux Config"):::config
    end

    subgraph "DevOps & CI/CD"
        Workflows("GitHub Workflows"):::devops
    end

    User -->|"interacts"| Routes
    Routes -->|"dispatchesAction"| Redux
    Components -->|"triggersAction"| Redux
    Redux -->|"calls"| Services
    Services -->|"updates"| Redux
    Redux -->|"passesState"| Routes
    Redux -->|"notifies"| Components
    Assets -->|"bootstraps"| Routes

    Redux ---|"uses"| ReduxConfig
    Redux ---|"configuredBy"| Craco
    Redux ---|"styledBy"| Tailwind

    Workflows ---|"integrates"| Redux
    Workflows ---|"integrates"| Routes
    Workflows ---|"integrates"| Components

    click Routes "https://github.com/medicotary/medicotary/tree/main/src/routes"
    click Components "https://github.com/medicotary/medicotary/tree/main/src/components"
    click Assets "https://github.com/medicotary/medicotary/tree/main/public"
    click Redux "https://github.com/medicotary/medicotary/tree/main/src/redux"
    click Services "https://github.com/medicotary/medicotary/tree/main/src/redux/services"
    click Craco "https://github.com/medicotary/medicotary/blob/main/craco.config.js"
    click Tailwind "https://github.com/medicotary/medicotary/blob/main/tailwind.config.js"
    click ReduxConfig "https://github.com/medicotary/medicotary/tree/main/src/redux/config"
    click Workflows "https://github.com/medicotary/medicotary/tree/main/.github/workflows"

    classDef presentation fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef state fill:#D5F5E3,stroke:#186A3B,stroke-width:2px;
    classDef config fill:#FCF3CF,stroke:#B9770E,stroke-width:2px;
    classDef assets fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
    classDef devops fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef user fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
```
