Applied AI2025 Deployed

    MIRA AI Studio

    A multi-model AI chat app with web search, four modes and a project generator, running on free API tiers.

    System design

    Architecture Diagram

    Swipe
    Stream RequestFetch Live Web ContextAugment PromptSSE Token StreamChat InterfaceFRONTENDModel RouterBACKENDGroq and NVIDIAAITavily SearchCLOUD
    Web Application
    API Orchestrator
    AI & Search Providers
    Frontend
    Backend
    Database
    AI / ML
    API
    Cloud
    Storage
    DevOps

    Overview

    What it is

    MIRA AI Studio lists the live chat models from Groq and NVIDIA and keeps one conversation when you switch between them. Before answering, it can run a Tavily web search and list the sources. It has four modes (General, Code, Research with deeper search and inline citations, and Writer) and a project generator that returns multi-file apps, previews HTML ones in a sandboxed iframe and downloads them as a ZIP. Replies stream token by token. Chats are saved in the browser and synced to Supabase for signed-in users; without Supabase it runs in a local demo mode.

    Context

    The problem and my role

    Free AI chat tools are usually locked to one model, cannot look things up, and break when a conversation gets long or a model is busy. MIRA keeps several models in one place, grounds answers in live search, and keeps working through long chats and provider errors.

    My role

    Sole developer. I built the React frontend, the streaming Edge API, the provider, search and fallback logic, authentication and chat sync.

    System

    How it works

    The chat screen sends the conversation to POST /api/chat, which streams Server-Sent Events back. The server checks the request, applies a per-IP rate limit and resolves the chosen model against the provider's live model list. It works out a token budget for the model, runs a Tavily search for the latest message unless it is small talk, fits the history into the budget and summarises older turns if needed. It then streams the reply with mode-specific settings. Failed calls are retried with backoff, and if a model fails or returns nothing, one fallback model from the same provider is tried. In project mode the model returns JSON files that the server validates before the browser previews them.

    Process

    How I built it

    1. 01Loaded the live model lists from Groq and NVIDIA, filtered out non-chat models, and cached them for 10 minutes.
    2. 02Streamed replies over Server-Sent Events from a Vercel Edge function, with events for sources, notices, summaries, progress and token usage.
    3. 03Added Tavily web search with a 10-minute cache, a deeper search in Research mode, and skip rules for greetings and small talk.
    4. 04Fitted each conversation into the model's token budget and folded older turns into a running summary.
    5. 05Retried transient errors with exponential backoff and fell back to a preferred model from the same provider.
    6. 06Validated generated projects on the server (safe paths, file and size limits, one retry on bad JSON) and previewed them only in a sandboxed iframe.
    7. 07Synced chats and projects to Supabase with row-level security, with a local demo mode when Supabase is not configured.

    Implementation

    How the system is put together

    Frontend

    3 components

    React 18 and TypeScript
    Built the chat workspace, landing pages, history and account screens with typed components.
    Vite 5, Tailwind CSS 3.4 and shadcn/ui
    Handled the build and styled the interface with light and dark themes.
    react-markdown, remark-gfm and rehype-highlight
    Rendered Markdown, tables and syntax-highlighted code with copy buttons.

    AI and API

    2 components

    Groq API and NVIDIA API
    Served the open chat models through OpenAI-compatible endpoints, with live model lists and fallbacks.
    Tavily API
    Returned web results and sources for questions that need current information.

    Backend

    1 component

    Vercel Edge Functions
    Ran the streaming chat API and model list with input checks, origin checks and rate limits.

    Projects

    1 component

    Sandboxed iframe and JSZip
    Previewed generated HTML apps safely in the browser and downloaded projects as ZIP files.

    Authentication and data

    1 component

    Supabase with a local demo fallback
    Handled sign-in and synced chats and projects, protected by row-level security.

    Tools and testing

    1 component

    Vitest and ESLint
    Unit tests for project validation, context fitting and search rules, and code checks.

    Results

    What it achieved

    • Brought models from two providers into one chat that keeps context when you switch.
    • Added web search with cited sources and four task-specific modes.
    • Built a project generator with server-side validation, a sandboxed preview and ZIP download.
    • Kept long chats and busy free tiers working with token budgeting, summaries, retries and fallbacks.

    Reflection

    Challenges and outcome

    Where it stands

    Deployed on Vercel. The app streams replies from Groq and NVIDIA models, searches the web with Tavily, and works with Supabase accounts or in local demo mode.