# ashish-ranjan/recipe-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/ashish-ranjan/recipe-management-system
- Repository: https://github.com/ashish-ranjan/recipe-management-system

## Overview

Based on our analysis of the file tree and the README, this project is a full-stack web application called “My Favorite Recipes.” Its primary purpose is to allow users to register, log in, and manage their recipes through an Angular frontend that communicates with a lightweight Node.js backend API server. The backend uses NeDB for data persistence via two dedicated database files (user.db for authentication and recipe.db for recipe data).

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly note that the presentation layer (Angular frontend) and the data/service layer (Node.js API server and NeDB) are distinctly separated.
- Modular Structure: The Angular code is organized into feature-based modules (header, footer, login, signup, recipes, etc.) and the backend is kept minimal and focused on serving API endpoints.
- Use of Services: Highlight how the Angular services (auth.service and recipe.service) abstract the API calls and handle data logic.
- Testing and Configuration: Briefly note that unit and e2e tests are integrated (using Karma and Protractor) and that the project config files (angular.json, tsconfig.json) support a robust development environment.

- At the top level, show the User Interaction entering through a web browser that accesses the “Angular Client.”
- API server to the databases to complete the full flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level: User Interaction
    User["User (Browser)"]:::user

    %% Angular Client Subgraph
    subgraph "Angular Client (Port 4200)"
        AC1["Header Component"]:::angular
        AC2["Footer Component"]:::angular
        AC3["Login Component"]:::angular
        AC4["Signup Component"]:::angular

        subgraph "Recipe Components"
            RC1["Recipe Detail Component"]:::angular
            RC2["Recipe Edit Component"]:::angular
            RC3["Recipe List & Recipe Item Components"]:::angular
            RC4["Recipe Start Component"]:::angular
        end

        AR["App Routing Module"]:::angularRouting

        subgraph "Angular Services"
            AS1["Auth Service"]:::angularService
            AS2["Recipe Service"]:::angularService
            AS3["Auth Guard"]:::angularService
        end

        subgraph "Entry Points"
            EP1["main.ts"]:::angularEntry
            EP2["index.html"]:::angularEntry
        end
    end

    %% Backend API Server Subgraph
    subgraph "Node.js API Server (Port 3000)"
        BS["Backend API Server (dbServer.js)"]:::backend
    end

    %% NeDB Databases Subgraph
    subgraph "NeDB Databases"
        ND1["user.db"]:::database
        ND2["recipe.db"]:::database
    end

    %% Data Flow Connections
    User -->|"Access applications"| AC1
    User -->|"Access applications"| AC2
    User -->|"Access applications"| AC3
    User -->|"Access applications"| AC4

    %% Angular routing directs to recipe components
    AR -->|"routesTo"| RC1
    AR -->|"routesTo"| RC2
    AR -->|"routesTo"| RC3
    AR -->|"routesTo"| RC4

    %% Angular Services API calls to Backend Server
    AS1 -->|"APIcall"| BS
    AS2 -->|"APIcall"| BS
    AS3 -->|"APIguard"| BS

    %% UI interactions triggering services
    AC3 -->|"triggersLogin"| AS1

    %% Backend Server interacts with Databases
    BS -->|"ReadWrite"| ND1
    BS -->|"ReadWrite"| ND2

    %% Backend responding to Angular Services and UI
    BS -->|"response"| AS1
    BS -->|"response"| AS2
    BS -->|"response"| AC3

    %% Click Events for Angular Client - UI Components
    click AC1 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/header/header.component.ts"
    click AC2 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/footer/footer.component.ts"
    click AC3 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/login/login.component.ts"
    click AC4 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/signup/signup.component.ts"
    click RC1 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/recipes/recipe-detail/recipe-detail.component.ts"
    click RC2 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/recipes/recipe-edit/recipe-edit.component.ts"
    click RC3 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/recipes/recipe-list/recipe-list.component.ts"
    click RC4 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/recipes/recipe-start/recipe-start.component.ts"

    %% Click Events for Angular Client - Routing Module
    click AR "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/app-routing.module.ts"

    %% Click Events for Angular Client - Services
    click AS1 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/services/auth.service.ts"
    click AS2 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/services/recipe.service.ts"
    click AS3 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/app/services/auth.guard.ts"

    %% Click Events for Angular Client - Entry Points
    click EP1 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/main.ts"
    click EP2 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/src/index.html"

    %% Click Event for Backend API Server
    click BS "https://github.com/ashish-ranjan/recipe-management-system/blob/master/dbServer.js"

    %% Click Events for NeDB Databases
    click ND1 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/user.db"
    click ND2 "https://github.com/ashish-ranjan/recipe-management-system/blob/master/recipe.db"

    %% Styles
    classDef angular fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef angularService fill:#c5e1a5,stroke:#33691e,stroke-width:2px;
    classDef angularRouting fill:#e1bee7,stroke:#6a1b9a,stroke-width:2px;
    classDef angularEntry fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef backend fill:#a5d6a7,stroke:#1b5e20,stroke-width:2px,stroke-dasharray: 5 5;
    classDef database fill:#f8bbd0,stroke:#880e4f,stroke-width:2px,stroke-dasharray: 2 2;
    classDef user fill:#ffcdd2,stroke:#b71c1c,stroke-width:2px;
```
