Skip to content

Latest commit

 

History

History
408 lines (290 loc) · 6.33 KB

client-behavior.md

File metadata and controls

408 lines (290 loc) · 6.33 KB

Client Behavior

This document describes the observed runtime behavior of the GdeBenz frontend.

The information presented here is based exclusively on:

  • browser DevTools
  • network traffic inspection
  • frontend JavaScript analysis
  • runtime observation

No backend source code was used.


Overview

The GdeBenz frontend is implemented as a Single Page Application (SPA).

All user interaction is handled without full page reloads.

The client maintains its own runtime state and synchronizes it with the backend using HTTP requests. SPA applications commonly follow this event-driven rendering model.


Client Lifecycle

A typical client session follows this sequence.

Browser opens page
        │
        ▼
Load HTML
        │
        ▼
Load JavaScript
        │
        ▼
Initialize application
        │
        ▼
Generate fingerprint
        │
        ▼
Load configuration
        │
        ▼
Load runtime tokens
        │
        ▼
Determine location
        │
        ▼
Load nearby stations
        │
        ▼
Render map
        │
        ▼
Wait for user interaction

Application Initialization

During startup the frontend initializes several independent subsystems.

Observed initialization includes:

  • configuration loading
  • fingerprint generation
  • runtime token loading
  • map initialization
  • location detection
  • theme loading
  • Local Storage restoration

Runtime State

The frontend maintains a number of runtime objects in memory.

Observed state includes:

  • current viewport
  • current map zoom
  • selected station
  • nearby stations
  • loaded stations
  • comments
  • vote history
  • runtime tokens
  • user location

Most runtime state exists only while the page is open.


Persistent State

Some values survive page reloads.

Observed Local Storage keys

Key Purpose
gas_cid Visitor fingerprint
gas_votes Vote cache
gas_votes_t Vote timestamps
gas_theme Theme
gas_impact User statistics

Event-Driven Updates

Most network activity originates from UI events.

Observed events include

  • page load
  • map movement
  • zoom changes
  • station selection
  • vote submission
  • report submission
  • location updates

Each event may trigger one or more HTTP requests.


Map Interaction

Moving the map generates additional requests.

Observed flow

User drags map
        │
        ▼
Viewport changes
        │
        ├────────────► GET /api/stations
        │
        └────────────► GET /api/nearby

Visible stations are refreshed after viewport updates.


Station Selection

Selecting a station triggers additional requests.

Typical flow

Station selected
        │
        ▼
Load station details
        │
        ├────────────► GET /api/comments/{id}
        │
        ├────────────► GET /api/comments/{id}/recent
        │
        └────────────► GET /api/views

Voting Workflow

Submitting a vote follows the observed sequence.

Select status
        │
        ▼
Validate runtime tokens
        │
        ▼
Collect fingerprint
        │
        ▼
Optional Turnstile verification
        │
        ▼
POST /api/comments
        │
        ▼
Refresh station information

Token Management

The frontend periodically refreshes runtime tokens.

Observed endpoints

GET /api/vt
GET /api/rt

Observed behavior

  • automatic refresh
  • cached in memory
  • reused until expiration
  • refreshed independently

Polling

The frontend periodically synchronizes data.

Observed polling endpoints

/api/nearby
/api/vt
/api/rt
/api/views

No persistent communication channel was observed.

Updates rely entirely on repeated HTTP requests rather than WebSockets or Server-Sent Events.


Duplicate Requests

During runtime the client may generate identical requests.

Example

GET /api/nearby
GET /api/nearby
GET /api/nearby

Observed characteristics

  • same URL
  • same parameters
  • overlapping execution
  • independent responses

No request deduplication was observed.


Parallel Requests

Several requests may execute simultaneously.

Example

GET /api/nearby
GET /api/stations
GET /api/views
GET /api/comments

The frontend does not appear to serialize unrelated requests.


Cache Busting

Some requests include an additional query parameter.

Example

GET /api/nearby?...&_=1783326046558

Observed purpose

  • bypass browser cache
  • force fresh response

Retry Behavior

Some requests appear to be retried after temporary failures.

Observed situations

  • HTTP 504
  • timeout
  • temporary backend unavailability

Observed endpoints

/api/vt
/api/nearby

Retry logic appears to be implemented on the client.


Error Handling

Observed client behavior

  • continues operating after failed requests
  • retries selected endpoints
  • preserves existing UI state where possible
  • displays notifications for user-facing errors

Typical HTTP responses

200 OK
403 Forbidden
409 Conflict
429 Too Many Requests
500 Internal Server Error
503 Service Unavailable
504 Gateway Timeout

Rendering

The interface updates asynchronously.

Typical rendering pipeline

HTTP request
        │
        ▼
Receive JSON
        │
        ▼
Update runtime state
        │
        ▼
Re-render affected UI

No full page reload is required.


Network Characteristics

Observed properties

  • HTTPS only
  • HTTP/2
  • JSON payloads
  • gzip compression
  • asynchronous requests
  • REST-style endpoints

Client Characteristics

Observed architectural characteristics

  • Single Page Application
  • asynchronous networking
  • event-driven rendering
  • runtime state management
  • anonymous visitor model
  • polling-based synchronization
  • Local Storage persistence
  • viewport-based loading
  • token-protected mutations

Limitations

This document describes observed frontend behavior only.

The following aspects are outside the scope of this document because they are implemented server-side:

  • database schema
  • moderation logic
  • validation rules
  • rate limiting implementation
  • caching strategy
  • business logic
  • scoring algorithms
  • internal backend architecture