# serhatblb/angular-one-page-project architecture

> Architecture diagram of the GitHub repository serhatblb/angular-one-page-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/serhatblb/angular-one-page-project
- Repository: https://github.com/serhatblb/angular-one-page-project

## Overview

##### Project type and purpose
- This is a full-stack demo application built around an Angular single-page application (“OnePage”) that consumes data from two kinds of back-ends:
- A mock JSON-server (`_1_jsonserver/blog.json`) for quickly serving blog entries.
- A Node.js/Express/MongoDB API (`_2_nodejs/…`) for a more realistic persistence layer.
- The Angular front-end implements a one-page blog site with components for header, main content, blog listing, login/register, navbar, footer, pipes and services.

##### File structure
Top-level:
- `_1_jsonserver/` – JSON file and instructions for spinning up json-server.
- `_2_nodejs/` – Node.js Express REST API code, environment config, MongoDB integration.
- `src/app/` – Angular components, services, pipes, routing and configuration.
- `angular.json`, `package.json`, `tsconfig.*` – Angular CLI and TypeScript build/config.
- `proxy.conf.json` – Proxy rules for routing API calls in development.

##### README for additional insights
- Describes Angular CLI workflow, JSON-server usage (`json-server --watch blog.json`), Node.js commands (`npm run nodemon`), ports (Angular:4200 or custom, JSON-server:2222, NodeJS:1111).
- Lists tech stack: Angular (TypeScript, RxJS), Express, Mongoose, json-server, Bootstrap, jQuery, Alertify.js.
- Explains the component-service-module architecture in Angular (MVC-like).

##### Elements
- UI Components → Services → HTTP Requests → Back-end
- Back-end → Services → UI Components (responses)
- Express API → MongoDB (CRUD operations)
- Rectangles (blue) for front-end layers
- Rectangles (orange) for back-end services

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["User's Browser<br/>(Angular SPA)"]:::client

    %% Front-end Angular App
    subgraph "Angular Application"
        direction TB

        subgraph "UI Components"
            direction TB
            Header["OnePage Header Component"]:::frontend
            MainContent["OnePage Main Content Component"]:::frontend
            BlogPage["One-Page Blog Page Component"]:::frontend
            LoginPage["One-Page Login Component"]:::frontend
            RegisterPage["One-Page Register Component"]:::frontend
            Navbar["One-Page Navbar Component"]:::frontend
            Footer["OnePage Footer Component"]:::frontend
            ProjectBanner["OnePage Project Name Banner"]:::frontend
        end

        subgraph "Services & Pipes"
            direction TB
            AlertifyService["AlertifyMessageService"]:::frontend
            BlogService["BlogArrayService"]:::frontend
            UserService["UserRegisterService"]:::frontend
            SearchPipe["SearchBlogFilterPipe"]:::frontend
        end

        subgraph "Routing & Config"
            direction TB
            AppComponent["App Entry Component"]:::frontend
            AppRoutes["Routing Configuration"]:::frontend
            AppConfig["Application Configuration"]:::frontend
            Proxy["Development Proxy Rules"]:::frontend
        end
    end

    %% Back-end Services
    subgraph "Data Sources / Back-ends"
        direction TB
        JSONServer["JSON-server Mock API<br/>(http://localhost:2222)"]:::backendMock
        ExpressAPI["Node.js/Express API<br/>(http://localhost:1111/api)"]:::backend
        MongoDB["MongoDB Database"]:::database
    end

    %% Connections
    Browser -->|"loads SPA"| Header
    Browser --> MainContent
    Browser --> Footer

    Header -->|uses| AlertifyService
    MainContent -->|fetches blog data| BlogService
    BlogPage -->|fetches filtered blogs| BlogService
    BlogPage --> SearchPipe
    LoginPage -->|calls| UserService
    RegisterPage -->|calls| UserService
    Navbar -->|displays navigation| AppRoutes
    ProjectBanner --> AppConfig

    AlertifyService -->|"HTTP"| JSONServer
    AlertifyService -->|"HTTP"| ExpressAPI
    BlogService -->|"GET /blog"| JSONServer
    UserService -->|"POST /register"| ExpressAPI
    UserService -->|"POST /login"| ExpressAPI

    ExpressAPI -->|CRUD ops| MongoDB

    AppRoutes -->|defines routes| AppComponent
    Proxy -->|redirect /api to| ExpressAPI

    %% Click Events
    click Header "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/onepage-header/onepage-header.component.ts"
    click MainContent "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/onepage-main/onepage-main.component.ts"
    click BlogPage "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/one-page-blog-page/one-page-blog-page.component.ts"
    click LoginPage "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/one-page-login/one-page-login.component.ts"
    click RegisterPage "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/one-page-register/one-page-register.component.ts"
    click Navbar "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/one-page-navbar/one-page-navbar.component.ts"
    click Footer "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/onepage-footer/onepage-footer.component.ts"
    click ProjectBanner "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/onepage-project-name/onepage-project-name.component.ts"
    click AlertifyService "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/services/alertify-message.service.ts"
    click BlogService "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/services/blog-array.service.ts"
    click UserService "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/services/user-register.service.ts"
    click SearchPipe "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/custom-pipe/search-blog-filter.pipe.ts"
    click AppRoutes "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/app.routes.ts"
    click AppConfig "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/app.config.ts"
    click AppComponent "https://github.com/serhatblb/angular-one-page-project/blob/master/src/app/app.component.ts"
    click JSONServer "https://github.com/serhatblb/angular-one-page-project/blob/master/_1_jsonserver/blog.json"
    click ExpressAPI "https://github.com/serhatblb/angular-one-page-project/blob/master/_2_nodejs/NodeJsMongoDbExpressRestApi.js"
    click ExpressAPI "https://github.com/serhatblb/angular-one-page-project/blob/master/_2_nodejs/Api.js"
    click ExpressAPI "https://github.com/serhatblb/angular-one-page-project/blob/master/_2_nodejs/MongoDbNodeJs.js"
    click ExpressAPI "https://github.com/serhatblb/angular-one-page-project/blob/master/_2_nodejs/.env"
    click Proxy "https://github.com/serhatblb/angular-one-page-project/blob/master/src/proxy.conf.json"
    click angularConfig "https://github.com/serhatblb/angular-one-page-project/blob/master/angular.json"
    click tsConfig "https://github.com/serhatblb/angular-one-page-project/blob/master/tsconfig.json"
    click pkgJson "https://github.com/serhatblb/angular-one-page-project/blob/master/package.json"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,color:#0d47a1;
    classDef backend fill:#ffcc80,stroke:#ef6c00,color:#e65100;
    classDef backendMock fill:#ffe0b2,stroke:#ef6c00,stroke-dasharray:5 5,color:#e65100;
    classDef database fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20;
    classDef client fill:#e0e0e0,stroke:#9e9e9e,color:#424242;
```
