How sebastian-ec-dev/tutor_inteligente works
1. Overall shape
- This is a mobile client-only app built with React Native + Expo.
- There is no custom backend service in the repo; the app talks directly to Supabase for auth/data and to Gemini for AI tasks.
2. App entry and routing
- index.ts boots the Expo app and App.tsx is the top-level component.
- src/navigation/AppNavigator.tsx is the main boundary that decides which screen tree the user sees, typically separating unauthenticated flow from the authenticated study assistant flow.
3. Authentication boundary
- src/screens/LoginScreen.tsx handles sign-in / sign-up through Supabase Auth.
- After authentication, the app transitions into the main navigator and all study data becomes scoped to the current user.
4. Domain model in Supabase
- The README defines the core data model stored in PostgreSQL/Supabase:
- subjects for course organization
- audios for uploaded study material, transcript, summary, and metadata
- audio_embeddings for vectorized chunks used in semantic search
- The data is explicitly user-scoped through user_id, and audio records are tied to a subject_id.
5. Audio processing pipeline
- src/screens/AudioScreen.tsx is the ingestion/analysis surface for study recordings.
- The flow is: audio input → Gemini processing → transcript + summary + embeddings → Supabase persistence.
- This is the main “write path” of the system and is what turns raw class recordings into searchable study content.
6. Retrieval-Augmented chatbot pipeline
- src/screens/ChatbotScreen.tsx is the conversational query surface.
- The chatbot uses a RAG-style flow: it retrieves relevant chunks from Supabase using embeddings, then uses Gemini to compose the answer from that retrieved context.
- The README’s RPC function match_audio_embeddings is the key retrieval boundary: it filters by user and subject, then performs cosine-similarity search via pgvector.
7. Study browsing and summaries
- src/screens/HomeScreen.tsx likely acts as the user’s hub for subjects and stored study items.
- src/screens/ResumenScreen.tsx is the read-only view for the generated transcript/summary content associated with an audio entry.
- Together these screens separate organization from generated knowledge.
8. Service layer
- src/lib/supabase.ts centralizes the Supabase client configuration and is the app’s persistence/auth gateway.
- src/lib/gemini.ts centralizes Gemini API access for generation, transcription, and embeddings.
- These two files are the main external-service adapters and form the app’s integration layer.
9. Shared UI and presentation helpers
- src/components/ui/LoadingModal.tsx provides a shared loading state.
- src/components/ui/Colors.ts centralizes the visual theme.
- src/utils/MessageBubble.tsx and src/utils/burbujaEscribiendo.tsx support the chat UI, while src/utils/formateoTime.ts formats timestamps.
- src/utils/prompt.ts likely holds the system/instruction prompt used by the chatbot.
10. Key architectural boundaries
- UI layer: screens, reusable bubbles, modal, colors.
- Navigation layer: authenticated vs unauthenticated app flow.
- Service layer: Supabase and Gemini clients.
- Data layer: Supabase tables + vector search RPC.
- AI boundary: Gemini generates structured study artifacts and final chatbot answers; Supabase stores and retrieves them.
11. Technology choices that matter to the architecture
- React Navigation controls screen flow.
- Supabase PostgreSQL + Auth + pgvector is the persistent system of record.
- Gemini is the AI engine for content generation and semantic representation.
- Markdown chat rendering is part of the presentation layer, making AI responses readable in the chat UI.
Main entry points: ChatbotScreen.tsx Chatbot · supabase.ts Supabase · HomeScreen.tsx Home · AudioScreen.tsx Audio
Components 17
Entry
App bootstrapping and root component
Navigation
Screen-flow boundary for auth and main app states
- AppNavigator · Chooses unauthenticated versus authenticated app flow.
src/navigation/AppNavigator.tsx
Screens
Primary user-facing study flows
- Login · Handles sign-in and sign-up through Supabase Auth.
src/screens/LoginScreen.tsx - Home · Entry point for subjects and stored study items.
src/screens/HomeScreen.tsx - Audio · Processes recordings into transcript, summary, and embeddings.
src/screens/AudioScreen.tsx - Chatbot · Answers questions using retrieved embeddings and Gemini.
src/screens/ChatbotScreen.tsx - Resumen · Displays generated transcript and summary for an audio entry.
src/screens/ResumenScreen.tsx
Services
External integrations and persistence adapters
Shared UI
Reusable presentation pieces
- LoadingModal · Shared loading state for async flows.
src/components/ui/LoadingModal.tsx - Colors · Centralized visual palette and UI colors.
src/components/ui/Colors.ts
Utilities
Chat helpers and formatting
- MessageBubble · Renders chatbot conversation messages.
src/utils/MessageBubble.tsx - Typing Bubble · Animated typing indicator for chat responses.
src/utils/burbujaEscribiendo.tsx - Time Format · Formats timestamps for the UI.
src/utils/formateoTime.ts - Prompt · Holds chatbot system or instruction prompt content.
src/utils/prompt.ts
Other components
- README · Documents the Supabase schema and retrieval boundary.
README.md
Connections 20
- index.ts → App.tsx: boots · Expo entry mounts the root app.
- App.tsx → AppNavigator: renders · App delegates screen flow to the navigator.
- AppNavigator → Login: unauthenticated · Shows login flow before user session exists.
- AppNavigator → Home: authenticated · Shows the main study assistant experience after auth.
- Login → Supabase: auth · Uses Supabase Auth for sign-in and sign-up.
- Home → Audio: open · Home leads into recording ingestion and analysis.
- Home → Chatbot: open · Home leads into conversational study assistance.
- Home → Resumen: open · Home leads to generated content detail views.
- Audio → Gemini: analyze · Audio is processed by Gemini into study artifacts.
- Audio → Supabase: store · Persists transcript, summary, embeddings, and metadata.
- Chatbot → Supabase: retrieve · Fetches relevant chunks via vector search and filters.
- Chatbot → Gemini: answer · Gemini composes the final response from retrieved context.
- Resumen → Supabase: read · Loads stored transcript and summary content.
- Audio → LoadingModal: status · Shows progress during upload and processing.
- Chatbot → MessageBubble: render · Chat responses are displayed through message bubbles.
- Chatbot → Typing Bubble: feedback · Typing indicator communicates streaming or waiting states.
- Chatbot → Prompt: guide · Prompt shapes assistant behavior and answer style.
- App.tsx → Colors: theme · Root UI uses shared color tokens.
- README → Supabase: schema · Documents subjects, audios, embeddings, and RPC search boundary.
- README → Gemini: ai flow · Documents the generation pipeline used by the app.