How geeeeeeker/supersonic works
Project type and purpose
• This is a full-stack, modular Java/Spring-Boot application that implements two paradigms:
• Chat BI (natural-language→SQL powered by LLMs, vector stores, plugins, conversation memory)
• Headless BI (semantic layer exposing metadata and query API)
• It includes a React/TypeScript front-end (webapp/packages/chat-sdk & supersonic-fe), several Java back-end modules (auth, authorization, chat/api, chat/server, headless/api, headless/server, common libraries), plus benchmarking, evaluation, and Docker/assembly scripts.
Top-level components
a. Front-end UI
• Chat BI client (chat-sdk)
• Headless BI console (supersonic-fe)
b. Back-end micro-modules (Spring Boot apps)
• Auth Service: authentication REST API
• Authorization Service: permission REST API
• Chat API: HTTP façade exposing chat endpoints
• Chat Server: core chat pipeline (schema mapper, parser, corrector, translator, plugin manager, memory)
• Headless API: semantic-layer façade
• Headless Server: semantic-layer engine (model management, YAML-driven metadata, JDBC adapters)
• Common library: shared config, Calcite SQL parser, embedding, JDBC templates
c. Persistence & caches
• Relational DB (H2/MySQL/Postgres etc.) for metadata and chat records
• Embedding store options (in-memory, Chroma, Milvus, PGVector, OpenSearch) for vector retrieval
• Caffeine cache for query caching
d. External services
• LLM providers via Dify, OpenAI, LocalAI, Ollama
• Third-party plugins (web service, web page, custom tools)
e. Operations
• Docker Compose / standalone launch scripts
• CI workflows (GitHub Actions)
Component interactions and data flows
• User (Browser) → Front-end UI → REST API calls to Chat API or Headless API
• Chat API → delegates to Chat Server modules:
1. Schema Mapper ← Knowledge Base (periodically built from semantic models)
2. Semantic Parser (rule-based & LLM-based)
3. Semantic Corrector (rule-based & LLM-based)
4. Semantic Translator → SQL
5. DB Adaptor → executes SQL against RDB
6. Post-processors (formatting, recommendations)
7. Chat Memory retrieval/insertion (vector store or DB)
8. Chat Plugin selection & invocation via LLM
• Headless API → Headless Server:
1. CRUD operations on YAML metadata (models, dimensions, metrics, tags)
2. Semantic model compilation → persisted to DB and Knowledge Base
• Auth & Authorization services sit in front of Chat/Headless APIs to enforce access control (dataset/column/row).
• Common library is invoked by all back-end modules for config, SQL parsing, HTTP clients, thread pools.
Architectural patterns & design principles
• Modular micro-services (many Java modules packaged as separate Spring Boot apps)
• SPI/Factory pattern for embedding stores, DB adaptors, LLM providers, authentication strategies, semantic parsers/correctors
• Layered design (REST controller → Service → Repository/Mapper → DB)
• Plugin architecture for chat extensions
• Caching layer (Caffeine) and asynchronous tasks (listeners, scheduled tasks)