# alpha1337k/ft_gomoku architecture

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

- Interactive diagram: https://gitdiagram.com/alpha1337k/ft_gomoku
- Repository: https://github.com/alpha1337k/ft_gomoku

## Overview

##### Project type and purpose
- This is a full-stack web application for playing Gomoku against an AI.
- The frontend (Vue 3 + Vite + TypeScript + Tailwind CSS) provides the game UI, routing, and state management.
- The backend (Rust) implements the game rules, board representation, heuristic evaluation, minimax search, and exposes an HTTP API.
- Dockerfiles and a docker-compose.yml orchestrate running the frontend and backend as separate containers.

##### File structure
- Top level
- LICENSE, README.md, docker-compose.yml
- backend/ (Rust service)
- frontend/ (Vue SPA)
- backend/
- Cargo.toml, Dockerfile, .gitignore
- src/ (board.rs, piece.rs, position.rs, heuristic.rs, minimax.rs, move_calculator.rs, lib.rs, main.rs)
- benches/ (benchmark for calculate)
- frontend/
- package.json, Dockerfile, .eslintrc.cjs, .prettierrc.json, tsconfig*
- public/ (index.html, manifest)
- src/
– main.ts, App.vue, assets/, router/, stores/, components/, views/
- tailwind.config.js, vite.config.ts

##### Additional README insights
- Minimal: 42 school project “ft_gomoku” with final grade 95/100.

##### Detail
- Logical piece (router, store, components on the frontend; lib.rs vs main.rs, each game module in backend).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Compose Orchestration"
        FE[/"frontend: Docker container"/]:::frontend
        BE[/"backend: Docker container"/]:::backend
    end

    Browser[(Browser)]:::external

    Browser -->|"Navigates SPA"| FE
    FE -->|"Serves static assets"| Browser
    FE -->|"HTTP/JSON POST /api/move"| BE
    BE -->|"HTTP Response JSON"| FE

    subgraph "Frontend Container"
        Main["main.ts"]:::frontend
        App["App.vue"]:::frontend
        Router["router/index.ts"]:::frontend
        StoreGame["stores/GameState.ts"]:::frontend
        StoreAPI["stores/api.ts"]:::frontend
        Components["components/*"]:::frontend
        Views["views/*"]:::frontend
        FDocker["Dockerfile"]:::frontend
    end

    subgraph "Backend Container"
        HTTP["main.rs"]:::backend
        Lib["lib.rs"]:::module
        Board["board.rs"]:::module
        Piece["piece.rs"]:::module
        Position["position.rs"]:::module
        Heuristic["heuristic.rs"]:::module
        Minimax["minimax.rs"]:::module
        MoveCalc["move_calculator.rs"]:::module
        Benches["benches/calculate.rs"]:::backend
        Cargo["Cargo.toml"]:::backend
        BDocker["Dockerfile"]:::backend
    end

    HTTP -->|calls core logic| Lib
    Lib --> Board
    Lib --> Piece
    Lib --> Position
    Lib --> Heuristic
    Lib --> Minimax
    Lib --> MoveCalc

    classDef frontend fill:#D6EAF8,stroke:#21618C,color:#1B4F72;
    classDef backend fill:#FADBD8,stroke:#C0392B,color:#78281F;
    classDef module fill:#D5F5E3,stroke:#27AE60,color:#1D8348;
    classDef external fill:#F9E79F,stroke:#B7950B,color:#7D6608;
    classDef compose fill:#E8DAEF,stroke:#8E44AD,color:#4A235A;

    class FE,Main,App,Router,StoreGame,StoreAPI,Components,Views,FDocker frontend
    class BE,HTTP,Cargo,BDocker,Benches backend
    class Lib,Board,Piece,Position,Heuristic,Minimax,MoveCalc module
    class Browser compose

    click FE "https://github.com/alpha1337k/ft_gomoku/blob/main/docker-compose.yml"
    click FDocker "https://github.com/alpha1337k/ft_gomoku/tree/main/frontend/Dockerfile"
    click Main "https://github.com/alpha1337k/ft_gomoku/blob/main/frontend/src/main.ts"
    click App "https://github.com/alpha1337k/ft_gomoku/blob/main/frontend/src/App.vue"
    click Router "https://github.com/alpha1337k/ft_gomoku/blob/main/frontend/src/router/index.ts"
    click StoreGame "https://github.com/alpha1337k/ft_gomoku/blob/main/frontend/src/stores/GameState.ts"
    click StoreAPI "https://github.com/alpha1337k/ft_gomoku/blob/main/frontend/src/stores/api.ts"
    click Components "https://github.com/alpha1337k/ft_gomoku/tree/main/frontend/src/components"
    click Views "https://github.com/alpha1337k/ft_gomoku/tree/main/frontend/src/views"
    click HTTP "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/main.rs"
    click Lib "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/lib.rs"
    click Board "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/board.rs"
    click Piece "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/piece.rs"
    click Position "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/position.rs"
    click Heuristic "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/heuristic.rs"
    click Minimax "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/minimax.rs"
    click MoveCalc "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/src/move_calculator.rs"
    click Benches "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/benches/calculate.rs"
    click Cargo "https://github.com/alpha1337k/ft_gomoku/blob/main/backend/Cargo.toml"
    click BDocker "https://github.com/alpha1337k/ft_gomoku/tree/main/backend/Dockerfile"
```
