Static Data Modeling
Relevant source files
The following files were used as context for generating this wiki page:
Static Data Modeling in the AVP Supercars project refers to the structural definition and centralized storage of vehicle information, used throughout the application to drive the fleet display, filtering systems, and booking requests. Instead of a dynamic database, the project utilizes a strongly-typed TypeScript registry to maintain "Monaco-level" consistency across its luxury vehicle offerings.
This modeling approach ensures that every vehicle in the fleet adheres to a specific schema, encompassing technical specifications, categorization, and visual assets. This data serves as the single source of truth for the Fleet Page and individual Car Detail Pages.
Sources: data/fleet.ts:1-20, app/fleet/page.tsx:14
Core Data Structures
The system architecture relies on three primary TypeScript types that define the shape of the vehicle data. These types ensure type safety when passing car information between components like CarCard and FleetFilters.
The Car Schema
The Car type is the central entity, aggregating technical highlights and visual media.
| Field | Type | Description |
|---|---|---|
slug | string | Unique identifier used for URL routing and lookup. |
brand | string | The manufacturer of the vehicle (e.g., Ferrari, Audi). |
model | string | Specific model name. |
category | string | Classification for filtering (e.g., GT, Supercar, SUV). |
tagline | string | A short, marketing-focused description. |
images | CarImage[] | Array of source paths and alt text for gallery display. |
bullets | string[] | Key service features or rental terms. |
highlights | CarHighlight[] | Key-value pairs for technical specs (HP, 0-100, etc.). |
Sources: data/fleet.ts:1-20
Visual and Technical Sub-types
To maintain granularity, images and specifications are modeled as distinct objects:
- CarImage: Stores
src(URL/path) andalt(accessibility text). - CarHighlight: Stores a
label(e.g., "Engine") and avalue(e.g., "5.2L V10").
Sources: data/fleet.ts:1-10
Data Relationships and Hierarchy
The data is organized as a flat array of objects exported as fleet. This structure allows for efficient filtering and direct access via unique slugs.
The following class diagram illustrates the relationships between the data types:
The diagram shows that a Car entity acts as a container for multiple image assets and technical highlights.
Sources: data/fleet.ts:1-25
Data Flow and Consumption
The static data modeled in data/fleet.ts flows through the application in two primary patterns: list filtering and detail retrieval.
List and Filter Flow
On the main fleet page, the entire fleet array is loaded and passed to the FleetFilters component. This component computes unique categories dynamically from the static data and provides a filtered subset back to the UI.
The flow shows how static data is transformed into a dynamic user interface through state management and filtering logic.
Sources: app/fleet/page.tsx:14-20, components/FleetFilters.tsx:13-33
Detail Retrieval Logic
Individual vehicle pages use the slug parameter from the URL to perform a lookup in the static fleet array. If no match is found, the system triggers a notFound() response.
// Example of static data retrieval via slug
const car = fleet.find((c) => c.slug === slug);
if (!car) return notFound();
Sources: app/fleet/[slug]/page.tsx:13-16
Integration with Booking Systems
The static modeling extends into the user interaction layer. When a user views a specific vehicle and initiates a request, the brand and model fields from the static data are used to pre-populate the RequestForm.
- Pre-population: The
slugpage passes the car's name as adefaultCarprop to theRequestForm. - Message Generation: The form uses the static model fields to construct a formatted WhatsApp or Email string.
Sources: components/RequestForm.tsx:37-60, app/fleet/[slug]/page.tsx:28-30
Summary of Fleet Categories
The static model currently supports several high-level categories used for organization and filtering.
| Category | Typical Highlights | Featured Models |
|---|---|---|
| GT | Engine, Power, Seats | Ferrari Portofino, GTC4Lusso T |
| Supercar | 0-100 km/h, Drive | Audi R8 Spyder |
| Luxury SUV | Seats, Comfort | Aston Martin DBX |
| Performance | Engine, Turbo | Audi RS3, RSQ8 |
Sources: data/fleet.ts:28-154
The static data modeling in this project provides a robust, type-safe foundation for presenting luxury inventory. By centralizing vehicle attributes in a structured TypeScript module, the application achieves high performance and consistency without the overhead of a database for its relatively stable fleet information.