# carlonchosando/zombie-game-gemini-flash architecture

> Architecture diagram of the GitHub repository carlonchosando/zombie-game-gemini-flash, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/carlonchosando/zombie-game-gemini-flash
- Repository: https://github.com/carlonchosando/zombie-game-gemini-flash

## Overview

##### Project type and purpose
- This is a full-stack Next.js application.
- The “frontend” is built with the new Next.js App Router (under src/app and src/components), and it also defines serverless API routes (under src/app/api) to generate images and stories.

##### File structure
- Top-level files: package.json, next.config.ts, postcss.config.mjs, public/ (static assets), tsconfig.json.
- src/app: the App Router entrypoints (layout.tsx, page.tsx), global CSS, custom hooks, and two API route folders: generate-image and generate-story.
- src/components and src/app/componentes: reusable UI components, tasks, messages, loaders, prompts, etc., plus a local “zombie game” hook.
- src/lib: shared constants, prompts, TypeScript types, and utility functions.
- No traditional database; data flows are in-memory or proxied through the API routes (likely to an external AI service).

##### README insights
- Bootstrapped with create-next-app, uses next/font for Google-style font optimization, deployable to Vercel.
- No explicit backend DB or third-party integrations mentioned in README, but the API routes imply calls to generation engines (e.g., OpenAI or other LLM image/story APIs).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (React/Next.js)"
        direction TB
        Browser["Client Browser"]:::external
        subgraph "App Router"
            direction TB
            Layout["layout.tsx"]:::ui
            Page["page.tsx"]:::ui
            GlobalCSS["globals.css"]:::config
        end
        Components["UI Components"]:::ui
        Hook["use-zombie-game Hook"]:::ui
    end

    %% Backend Layer
    subgraph "Backend (Next.js Server + Serverless)"
        direction TB
        NextServer["Next.js Server"]:::server
        subgraph "Serverless Functions"
            direction TB
            ImgLambda["Generate-Image Lambda"]:::api
            StoryLambda["Generate-Story Lambda"]:::api
        end
        Logic["Business Logic Layer"]:::lib
    end

    %% External Services & Assets
    External["External AI Service"]:::external
    Static["Static Assets (public/)"]:::assets

    %% Data Flows
    Browser -->|"Initial page load"| NextServer
    NextServer -->|serves| Layout
    NextServer -->|serves| Page
    NextServer -->|serves| GlobalCSS
    NextServer -->|serves| Static
    Browser -->|POST /api/generate-image| ImgLambda
    Browser -->|POST /api/generate-story| StoryLambda
    ImgLambda -->|uses| Logic
    StoryLambda -->|uses| Logic
    Logic -->|calls| External
    External -->|response| ImgLambda
    External -->|response| StoryLambda
    ImgLambda -->|returns JSON| Browser
    StoryLambda -->|returns JSON| Browser

    %% Click Events
    click Layout "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/app/layout.tsx"
    click Page "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/app/page.tsx"
    click GlobalCSS "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/app/globals.css"
    click Components "https://github.com/carlonchosando/zombie-game-gemini-flash/tree/main/src/components/"
    click Hook "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/app/hooks/use-zombie-game.ts"
    click ImgLambda "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/app/api/generate-image/route.ts"
    click StoryLambda "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/app/api/generate-story/route.ts"
    click Logic "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/src/lib/utils.ts"
    click Static "https://github.com/carlonchosando/zombie-game-gemini-flash/tree/main/public/"
    click NextServer "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/next.config.ts"
    click GlobalCSS "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/postcss.config.mjs"
    click GlobalCSS "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/tsconfig.json"
    click GlobalCSS "https://github.com/carlonchosando/zombie-game-gemini-flash/blob/main/package.json"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085
    classDef api fill:#d4edda,stroke:#155724,color:#155724
    classDef lib fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef server fill:#d1ecf1,stroke:#0c5460,color:#0c5460
    classDef assets fill:#ffe5b4,stroke:#c47a00,color:#c47a00
    classDef config fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
