# avictormorais/posterfy architecture

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

- Interactive diagram: https://gitdiagram.com/avictormorais/posterfy
- Repository: https://github.com/avictormorais/posterfy

## Overview

##### Project type and purpose
- Posterfy is a single-page, front-end web application built with React (JSX) and Vite.
- Its purpose is to let end-users search Spotify’s catalog, retrieve album data, and compose a custom poster via the HTML Canvas.
- There is no separate backend service—authentication keys are stored in environment variables and used by the client to call Spotify’s public API directly.

##### File structure
- Top level:
– package.json, vite.config.js → build tool and dependencies
– index.html → entry point for the SPA
– .env.example → template for Spotify client credentials
- src/ → application source code
– main.jsx → bootstraps React into index.html
– App.jsx, App.css → root component and global styling
– components/ → UI broken into feature folders:
· Navbar (language selector + nav links)
· Faq (Q&A panel)
· AlbumCollection, Album, DivAlbum → search results and card display
· PosterEditor (CanvasPoster + ColorSelector + input controls)
· Utility: Loading animations, search bar, Grid, Footer
– assets/ → image assets (album hero, default images)
– i18n/ → internationalization setup (i18next configuration)
- No “backend” folder or server code—calls to Spotify API are client-side via fetch.

##### Extract additional insights from the README
- Flow: search → select → fetch data → render on Canvas → export PNG
- Uses Spotify’s public REST endpoints (requires client ID/secret for OAuth token)
- Core technologies: React, Vite, HTML Canvas, Spotify API, i18next

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Bootstrap and Entry
  HTML["HTML Entry Point\n(index.html)"]:::gray
  click HTML "https://github.com/avictormorais/posterfy/blob/main/index.html"
  Bootstrap["React App Bootstrap\n(src/main.jsx)"]:::blue
  click Bootstrap "https://github.com/avictormorais/posterfy/blob/main/src/main.jsx"
  RootComp["Root Component\n(src/App.jsx)"]:::blue
  click RootComp "https://github.com/avictormorais/posterfy/blob/main/src/App.jsx"
  GlobalStyles["Global Styles\n(App.css / index.css)"]:::blue
  click GlobalStyles "https://github.com/avictormorais/posterfy/blob/main/src/App.css"
  click GlobalStyles "https://github.com/avictormorais/posterfy/blob/main/src/index.css"

  HTML --> Bootstrap --> RootComp --> GlobalStyles

  subgraph "Client (Browser)" 
    direction TB
    subgraph "UI Components Layer"
      direction TB
      Navbar["Navbar"]:::blue
      click Navbar "https://github.com/avictormorais/posterfy/blob/main/src/components/Navbar/Navbar.jsx"
      LSelector["LanguageSelector"]:::blue
      click LSelector "https://github.com/avictormorais/posterfy/blob/main/src/components/Navbar/Languageselector.jsx"
      Searchbar["Searchbar"]:::blue
      click Searchbar "https://github.com/avictormorais/posterfy/blob/main/src/components/Searchbar.jsx"
      Hero["Hero Section"]:::blue
      click Hero "https://github.com/avictormorais/posterfy/blob/main/src/components/Hero.jsx"
      AlbumColl["AlbumCollection"]:::blue
      click AlbumColl "https://github.com/avictormorais/posterfy/blob/main/src/components/AlbumCollection.jsx"
      AlbumCard["Album Card"]:::blue
      click AlbumCard "https://github.com/avictormorais/posterfy/blob/main/src/components/Album.jsx"
      DivAlbum["DivAlbum"]:::blue
      click DivAlbum "https://github.com/avictormorais/posterfy/blob/main/src/components/DivAlbum.jsx"
      PosterEditorUI["PosterEditor"]:::blue
      click PosterEditorUI "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/PosterEditor.jsx"
      FAQ["FAQ Panel"]:::blue
      click FAQ "https://github.com/avictormorais/posterfy/blob/main/src/components/Faq/Faq.jsx"
      Footer["Footer"]:::blue
      click Footer "https://github.com/avictormorais/posterfy/blob/main/src/components/Footer.jsx"
      Loading["Loading Animations"]:::blue
      click Loading "https://github.com/avictormorais/posterfy/blob/main/src/components/Loading.jsx"
      click Loading "https://github.com/avictormorais/posterfy/blob/main/src/components/LoadingDiv.jsx"
      Grid["Grid Utility"]:::blue
      click Grid "https://github.com/avictormorais/posterfy/blob/main/src/components/Grid.jsx"
      Anchor["Anchor & Icons"]:::blue
      click Anchor "https://github.com/avictormorais/posterfy/blob/main/src/components/Anchor.jsx"
      click Anchor "https://github.com/avictormorais/posterfy/blob/main/src/components/icons/icon.jsx"
    end

    subgraph "State & Data Management"
      direction TB
      State["React Context / Hooks"]:::blue
    end

    subgraph "Canvas Rendering Engine"
      direction TB
      CanvasPoster["CanvasPoster"]:::blue
      click CanvasPoster "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/CanvasPoster.jsx"
      ColorSelector["ColorSelector"]:::blue
      click ColorSelector "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/ColorSelector.jsx"
      subgraph "Poster Editor Inputs"
        direction TB
        CheckInput["CheckInput"]:::blue
        click CheckInput "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/inputs/CheckInput.jsx"
        ColorInput["ColorInput"]:::blue
        click ColorInput "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/inputs/ColorInput.jsx"
        DoubleInput["DoubleInput"]:::blue
        click DoubleInput "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/inputs/DoubleInput.jsx"
        FileInput["FileInput"]:::blue
        click FileInput "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/inputs/FileInput.jsx"
        FontInput["FontInput"]:::blue
        click FontInput "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/inputs/FontInput.jsx"
        NormalInput["NormalInput"]:::blue
        click NormalInput "https://github.com/avictormorais/posterfy/blob/main/src/components/PosterEditor/inputs/NormalInput.jsx"
      end
    end

    i18n["i18n Module"]:::blue
    click i18n "https://github.com/avictormorais/posterfy/blob/main/src/i18n/i18n.js"
  end

  subgraph "External Services"
    direction TB
    Spotify["Spotify API"]:::green
  end

  subgraph "Build & Deployment"
    direction TB
    Vite["Vite Build"]:::gray
    click Vite "https://github.com/avictormorais/posterfy/blob/main/vite.config.js"
    EnvVars["Env Config\n(.env.example / package.json)"]:::gray
    click EnvVars "https://github.com/avictormorais/posterfy/blob/main/.env.example"
    click EnvVars "https://github.com/avictormorais/posterfy/blob/main/package.json"
    Deploy["Static Hosting"]:::gray
  end

  %% Data Flows
  User["User"]:::dark
  User -->|uses UI| Navbar
  User -->|uses UI| Searchbar
  Searchbar -->|"fetch OAuth token & data"| Spotify
  Spotify -->|"returns JSON data"| State
  State -->|populates| AlbumColl
  AlbumColl -->|renders| AlbumCard
  AlbumCard -->|wrapped by| DivAlbum
  AlbumCard -->|select album| PosterEditorUI
  PosterEditorUI -->|reads/writes| State
  PosterEditorUI -->|invokes| CanvasPoster
  CanvasPoster -->|draws poster| PosterEditorUI
  ColorSelector -->|controls style| CanvasPoster
  PosterInputs -->|provide settings| CanvasPoster
  CanvasPoster -->|exports PNG| User
  i18n -->|translates| Navbar
  i18n -->|translates| Footer
  i18n -->|translates| FAQ

  %% Build Flows
  RootComp -->|source| Vite
  GlobalStyles -->|source| Vite
  EnvVars -->|injected| Vite
  Vite -->|bundles code| Deploy

  classDef blue fill:#E8F1FF,stroke:#0366d6;
  classDef green fill:#E6FFED,stroke:#28a745;
  classDef gray fill:#F0F0F0,stroke:#737373;
  classDef dark fill:#FFF5B1,stroke:#D4A72C;
```
