Minecraft Ai
This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: ``bash npm run dev or yarn dev or pnpm dev or bun dev ` Open http://...
Technical Architecture & Engineering Overview
Detailed system design and core implementation
Core System Architecture
The solution follows a classic client‑server model. The frontend (Next.js + TypeScript) communicates asynchronously with the backend API (FastAPI) over HTTP. The UI renders streamed answers, citation badges, and a WebGL canvas that displays the 3D block generated by the server.
Data Ingestion & RAG Engine
Documentation (20 support tickets) is pre‑processed into chunks and indexed by a hybrid RAG engine that combines BM25 keyword matching with TF‑IDF cosine similarity. The get_rag_engine() singleton supplies searchable chunks used by the AgentPipeline to retrieve relevant context for each query.
Execution Flow
- The client sends a
POST /askwith a natural‑language question. AgentPipelineroutes the request through the Intent Router, applying safety guardrails before invoking the RAG engine.- Retrieved documents are passed to the LLM (not shown) which formulates an answer and may trigger a tool call.
- If the tool call is a block generation request, the server executes
generate_dynamic_blockvia thePOST /generate_blockendpoint, producing a Blockbench JSON, a binary.glb, and a 16×16 PNG texture. - All tool interactions are logged to
tool_calls.jsonfor auditability.
Security & Guardrails
The Intent Router enforces content policies, filters disallowed queries, and logs every tool invocation. Invalid or empty prompts result in a 400 error, preventing misuse of the generation pipeline.
Build & Deployment Topology
Docker Compose defines three services: backend (FastAPI), frontend (Next.js), and a placeholder for a vector store (e.g., Qdrant). Environment variables propagate API keys (e.g., GEMINI_API_KEY). Volumes persist backend logs, and the stack is reachable at http://localhost:3000 for the UI and http://localhost:8000 for the API.
System Diagrams & Flow Visualizations
Interactive Mermaid architecture & execution flows
Core System Features
Key capabilities & architectural features
Core minecraft-ai functionality
Core minecraft-ai functionality
Hybrid RAG Q&A engine combining BM25 lexical search with TF-IDF cosine similarity scoring.
Hybrid RAG Q&A engine combining BM25 lexical search with TF-IDF cosine similarity scoring.
Agent intent router distinguishing between document inquiries, tool actions, and block generation requests.
Agent intent router distinguishing between document inquiries, tool actions, and block generation requests.
Safety guardrail engine evaluating incoming prompts to enforce abstention policies.
Safety guardrail engine evaluating incoming prompts to enforce abstention policies.
Procedural 3D Minecraft block generator producing Blockbench Java JSON models and binary .glb assets.
Procedural 3D Minecraft block generator producing Blockbench Java JSON models and binary .glb assets.
16x16 pixel-art PNG texture generator customized to descriptive input prompts.
16x16 pixel-art PNG texture generator customized to descriptive input prompts.
Interactive WebGL 3D model viewer with 360-degree orbit controls integrated in the Next.js UI.
Interactive WebGL 3D model viewer with 360-degree orbit controls integrated in the Next.js UI.
Real-time chat interface displaying grounded document citations and relevance metrics.
Real-time chat interface displaying grounded document citations and relevance metrics.
Visual response type badges categorizing outputs as Answer, Abstention, Tool Call, or Guardrail.
Visual response type badges categorizing outputs as Answer, Abstention, Tool Call, or Guardrail.
Structured tool execution logging capturing arguments and status in tool_calls.json.
Structured tool execution logging capturing arguments and status in tool_calls.json.
Automated evaluation benchmark running 15 evaluation queries against a golden dataset.
Automated evaluation benchmark running 15 evaluation queries against a golden dataset.
Multi-container Docker Compose orchestration for full-stack local deployment.
Multi-container Docker Compose orchestration for full-stack local deployment.
Grounded Retrieval-Augmented Generation Q&A over Craftify support documentation.
Grounded Retrieval-Augmented Generation Q&A over Craftify support documentation.
Hybrid BM25 and TF-IDF cosine similarity vector retrieval engine.
Hybrid BM25 and TF-IDF cosine similarity vector retrieval engine.
Procedural 3D Minecraft block asset synthesis from natural language prompts.
Procedural 3D Minecraft block asset synthesis from natural language prompts.
Automated 16x16 pixel-art PNG texture generation.
Automated 16x16 pixel-art PNG texture generation.
Interactive WebGL 3D model viewer with full 360-degree orbit controls.
Interactive WebGL 3D model viewer with full 360-degree orbit controls.
Agent Safety Guardrail engine with automated query abstention capabilities.
Agent Safety Guardrail engine with automated query abstention capabilities.
Real-time visual response badges (Answer, Abstention, Tool Call, Guardrail).
Real-time visual response badges (Answer, Abstention, Tool Call, Guardrail).
Structured JSON logging for tool invocations and intent routing.
Structured JSON logging for tool invocations and intent routing.
Backend health check endpoint (`GET /health`) displaying chunk indexing status.
Backend health check endpoint (`GET /health`) displaying chunk indexing status.
Full containerized development and deployment setup via Docker Compose.
Full containerized development and deployment setup via Docker Compose.
FastAPI REST API with `/ask`, `/health`, and `/generate_block` endpoints
FastAPI REST API with `/ask`, `/health`, and `/generate_block` endpoints
Hybrid BM25 + TF‑IDF RAG search over Craftify documentation
Hybrid BM25 + TF‑IDF RAG search over Craftify documentation
Agent Intent Router with safety guardrails and tool call logging
Agent Intent Router with safety guardrails and tool call logging
Procedural 3D block generation producing Blockbench JSON, `.glb`, and 16×16 PNG textures
Procedural 3D block generation producing Blockbench JSON, `.glb`, and 16×16 PNG textures
Interactive WebGL 3D viewer with 360° orbit controls in the frontend
Interactive WebGL 3D viewer with 360° orbit controls in the frontend
Real‑time chat console UI with response‑type badges (Answer, Abstention, Tool Call, Guardrail)
Real‑time chat console UI with response‑type badges (Answer, Abstention, Tool Call, Guardrail)
Docker Compose orchestration for backend, frontend, and vector store
Docker Compose orchestration for backend, frontend, and vector store
Evaluation harness that runs 15 benchmark queries with 100 % success
Evaluation harness that runs 15 benchmark queries with 100 % success
Comprehensive logging of tool executions for auditability
Comprehensive logging of tool executions for auditability
TypeScript‑based Next.js frontend with hot‑reload development server
TypeScript‑based Next.js frontend with hot‑reload development server
Engineering Challenges & Solutions
Problem statements & resolution strategies
Balancing retrieval speed vs. semantic relevance in the hybrid BM25/TF‑IDF engine
Balancing retrieval speed vs. semantic relevance in the hybrid BM25/TF‑IDF engine
Ensuring safe tool execution while allowing expressive LLM‑driven actions
Ensuring safe tool execution while allowing expressive LLM‑driven actions
Managing stateful streaming responses over HTTP without WebSocket complexity
Managing stateful streaming responses over HTTP without WebSocket complexity
Packaging large 3D assets (Blockbench JSON, `.glb`) within a lightweight Docker image
Packaging large 3D assets (Blockbench JSON, `.glb`) within a lightweight Docker image
Designing a generic logger that captures diverse tool payloads without schema lock‑in
Designing a generic logger that captures diverse tool payloads without schema lock‑in
Providing a seamless developer experience across Python virtual environments and Docker
Providing a seamless developer experience across Python virtual environments and Docker
API Reference & Endpoints
REST API surface & route documentation
| METHOD | ENDPOINT PATH | DESCRIPTION | COPY |
|---|---|---|---|
| GET | / | Endpoint defined in backend/app/main.py | |
| GET | /health | Endpoint defined in backend/app/main.py | |
| POST | /generate_block | Endpoint defined in backend/app/main.py | |
| POST | /ask | Endpoint defined in backend/app/main.py |
Key Code Modules & Architecture
Core file entrypoints and service responsibilities
backendModule component managing backend source logic
frontend/src/appModule component managing app source logic
docsModule component managing docs source logic
frontendModule component managing frontend source logic
frontend/public/modelsModule component managing models source logic
frontend/srcModule component managing src source logic
frontend/src/componentsModule component managing components source logic
User Journey Pipeline
- 1User accesses application user interface via browser
- 2User triggers action invoking HTTP/WebSocket API endpoints
Execution Code Flow
- 1Client or caller initiates request to application entrypoint
- 2Backend router validates request parameters and applies middleware
- 3Application serializes JSON/audio/data response back to client
System FAQ & Technical Specifications
Frequently asked questions and core architecture details
Q: What technologies are used in Minecraft Ai?
Minecraft Ai is engineered using modern full-stack frameworks.
Q: What core engineering problem does Minecraft Ai solve?
This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: ``bash npm run dev or yarn dev or pnpm dev or bun dev ` Open http://...
Q: How is 'Balancing retrieval speed vs. semantic relevance in the hybrid BM25/TF‑IDF engine' resolved in Minecraft Ai?
Resolved through specialized system architecture and resilient state handling.
Related Systems & Case Studies
Explore similar technical architectures and projects