# ritwikhero/systemdesign architecture

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

- Interactive diagram: https://gitdiagram.com/ritwikhero/systemdesign
- Repository: https://github.com/ritwikhero/systemdesign

## Overview

This repository is a set of Java design-pattern and object-oriented design examples, plus model classes for a food-delivery domain. It does not present a single documented user-to-result workflow: the examples are separate, and the delivery area contains domain models in the supplied tree. The tree identifies components, but no README or source excerpts were provided to verify calls, data flow, or how Main relates to the examples. Accordingly, the graph groups the visible subject areas without inferring connections between them.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_factories["Factory Patterns"]
  node_simple_factory["Simple Factory<br/>[SimpleFactory.java]"]
  node_factory_method["Factory Pattern"]
  node_abstract_factory["Abstract Factory"]
end

subgraph group_singletons["Singleton Patterns"]
  node_singleton_simple["Simple Singleton"]
  node_singleton_none["No Singleton<br/>[NoSingleton.java]"]
  node_singleton_eager["Eager Singleton"]
  node_singleton_locking["Locking Singleton"]
  node_singleton_double_lock["Double-Lock Singleton"]
end

subgraph group_strategy["Strategy Pattern"]
  node_strategy_demo["Strategy Example"]
end

subgraph group_solid["Document Editor Design"]
  node_editor_bad["Bad Editor Design"]
  node_editor_good["Good Editor Design"]
end

subgraph group_delivery["Food Delivery Models"]
  node_cart["Cart<br/>[Cart.java]"]
  node_menu_item["Menu Item<br/>[MenuItem.java]"]
  node_order["Order<br/>[Order.java]"]
  node_restaurant["Restaurant<br/>[Restaurant.java]"]
  node_user["User<br/>[User.java]"]
end

node_main["Main<br/>[Main.java]"]

click node_simple_factory "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/FactoryDesignPattern/SimpleFactory/SimpleFactory.java"
click node_factory_method "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/FactoryDesignPattern/FactoryPattern/FactoryDesignPattern.java"
click node_abstract_factory "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/FactoryDesignPattern/AbstractFactory/AbstractFactoryPattern.java"
click node_singleton_simple "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/SimpleSingleton.java"
click node_singleton_none "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/NoSingleton.java"
click node_singleton_eager "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/ThreadSafeEagerSingleton.java"
click node_singleton_locking "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/ThreadSafeLockingSingleton.java"
click node_singleton_double_lock "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/ThreadSafeDoubleLockingSingleton.java"
click node_strategy_demo "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/StrategyDesignPattern/StrategyDesignPattern.java"
click node_editor_bad "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SOLID_Principles/Document_Editor/Bad_Design/DocumentEditorClient.java"
click node_editor_good "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SOLID_Principles/Document_Editor/Good_Design/DocumentEditorClient.java"
click node_cart "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/Cart.java"
click node_menu_item "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/MenuItem.java"
click node_order "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/Order.java"
click node_restaurant "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/Restaurant.java"
click node_user "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/User.java"
click node_main "https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/Main.java"

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_simple_factory,node_factory_method,node_abstract_factory toneBlue
class node_singleton_simple,node_singleton_none,node_singleton_eager,node_singleton_locking,node_singleton_double_lock toneAmber
class node_strategy_demo toneMint
class node_editor_bad,node_editor_good toneRose
class node_cart,node_menu_item,node_order,node_restaurant,node_user toneIndigo
class node_main toneTeal
```

## Components

### Factory Patterns

- [Simple Factory](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/FactoryDesignPattern/SimpleFactory/SimpleFactory.java): `src/main/java/org/example/FactoryDesignPattern/SimpleFactory/SimpleFactory.java`
- [Factory Pattern](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/FactoryDesignPattern/FactoryPattern/FactoryDesignPattern.java): `src/main/java/org/example/FactoryDesignPattern/FactoryPattern/FactoryDesignPattern.java`
- [Abstract Factory](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/FactoryDesignPattern/AbstractFactory/AbstractFactoryPattern.java): `src/main/java/org/example/FactoryDesignPattern/AbstractFactory/AbstractFactoryPattern.java`

### Singleton Patterns

- [Simple Singleton](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/SimpleSingleton.java): `src/main/java/org/example/SingletonDesignPattern/SimpleSingleton.java`
- [No Singleton](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/NoSingleton.java): `src/main/java/org/example/SingletonDesignPattern/NoSingleton.java`
- [Eager Singleton](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/ThreadSafeEagerSingleton.java): `src/main/java/org/example/SingletonDesignPattern/ThreadSafeEagerSingleton.java`
- [Locking Singleton](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/ThreadSafeLockingSingleton.java): `src/main/java/org/example/SingletonDesignPattern/ThreadSafeLockingSingleton.java`
- [Double-Lock Singleton](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SingletonDesignPattern/ThreadSafeDoubleLockingSingleton.java): `src/main/java/org/example/SingletonDesignPattern/ThreadSafeDoubleLockingSingleton.java`

### Strategy Pattern

- [Strategy Example](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/StrategyDesignPattern/StrategyDesignPattern.java): `src/main/java/org/example/StrategyDesignPattern/StrategyDesignPattern.java`

### Document Editor Design

- [Bad Editor Design](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SOLID_Principles/Document_Editor/Bad_Design/DocumentEditorClient.java): `src/main/java/org/example/SOLID_Principles/Document_Editor/Bad_Design/DocumentEditorClient.java`
- [Good Editor Design](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SOLID_Principles/Document_Editor/Good_Design/DocumentEditorClient.java): `src/main/java/org/example/SOLID_Principles/Document_Editor/Good_Design/DocumentEditorClient.java`

### Food Delivery Models

- [Cart](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/Cart.java): `src/main/java/org/example/SwiggyZomatoLLD/Model/Cart.java`
- [Menu Item](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/MenuItem.java): `src/main/java/org/example/SwiggyZomatoLLD/Model/MenuItem.java`
- [Order](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/Order.java): `src/main/java/org/example/SwiggyZomatoLLD/Model/Order.java`
- [Restaurant](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/Restaurant.java): `src/main/java/org/example/SwiggyZomatoLLD/Model/Restaurant.java`
- [User](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/SwiggyZomatoLLD/Model/User.java): `src/main/java/org/example/SwiggyZomatoLLD/Model/User.java`

### Other components

- [Main](https://github.com/ritwikhero/systemdesign/blob/main/src/main/java/org/example/Main.java): `src/main/java/org/example/Main.java`
