How shivanshdarji/flight-call-bot works
1. Overall shape
- This repository is a React + TypeScript frontend for a flight call-attendant bot, with a small separate backend layer under backend/.
- The main user experience appears to be a single-page app that simulates or drives customer support workflows for Air Services.
2. Primary runtime
- The client is built with Vite (vite.config.ts, src/main.tsx) and served as a static site.
- Deployment is configured for Render via render.yaml, which matches the repo’s static-site style deployment.
3. UI composition
- src/App.tsx is the top-level orchestrator.
- The main user flows are split into screen components:
- LoginScreen
- DashboardScreen
- ChatWidget
- LookupScreen
- NewBookingScreen
- RebookScreen
- RefundScreen
- DisruptedScreen
- ConfirmationScreen
- This suggests the app is organized around discrete operational workflows rather than a generic page hierarchy.
4. Conversation layer
- src/components/ChatWidget.tsx is the central interaction surface for the bot experience.
- The README says the app uses the OpenAI API, and the environment variable VITE_OPENAI_API_KEY indicates the key is used from the frontend runtime.
- The chat layer likely bridges conversational input into the domain screens and actions.
5. Domain workflows
- The named screens indicate the core business domains:
- flight lookup / search
- new booking
- rebooking
- refund handling
- disruption management
- confirmation
- Architecturally, these appear to be task-specific UI states driven by the bot or dashboard, not separate services.
6. Data model and fixtures
- src/types.ts defines shared client-side domain types.
- src/mockData.ts implies the app uses local sample data / simulation data rather than a visible persistent database in this repo.
- That points to a mostly front-end state-driven demo or prototype architecture.
7. Backend boundary
- There is a separate backend/src tree with:
- routes/bot.js
- services/escalationRules.js
- This suggests the backend is a thin API/service layer focused on bot handling and escalation logic, rather than a large standalone system.
- The presence of escalationRules implies business logic for deciding when a bot interaction should be escalated to a human or alternate path.
8. Likely data flow
- User input enters through the chat widget or workflow screens.
- The frontend manages the interaction state, drawing from shared types and mock data.
- For bot-specific logic, the app likely calls into the backend bot route, which in turn uses escalation rules.
- OpenAI-powered conversational behavior is part of the client configuration, so some AI interaction may happen directly in the browser.
9. Supportive documentation
- docs/api-docs.md, docs/scenario-matrix.md, and docs/project_updates_log.md indicate the repo includes process and behavior documentation alongside code.
- challenge-1-plan-v2.md suggests the project was built iteratively around a defined scenario set.
10. Operational boundaries
- There is no sign of a database, queue, auth provider, or third-party workflow engine in the tree.
- The architecture therefore looks like:
- UI/state layer in React
- AI-assisted conversational layer
- small server-side bot/escalation layer
- static deployment
- That makes it suitable for diagramming as a thin-client, workflow-centric application with limited backend complexity.
11. Important diagram takeaway
- If you draw this system, the key boundary is between:
- the browser-based React app handling screens, conversation, and workflow state
- and the backend bot service handling bot-specific routing/escalation logic
- Everything else in the repo supports those two halves.
Main entry points: App.tsx App · main.tsx main · bot.js Bot route · ChatWidget.tsx Chat
Components 18
Frontend app
React + TypeScript SPA that drives the flight support workflows.
- main · Browser entrypoint that mounts the React app.
src/main.tsx - App · Top-level screen and workflow coordinator.
src/App.tsx - Chat · Primary bot interaction surface.
src/components/ChatWidget.tsx - Login · Entry screen for user access.
src/components/LoginScreen.tsx - Dashboard · Main task hub for the support flows.
src/components/DashboardScreen.tsx - Lookup · Flight and booking lookup workflow.
src/components/LookupScreen.tsx - Booking · New booking workflow.
src/components/NewBookingScreen.tsx - Rebook · Flight rebooking workflow.
src/components/RebookScreen.tsx - Refund · Refund handling workflow.
src/components/RefundScreen.tsx - Disrupted · Disruption handling workflow.
src/components/DisruptedScreen.tsx - Confirmation · Final confirmation and success state.
src/components/ConfirmationScreen.tsx - Types · Shared client-side type definitions.
src/types.ts - Mock data · Local sample data used to simulate workflows.
src/mockData.ts
Backend service
Thin server-side layer for bot routing and escalation decisions.
- Bot route · Backend endpoint for bot requests.
backend/src/routes/bot.js - Escalation · Server-side logic for escalation decisions.
backend/src/services/escalationRules.js
Docs & deploy
Supporting documentation and deployment/runtime configuration.
- Vite config · Client build and dev-server configuration.
vite.config.ts - Render · Static deployment configuration.
render.yaml - API docs · Documentation for the service and scenarios.
docs/api-docs.md
Connections 17
- main → App: mounts · Browser entry mounts the root app.
- App → Chat: uses · App embeds the main conversation surface.
- App → Login: routes to · App can render the login flow.
- App → Dashboard: routes to · App can render the dashboard.
- App → Lookup: routes to · App can render the lookup workflow.
- App → Booking: routes to · App can render the booking workflow.
- App → Rebook: routes to · App can render the rebooking workflow.
- App → Refund: routes to · App can render the refund workflow.
- App → Disrupted: routes to · App can render the disruption workflow.
- App → Confirmation: routes to · App can render the confirmation state.
- App → Types: shares · UI flows use shared domain types.
- App → Mock data: seeds · App state is driven by local fixture data.
- Chat → Bot route: calls · Conversation requests can be sent to the backend bot route.
- Bot route → Escalation: uses · Bot routing relies on escalation logic.
- main → Vite config: builds with · The client is served through Vite.
- Render → main: deploys · Render serves the static frontend build.
- API docs → Bot route: describes · Docs capture the bot API behavior.