braket.uk

AI-powered math and physics tutoring platform with real-time streaming conversations, LaTeX rendering, image analysis for homework problems, and voice interaction. Named after bra-ket notation from quantum mechanics. A side project - mostly a playground for testing new tech.

Key Features

Live LaTeX rendering during streaming responses

Socket.IO chunk-based streaming with throttling

MathLive equation editor with symbol palette

Image upload for homework problem analysis

Guest-to-registered seamless account upgrade

Vue.js FastAPI PostgreSQL Socket.IO LLMs Docker GitHub Actions
braket.uk

Overview

braket.uk is an AI tutoring platform for mathematics and physics. Real-time streaming responses with live LaTeX rendering - students see equations formatted as the AI explains concepts.

Users can upload images of homework problems for AI analysis, use voice input for hands-free interaction, and compose complex equations using an integrated mathematical editor. The architecture prioritizes low-latency streaming and connection resilience for a seamless learning experience.

Tech Stack

Frontend

  • Vue.js + Quasar
  • KaTeX + MathLive

Backend

  • FastAPI
  • PostgreSQL

Real-Time

  • Socket.IO (bidirectional)
  • Chunk-based streaming
  • Auto-reconnection
  • WebSocket + polling fallback

Infrastructure

  • Docker
  • GitHub Actions
  • DigitalOcean

Streaming Architecture

Real-time AI responses stream character-by-character while maintaining proper LaTeX rendering:

Client                              Server
  |                                    |
  |-------- send_message ------------->|
  |                                    |
  |<------- message_ack ---------------|  (delivery confirmed)
  |                                    |
  |<------- stream_start --------------|  (streaming begins)
  |                                    |
  |<------- message_chunk -------------|  \
  |<------- message_chunk -------------|   } batched, throttled
  |<------- message_chunk -------------|  /
  |                                    |
  |<------- stream_complete -----------|  (final + DB persist)

Key Features

Live LaTeX Rendering

Mathematical notation renders in real-time during streaming. Buffering strategy detects incomplete LaTeX delimiters and holds content until expressions complete, preventing rendering failures mid-stream.

Homework Image Analysis

Upload photos of handwritten problems or textbook exercises. Images are base64 encoded within Socket.IO messages, decoded server-side, and integrated into the AI conversation context for analysis.

Mathematical Equation Editor

MathLive integration provides an interactive equation editor with symbol palette. Students can compose complex expressions (integrals, matrices, Greek letters) without knowing LaTeX syntax.