How adrianhajdin/travel-agency-dashboard works
Project Type and Purpose
• This is a full-stack, server-rendered React application (using Vite + React Router “framework mode”) combined with Appwrite as the backend.
• It consists of two main fronts:
• A public site where end users can browse AI-generated travel itineraries, sign in, and pay for trips.
• An admin dashboard where staff can manage users, trips, and view analytics generated with Syncfusion charts.
Key Architectural Observations from File Structure
• Top-level “app” folder contains both client entry (entry.client.tsx) and server entry (entry.server.tsx).
• “app/routes” subdivides into “root” (public pages), “api” (serverless endpoints), and “admin” (dashboard pages).
• Appwrite integration under app/appwrite (auth.ts, dashboard.ts, trips.ts).
• Shared UI lives under “components/” and styling under app/app.css + Tailwind.
• Utility libraries in app/lib (stripe, utils).
• External data sources include REST Countries API (route loader), Gemini AI (via /api/create-trip), Stripe, Unsplash, Sentry.
a. Main Components
• Client Browser: React UI, Syncfusion components, Tailwind styling.
• SSR & API Server: React Router framework engine, entry.server.tsx, API route handlers under app/routes/api.
• Appwrite Backend: Authentication (account), Database (users, trips collections).
• External Services:
– Gemini AI (itinerary generation)
– Stripe (payment processing)
– REST Countries API (country metadata)
– Unsplash (image sourcing)
– Sentry (error monitoring)
b. Relationships & Data Flows
• User ↔ Browser: navigates pages, submits forms.
• Browser → SSR Server: initial requests for public/admin pages (via entry.server).
• SSR Server → Appwrite: server loaders fetch user info, stats, trips, using appwrite SDK.
• “Create Trip” Flow: Browser posts to /api/create-trip → Server handler composes a prompt → Calls Gemini AI API → Parses JSON → Stores trip document in Appwrite.
• Payment Flow: Browser calls Stripe client via app/lib/stripe.ts to create payment link → Stripe → returns to Browser.
• Admin Dashboard: SSR loaders aggregate stats from Appwrite (users, trips) + parseTripData → compute analytics → render charts.
c. Architectural Patterns
• SSR + Client-side hydration (React Router framework mode)
• Route-based code splitting (folder-per-route)
• Serverless functions (API routes) for AI orchestration
• Third-party BaaS (Appwrite)
d. Key Technologies & Libraries
• React 19 + Vite + React Router
• Tailwind CSS + custom app.css
• Syncfusion React components (charts, grids, maps)
• Appwrite SDK (account, database)
• Gemini AI (Google AI Studio API)
• Stripe API
• REST Countries public API
• Unsplash API
• Sentry (optional, per README)
Essential Elements
• Clear component labels (e.g., “entry.server.tsx – React Router SSR”)
• React Browser (rectangle)