Ada AI // Python, Gemini API, Render Server

From Brittle Scraping to API Routing

Ada AI is a specialized coding assistant built to provide students and developers with accurate, context-aware debugging help. Unlike generic AI chatbots, Ada is engineered specifically for software development workflows, integrating a real-time code editor directly into the conversation loop.

System Architecture

The system was re-architected from an unstable web-scraper into a robust, authenticated Python routing layer hosted on Render. The core philosophy is strict data segregation: connecting to Google's Gemini 3.1 model while keeping data isolated.

  1. Input & Security: Security is handled via Google Firebase Authentication. Upon login, a unique User ID is generated. This acts as the primary key for all database operations. The frontend captures messages and editor content, sending it over HTTPS with a Firebase ID Token.
  2. Server Verification: The Python Flask backend validates the ID Token using the Firebase Admin SDK before processing requests.
  3. AI Processing: Validated requests are formatted into JSON against a strict system prompt enforcing the "Coding Assistant" persona to resist injection attacks, then forwarded to Gemini.
  4. Response Streaming: The AI response is streamed back to the browser in real-time chunks via Server-Sent Events (SSE), significantly reducing perceived latency.
When Ada writes code, it automatically detects the language and extracts it into a dedicated Artifact Panel. This keeps the chat clean and provides a workspace to view or copy the code.

Data Storage & Privacy

Data persistence is managed via Google Cloud Firestore (NoSQL), structured to maximize privacy and ease of deletion.

To facilitate collaboration, users can generate unique public links for any conversation. These links are read-only, but if a viewer logs in, they can "fork" a copy of the chat to their own history and continue the conversation seamlessly.