This shared internal package consolidates TypeScript types, enums, constants, Google Gemini AI structured generation schemas, and utility builders. It is imported by the frontend web app, the REST API server, and the CLI command tool, ensuring monorepo-wide consistency.
- Language: TypeScript (compiled into ESM and CommonJS outputs via standard
tsconfig). - AI Schema Types: @google/genai
- Why Shared AI Schemas? Centralizing enums, constants, and structured AI response schemas (like
generationTripSchema) ensures that the frontend form controls, the API command handlers, and the database entities are perfectly aligned. By using@google/genaitype definitions, these schemas can be passed directly to Gemini API requests to mathematically guarantee the AI generates JSON matching our database schemas, preventing runtime parser errors.
- Why Shared AI Schemas? Centralizing enums, constants, and structured AI response schemas (like
- Date Utilities:
date-fnsfor date math and interval calculations.
Standardized business enums ensuring uniform data persistence and display:
BudgetCategory:Economy|Standard|LuxuryCompanionType:Solo|Couple|Family|FriendsHotelCategory:Budget|MidRange|Luxury|Resort|BoutiqueActivityType:Sightseeing|Dining|Adventure|Transit|Shopping|Relaxation|Entertainment|Cultural|Nature
Official schema definitions leveraging @google/genai types, which are fed into Gemini during structured AI execution to ensure the returned responses comply with specific JSON structures:
generationTripSchema: Combines days, hotels list, and budget estimations.generationActivitySchema&generationDaySchema: Defines day-by-day activities.generationBudgetSchema: Standardizes budget breakdowns (flights, accommodation, food, activities).generationHotelSchema: Dictates hotel recommendation models.
A proxy-based class builder function (Builder) supporting class and interface creation. Enables writing fluent builder chains for tests and mock generation:
const trip = Builder(TripCommand).destination('Paris').budget(BudgetCategory.Standard).build()Contains authentication JWT payload models, shared response interface wrappers, and base objects.
Compile the shared package:
yarn workspace @travix/shared buildAny modifications to the enums, AI schemas, or types require building this package before building or running dependant applications.