Project Info
Yatra is an AI-generated historical walkthrough app. A user picks a place and an era; the backend retrieves grounded historical context via RAG, generates a 3–5 stop narrated walkthrough with images, and serves it as an interactive, shareable experience.
Inspiration
The idea originated in 10th grade when it was formed through two independent concepts. One of my friends mentioned the need for something to be created with the help of which you can restore artifacts. And later back in December 2025 , I had been to The Museum of the Future in Dubai, where I saw a scanner that could display information about the artifact pointed out by the user. Although none of the ideas alone resonated, their synthesis remained in my head. And taking into account the richness of historical places in India, the idea of accessibility of history continued to appear in my mind. Historical textbooks or Wikipedia provide you with the factual information regarding the certain time period and the place; however, there is no feeling of presence in time. One AI-generated image gives you one frame with no story in it. Thus, Yatra falls somewhere in between, giving you an opportunity to walk through the historical place itself, see it, read information about the life there and move from scene to scene.
What it does
Search -user selects a place and era on the frontend. Global cache check - MongoDB is checked for an existing system-owned walkthrough for that exact place/era. If found, served instantly. RAG retrieval - on a cache miss, a local Chroma vector store is queried for historically grounded context. Agent generation - a Gemini agent turns that context into a structured 3–5 stop JSON walkthrough (second-person narration, daily-life facts, continuity-aware image prompts). Image generation - each stop's image prompt runs through a fallback chain: Imagen 4 (fast → standard → ultra) → Pollinations.ai → transparent placeholder. Persistence - the finished walkthrough (including Base64 image URLs) is saved to MongoDB under user_uid="system" and returned to the frontend. Users can also save a copy to their own account (clone, not move) and generate an 8-character share slug for public, unauthenticated viewing.
How we built it
Backend: FastAPI, with a RAG layer (OpenAI embeddings over a curated 25-place/era corpus, indexed in Chroma) feeding historical context into an agent step that generates the structured walkthrough JSON. Agent: runs on Google Gemini, with a same-provider fallback across Gemini's own model tiers for resilience against quota limits. Image generation: a multi-tier fallback chain, landing on a working free-tier image source when primary options weren't accessible namely Pollination Persistence: MongoDB Atlas completed walkthroughs are saved verbatim, so reopening or sharing one replays the exact original result rather than regenerating it. Auth: Firebase (Google + email/password). Frontend: React/Vite, merged from two independently-built pieces , a landing/auth experience and the core walkthrough dashboard into one integrated web- app during the build.
Challenges we ran into
Provider quota limits forced real architecture decisions under time pressure we ended up routing the agent through Gemini and building a same-provider fallback chain rather than a single hardcoded model call, which made the pipeline meaningfully more resilient than our original design. Image generation reliability was a recurring fight primary providers weren't consistently accessible, so we built a multi-tier fallback with a placeholder as a last resort, ensuring a single failed image never breaks the whole walkthrough. Merging two independently-built frontend pieces (built by different people, different tooling versions, different design systems) into one coherent web-app without regressing either required an isolated dependency upgrade pass before the actual merge to keep the two changes separable.
Accomplishments we're proud of
Agent JSON validity held at or above our >90% target across a real batch of historical place/era pairs, not just a handful of manual tests. Firebase Auth and MongoDB persistence both work correctly, including correct per-user isolation on saved walkthrough history. Kept the core loop demoable throughout, even while absorbing a full extra role's worth of scope with a smaller team than planned.
What we learned
Coordinating a multi-stage AI pipeline madee up of RAG retrieval, structured generation, and image synthesis all depending on each other's output, turned out to be harder than treating each stage in isolation. Small inconsistencies early in the chain (a vague retrieved context, an ambiguous image prompt) compound by the final stop. We learned to invest heavily in structuring the intermediate JSON contract between stages so failures were caught early rather than surfacing as a garbled walkthrough downstream.
What's next
Wire up the supported places list - connect the frontend to GET /api/walkthrough/places so users can't submit unsupported place/era combinations and hit a 400. Finish sharing — stabilize public link generation and add a proper "Walkthrough Not Found" state for broken/invalid share links. Move off Base64 image storage - upload generated images to Firebase Storage and store only the CDN URL, instead of bloating MongoDB with data URIs. Migrate off deprecated Imagen models - move to imagen-3.0-generate-001 or native Gemini image generation ahead of the late-2026 deprecation. Expand the historical corpus - support more place/era combinations beyond the initial set. Mobile-responsive layout. Dedicated viewer page - a proper standalone view for walkthroughs instead of the current modal-based flow. User profiles - persistent identity beyond auth, surfacing saved walkthroughs and history. Conversational agent - a chat interface for asking follow-up questions about a stop's historical context. Gamification - mark visited places, track progress across walkthroughs.
Yatra
Yatra is an AI-generated historical walkthrough app. A user picks a place and an era; the backend retrieves grounded historical context via RAG, generates a 3–5 stop narrated walkthrough with images, and serves it as an interactive, shareable experience.
How it works
- Search — user selects a place and era on the frontend.
- Global cache check — MongoDB is checked for an existing
system-owned walkthrough for that exact place/era. If found, served instantly. - RAG retrieval — on a cache miss, a local Chroma vector store is queried for historically grounded context.
- Agent generation — a Gemini agent turns that context into a structured 3–5 stop JSON walkthrough (second-person narration, daily-life facts, continuity-aware image prompts).
- Image generation — each stop's image prompt runs through a fallback chain: Imagen 4 (fast → standard → ultra) → Pollinations.ai → transparent placeholder.
- Persistence — the finished walkthrough (including Base64 image URLs) is saved to MongoDB under
user_uid="system"and returned to the frontend.
Users can also save a copy to their own account (clone, not move) and generate an 8-character share slug for public, unauthenticated viewing.
flowchart TD
A[User selects place + era] --> B{Cache check<br/>MongoDB system-owned}
B -->|Hit| C[Serve cached walkthrough]
B -->|Miss| D[RAG retrieval<br/>Chroma vector store]
D --> E[Gemini agent<br/>generates 3-5 stop JSON]
E --> F[Image generation<br/>Imagen 4 → Pollinations → placeholder]
F --> G[Persist to MongoDB<br/>user_uid=system]
G --> H[Return to frontend]
Tech stack
| Layer | Technology |
|---|---|
| Frontend | React + Vite + Tailwind, state-based routing (no router library) |
| Backend | FastAPI (Python), routes mounted in main.py |
| Agent | Google Gemini (google.genai SDK) |
| RAG / Vector store | Chroma, local + persistent, runs in a thread pool off the asyncio loop |
| Image generation | Imagen 4 tiers → Pollinations.ai HTTP fallback → static placeholder |
| Auth | Firebase Auth (Google OAuth), JWT idToken in Authorization header |
| Database | MongoDB (global cache + per-user history + share slugs) |
Architecture notes
- Frontend uses conditional state rendering rather than
react-router-dom.App.tsxownsuser/idTokencontext and renders<Dashboard>or<LandingPage>.<WalkthroughModal>is injected at the top level so guests can open shared links without authenticating. - Backend is organized into an API layer (
backend/api/walkthrough.py), a RAG pipeline (backend/rag/), an agent engine (backend/agent/), and an image fallback pipeline (backend/services/image_gen.py). - Save vs. clone: saving a walkthrough clones the
systemdocument with a new UUID and the user's UID, clears anyshare_slug, and leaves the original in the global cache untouched.
API reference
All routes mounted directly via main.py.
| Method & Path | Auth | Purpose |
|---|---|---|
GET /api/walkthrough/places | No | Returns the 25 statically supported place/era combinations |
POST /api/walkthrough | No | Direct RAG + AI generation, no caching/DB check |
POST /api/walkthrough/start | No (defaults to user_uid="system") | Cache check → generate → generate images → save to global pool |
GET /api/walkthrough/mine | Yes | Thumbnail summaries of the authenticated user's walkthroughs |
POST /api/walkthrough/{id}/save | Yes | Clones a system walkthrough into the user's account |
POST /api/walkthrough/{id}/share | Yes | Validates ownership, generates an 8-char slug |
GET /api/walkthrough/shared/{slug} | No | Public retrieval for shared links |
GET /api/walkthrough/{id} | No | Public retrieval by exact ID (used by History tab) |
GET /api/walkthrough/{id}/stop/{n} | No | Polling endpoint for per-stop image generation status |
POST /api/walkthrough/start payload: {"place": "string", "era": "string", "rag_context": "string (optional)"}
Environment variables
| Variable | Used by |
|---|---|
GEMINI_API_KEY | Agent — world-state generation |
OPENAI_API_KEY | Embeddings + image generation |
CHROMA_PERSIST_DIR | RAG vector store path |
NEXT_PUBLIC_API_URL | Frontend — backend base URL |
FIREBASE_ADMIN_SDK_JSON | FastAPI — Firebase Admin SDK service account (keep secret) |
MONGODB_URI | FastAPI — MongoDB connection string (keep secret) |
NEXT_PUBLIC_FIREBASE_CONFIG | Frontend — Firebase client config (public, safe to expose) |
Known gaps / tech debt
- Hardcoded search inputs —
Home.jsxuses free-text/hardcoded selects instead of callingGET /api/walkthrough/places, so users can submit unsupported combinations and get a 400. - Deprecated Imagen models —
imagen-4.0-fast-generate-001and related tags are slated for deprecation in late 2026; migration toimagen-3.0-generate-001or native Gemini image paths is needed eventually. - No shared-link error UI — a failed
/shared/[slug]fetch only logs to console; there's no "Walkthrough Not Found" state for guests. - Base64 images stored in MongoDB — Pollinations and placeholder images are saved as Base64 data URIs directly in documents, which bloats the DB. The intended fix (upload to Firebase Storage, store only the CDN URL) is stubbed but unimplemented.
Analysis
View
Metric
- 29
- 8
- 6
- 2
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- FirebaseIn code
- HTMLIn code
- JavaScriptIn code
- PythonIn code
- ReactIn code
- SQLIn code
- Tailwind CSSIn code
- TypeScriptIn code
- Google GeminiClaimed
- MongoDBClaimed
10 of 12 appear in the indexed code. 2 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
365 KB
Source files
127
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
magnusinst84-sudo/Yatra
290 files · 101.3 MB · @ cc9475b
Structure
Interface
30 files · 10%Screens, components and styles rendered to the user.
API & routing
3 files · 1%Request entry points: routes, handlers and controllers.
Application logic
53 files · 18%Domain rules, services and shared utilities.
+3 moreData & schema
6 files · 2%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python36%
- TypeScript28%
- JavaScript25%
- Markdown7%
- CSS3%
- HTML1%
- Other (2)0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
old_frontend_segments/landing_page/package.json
npm · 14- framer-motion
- lucide-react
- react
- react-dom
- +10 more
frontend/package.json
npm · 13- firebase
- framer-motion
- lucide-react
- react
- react-dom
- +8 more
old_frontend_segments/frontend/package.json
npm · 11- firebase
- react
- react-dom
- +8 more
requirements.txt
pypi · 11- chromadb
- fastapi
- firebase-admin
- google-genai
- httpx
- motor
- nltk
- pydantic
- python-dotenv
- uvicorn[standard]
- wikipedia-api
backend/requirements.txt
pypi · 8- chromadb
- fastapi
- firebase-admin
- google-genai
- httpx
- motor
- pydantic
- uvicorn[standard]
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.