# verhiron/pub-krawl-api architecture

> Architecture diagram of the GitHub repository verhiron/pub-krawl-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/verhiron/pub-krawl-api
- Repository: https://github.com/verhiron/pub-krawl-api

## Overview

This repository is a Laravel-backed pub-discovery API with account registration and token authentication. The main workflow is an API request routed to a domain controller, which queries pub, country, city, or beer data and returns a standardized JSON response; pub detail and country/global listings are distinct discovery stages. Authentication uses the User model and Sanctum tokens. The domain controllers and route wiring are excerpted; domain-table storage is inferred from their queries, while its schema and database configuration were not inspected.

Main entry points: [`routes/api.php`](https://github.com/verhiron/pub-krawl-api/blob/master/routes/api.php) (API routes), [`app/Http/Controllers/AuthController.php`](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/AuthController.php) (Auth endpoints), [`app/Helpers/ApiResponse.php`](https://github.com/verhiron/pub-krawl-api/blob/master/app/Helpers/ApiResponse.php) (JSON response helper), [`app/Http/Controllers/Api/V1/CountryController.php`](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/CountryController.php) (Country listing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["API routing"]
  node_bootstrap["Laravel bootstrap<br/>[app.php]"]
  node_api_routes["API routes<br/>[api.php]"]
end

subgraph group_discovery["Pub discovery"]
  node_country["Country listing"]
  node_city["City lookup<br/>[CityController.php]"]
  node_pub["Pub discovery<br/>[PubController.php]"]
  node_beer["Beer lookup<br/>[BeerController.php]"]
  node_domain_db[("Domain database")]
end

subgraph group_identity["Identity"]
  node_auth["Auth endpoints<br/>[AuthController.php]"]
  node_user["User model<br/>[User.php]"]
  node_token_store[("Token storage")]
end

subgraph group_shared["Shared services"]
  node_response["JSON response helper<br/>[ApiResponse.php]"]
end

node_client(("API client"))

node_client -->|"sends request"| node_bootstrap
node_bootstrap -->|"loads routes"| node_api_routes
node_api_routes -->|"dispatches"| node_country
node_api_routes -->|"dispatches"| node_city
node_api_routes -->|"dispatches"| node_pub
node_api_routes -->|"dispatches"| node_beer
node_api_routes -->|"dispatches"| node_auth
node_country -->|"queries"| node_domain_db
node_city -->|"queries"| node_domain_db
node_pub -->|"queries"| node_domain_db
node_beer -->|"queries"| node_domain_db
node_country -->|"formats result"| node_response
node_city -->|"formats result"| node_response
node_pub -->|"formats result"| node_response
node_beer -->|"formats result"| node_response
node_auth -->|"creates and checks"| node_user
node_auth -.->|"issues and revokes"| node_token_store
node_auth -->|"returns JSON"| node_client

click node_bootstrap "https://github.com/verhiron/pub-krawl-api/blob/master/bootstrap/app.php"
click node_api_routes "https://github.com/verhiron/pub-krawl-api/blob/master/routes/api.php"
click node_country "https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/CountryController.php"
click node_city "https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/CityController.php"
click node_pub "https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/PubController.php"
click node_beer "https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/BeerController.php"
click node_auth "https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/AuthController.php"
click node_user "https://github.com/verhiron/pub-krawl-api/blob/master/app/Models/User.php"
click node_response "https://github.com/verhiron/pub-krawl-api/blob/master/app/Helpers/ApiResponse.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bootstrap,node_api_routes,node_client toneBlue
class node_country,node_city,node_pub,node_beer,node_domain_db toneAmber
class node_auth,node_user,node_token_store toneMint
class node_response toneRose
```

## Components

### API routing

- [Laravel bootstrap](https://github.com/verhiron/pub-krawl-api/blob/master/bootstrap/app.php): `bootstrap/app.php`
- [API routes](https://github.com/verhiron/pub-krawl-api/blob/master/routes/api.php): `routes/api.php`

### Pub discovery

- [Country listing](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/CountryController.php): `app/Http/Controllers/Api/V1/CountryController.php`
- [City lookup](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/CityController.php): `app/Http/Controllers/Api/V1/CityController.php`
- [Pub discovery](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/PubController.php): `app/Http/Controllers/Api/V1/PubController.php`
- [Beer lookup](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/Api/V1/BeerController.php): `app/Http/Controllers/Api/V1/BeerController.php`
- **Domain database**

### Identity

- [Auth endpoints](https://github.com/verhiron/pub-krawl-api/blob/master/app/Http/Controllers/AuthController.php): `app/Http/Controllers/AuthController.php`
- [User model](https://github.com/verhiron/pub-krawl-api/blob/master/app/Models/User.php): `app/Models/User.php`
- **Token storage**

### Shared services

- [JSON response helper](https://github.com/verhiron/pub-krawl-api/blob/master/app/Helpers/ApiResponse.php): `app/Helpers/ApiResponse.php`

### Other components

- **API client**

## Connections

- API client → Laravel bootstrap: sends request
- Laravel bootstrap → API routes: loads routes (evidence: `bootstrap/app.php`)
- API routes → Country listing: dispatches (evidence: `routes/api.php`)
- API routes → City lookup: dispatches (evidence: `routes/api.php`)
- API routes → Pub discovery: dispatches (evidence: `routes/api.php`)
- API routes → Beer lookup: dispatches (evidence: `routes/api.php`)
- API routes → Auth endpoints: dispatches (evidence: `routes/api.php`)
- Country listing → Domain database: queries (evidence: `app/Http/Controllers/Api/V1/CountryController.php`)
- City lookup → Domain database: queries (evidence: `app/Http/Controllers/Api/V1/CityController.php`)
- Pub discovery → Domain database: queries (evidence: `app/Http/Controllers/Api/V1/PubController.php`)
- Beer lookup → Domain database: queries (evidence: `app/Http/Controllers/Api/V1/BeerController.php`)
- Country listing → JSON response helper: formats result (evidence: `app/Http/Controllers/Api/V1/CountryController.php`)
- City lookup → JSON response helper: formats result (evidence: `app/Http/Controllers/Api/V1/CityController.php`)
- Pub discovery → JSON response helper: formats result (evidence: `app/Http/Controllers/Api/V1/PubController.php`)
- Beer lookup → JSON response helper: formats result (evidence: `app/Http/Controllers/Api/V1/BeerController.php`)
- Auth endpoints → User model: creates and checks (evidence: `app/Http/Controllers/AuthController.php`)
- Auth endpoints → Token storage: issues and revokes
- Auth endpoints → API client: returns JSON (evidence: `app/Http/Controllers/AuthController.php`)
