How vandanmittal28/smart-sanskriti works
Purpose and deployment shape
Sanskriti AI is a heritage-tourism experience delivered primarily as a Next.js web application, with an Android WebView shell for mobile distribution. The web app supplies interactive monument discovery, AI-assisted recognition and chat, itineraries, quizzes, translations, narration, profiles, and gamification. The Android app loads a deployed or emulator-accessible web URL rather than duplicating product logic.
Paths: web-ui/app/page.tsx, apk/app/src/main/java/ai/sanskriti/app/MainActivity.java, apk/README.md.
Web application entry and composition
The Next.js App Router application enters through the root layout and home page. Shared application framing, navigation, theme, language, authentication, and backend warm-up are composed through wrapper/shell components. Feature pages are route-local client/server UI boundaries under app/.
Paths: web-ui/app/layout.tsx, web-ui/components/app-wrapper.tsx, web-ui/components/app-shell.tsx.
Experience modules
Primary user journeys are independently routed: exploration and monument detail; image recognition/scan; conversational assistance; trip itinerary generation; quizzes and treasure hunts; tickets, festivals, sustainability, and achievement views. Monument content and some user-facing state are locally modeled, allowing screens to work alongside remote AI and persistence services.
Paths: web-ui/app/explore/page.tsx, web-ui/app/monument/[id]/page.tsx, web-ui/app/recognition/page.tsx.
Server-side AI capability boundary
Next.js route handlers expose backend endpoints for chat, landmark recognition, audio transcription/narration, itinerary and quiz generation, and translation. Browser UI should call these routes rather than directly owning provider integration; apiClient is the likely client-side request abstraction. NVIDIA integration is isolated in a library module, while a separate local Python Chatterbox service supports local AI/audio capability.
Paths: web-ui/app/api/chat/route.ts, web-ui/app/api/recognize/route.ts, web-ui/lib/nvidia.ts, web-ui/local-ai/chatterbox/server.py.
Identity, profiles, and persistence
Supabase is the durable backend boundary for authentication, profiles, multilingual preferences, XP, badges, and realtime-facing leaderboard/profile data. Client/auth contexts distribute identity and user state through the React tree; route/page guards enforce protected UI access. SQL migrations define the database-side evolution.
Paths: web-ui/lib/supabase/client.ts, web-ui/lib/authContext.tsx, web-ui/components/auth-guard.tsx, web-ui/supabase/migrations/0001_xp_system.sql.
Content, media, and localization flow
Static monument datasets, ticket data, quiz questions, and audio assets provide baseline content. Language context and language metadata coordinate localized UI/content selection. Audio guides can resolve to bundled MP3 files, while narration APIs provide generated alternatives; time-travel visual assets are served directly from the Next.js public directory.
Paths: web-ui/lib/monuments.ts, web-ui/lib/languageContext.tsx, web-ui/hooks/useAudioGuide.ts, web-ui/public/audio/.
Android wrapper runtime
The Android Gradle project has one native activity and manifest-configured WebView runtime. It targets the hosted web product by default, with an environment-configurable URL for local emulator development. Network security configuration is a material boundary for HTTP/local endpoint access.
Paths: apk/app/src/main/java/ai/sanskriti/app/MainActivity.java, apk/app/src/main/AndroidManifest.xml, apk/app/src/main/res/xml/network_security_config.xml.
Main entry points: app-shell.tsx App shell · app-wrapper.tsx App wrappers · page.tsx Explore & monument · route.ts Chat API
Components 20
Next.js Web App
Primary product runtime.
- Root layout
web-ui/app/layout.tsx - App wrappers · Provides theme, language, auth, and backend warm-up.
web-ui/components/app-wrapper.tsx - App shell · Shared framing and navigation.
web-ui/components/app-shell.tsx - Home page
web-ui/app/page.tsx - Explore & monument · Discovery and monument-detail journey.
web-ui/app/explore/page.tsx - Recognition scan
web-ui/app/recognition/page.tsx - Other experience routes · Chat, itineraries, quizzes, tickets, festivals, and achievements.
- Auth guard · Protects authenticated UI routes.
web-ui/components/auth-guard.tsx
AI Services
Server-side AI capability boundary.
- Chat API
web-ui/app/api/chat/route.ts - Recognition API
web-ui/app/api/recognize/route.ts - NVIDIA integration
web-ui/lib/nvidia.ts - Chatterbox service
web-ui/local-ai/chatterbox/server.py
Identity & Data
Durable user state and content.
- Auth context · Distributes identity and profile state.
web-ui/lib/authContext.tsx - Supabase · Stores profiles, preferences, XP, badges, and leaderboard data.
web-ui/lib/supabase/client.ts - XP schema migration
web-ui/supabase/migrations/0001_xp_system.sql - Monument content · Baseline monument, ticket, and quiz content.
web-ui/lib/monuments.ts - Language context
web-ui/lib/languageContext.tsx - Audio guides · Uses bundled audio and generated narration alternatives.
web-ui/hooks/useAudioGuide.ts
Android Shell
WebView distribution runtime.
- WebView activity · Loads hosted or emulator-accessible web product.
apk/app/src/main/java/ai/sanskriti/app/MainActivity.java - Android WebView config · Configures runtime and local HTTP access.
apk/app/src/main/AndroidManifest.xml
Connections 20
- Root layout → App wrappers: composes
- App wrappers → App shell: provides
- App shell → Home page: frames
- App shell → Explore & monument: frames
- App shell → Recognition scan: frames
- App shell → Other experience routes: frames
- App wrappers → Auth context: distributes
- Auth guard → Auth context: checks
- Auth context → Supabase: auth and profile access
- XP schema migration → Supabase: evolves
- Explore & monument → Monument content: reads
- App wrappers → Language context: provides
- Explore & monument → Audio guides: plays guides
- Recognition scan → Recognition API: scan request
- Other experience routes → Chat API: AI requests
- Chat API → NVIDIA integration: provider calls
- Recognition API → NVIDIA integration: provider calls
- Chat API → Chatterbox service: local AI/audio option
- WebView activity → Android WebView config: configured by
- WebView activity → Home page: loads web URL