# srrafdev/website-by-go architecture

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

- Interactive diagram: https://gitdiagram.com/srrafdev/website-by-go
- Repository: https://github.com/srrafdev/website-by-go

## Overview

##### Project Type and Purpose
- The README makes it clear that the project is a web application built in Go. Its primary functionality is to receive input strings and transform them into ASCII art, with an option to download the resulting art.
- Key features include the web server, ASCII transformation (handled in the Print module), a template-based web interface, and containerization support through Docker and shell scripts.

##### File Structure
- At the top level, you have several directories and files:
- The "Print" directory contains Go files (AsciiArtMain.go, checkArgs.go, cookie.go, download.go, printCode.go). This module likely encapsulates the logic for converting text into ASCII art and managing related operations.
- The "templates" directory holds your HTML pages, error pages (400, 404, 405, 500), and a CSS folder for styling. This represents the frontend view layer of your application.
- The "fs" directory has text files (shadow.txt, standard.txt, thinkertoy.txt) which likely serve as fonts or mapping files to perform the ASCII transformations.
- The "bashScript" and "shAndDocker" folders contain shell scripts and Docker-related files (Dockerfile, .dockerignore) to automate tasks such as creation and removal of resources as well as containerizing the application.
- The presence of "main.go" and "main_test.go" at the project root indicates the entry point for running the web server and corresponding tests.

##### README for Additional Insights
- The README confirms that the project is a web server that users can start via "go run main.go", and access the UI via a browser.
- It demonstrates usage, sample output, and mentions that the application can process text into graphic ASCII representations.
- Although the README does not delve into the internal architecture, the file tree provides ample details regarding the components and separation of concerns.

a. Main Components to Include:
- Web Server Component:
- Print Module:
- Template & Presentation Layer:
- A component for "Templates & Frontend" that contains the HTML error pages, default page layout (pageDefoult.html), and associated CSS from the templates directory.
- Font/Resource Files:
- "File System Resources" to represent the ascii font files stored in the fs folder.
- Automation & Containerization:
- A "Bash Scripts & Deployment" component. Here, you merge the functionality from both "bashScript" and "shAndDocker"—highlighting deployment scripts, creation/removal scripts, and Docker configuration.
- Test and CI:
- Optionally, include a "Testing" component that mentions files in "main_test.go" and the "testMyCode" folder for Dockerfile testing scripts.

b. Relationships and Interactions:
- The Print Module (indicating that requests routed by main.go invoke ASCII art processing).
- The Templates & Frontend (indicating that the web server renders HTML pages based on processed ASCII outputs).
- Bash Scripts & Deployment component with both the Web Server and Testing components, demonstrating that scripts help in setup, containerization, and automated testing.

c. Architectural Patterns or Principles:
- Modular design: Each folder in the file tree represents a separate module (e.g., Print module, Template layer, Deployment scripts).
- Separation of concerns between the logic (Print module), presentation (templates), resource management (fs), and automation (bash scripts/shAndDocker).

d. Technologies & Frameworks:
- That the application is built in Go.
- Usage of HTML/CSS for the UI.
- Docker as a containerization technology and shell scripting for deployment automation.
- Mention testing frameworks as seen in main_test.go and additional test scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Browser (User Interface)"]:::browser
    B["Web Server (main.go)"]:::backend
    C["Print Module (ASCII Engine)"]:::backend
    D["Templates & Frontend"]:::frontend
    E["File System Resources"]:::resource
    F["Bash Scripts & Deployment"]:::deployment
    G["Testing Component"]:::testing

    A -->|"HTTP_request"| B
    B -->|"process_input"| C
    B -->|"render_HTML"| D
    C -->|"uses_fonts"| E
    F -->|"deploys"| B
    F -->|"CI"| G

    click B "https://github.com/srrafdev/website-by-go/blob/main/main.go"
    click B "https://github.com/srrafdev/website-by-go/blob/main/main_test.go"
    click C "https://github.com/srrafdev/website-by-go/blob/main/Print/AsciiArtMain.go"
    click C "https://github.com/srrafdev/website-by-go/blob/main/Print/checkArgs.go"
    click C "https://github.com/srrafdev/website-by-go/blob/main/Print/cookie.go"
    click C "https://github.com/srrafdev/website-by-go/blob/main/Print/download.go"
    click C "https://github.com/srrafdev/website-by-go/blob/main/Print/printCode.go"
    click D "https://github.com/srrafdev/website-by-go/blob/main/templates/pageDefoult.html"
    click D "https://github.com/srrafdev/website-by-go/tree/main/templates/errors"
    click D "https://github.com/srrafdev/website-by-go/blob/main/templates/css/styles.css"
    click E "https://github.com/srrafdev/website-by-go/tree/main/fs"
    click F "https://github.com/srrafdev/website-by-go/tree/main/bashScript"
    click F "https://github.com/srrafdev/website-by-go/tree/main/shAndDocker"
    click G "https://github.com/srrafdev/website-by-go/blob/main/testMyCode/test_dockerfile.sh"

    classDef backend fill:#add8e6,stroke:#000,stroke-width:1px;
    classDef frontend fill:#90ee90,stroke:#000,stroke-width:1px;
    classDef deployment fill:#ffb347,stroke:#000,stroke-width:1px;
    classDef testing fill:#dda0dd,stroke:#000,stroke-width:1px;
    classDef resource fill:#d3d3d3,stroke:#000,stroke-width:1px;
    classDef browser fill:#ffcccb,stroke:#000,stroke-width:1px;
```
