Skip to content

Example 21 coding platform

github-actions[bot] edited this page Aug 31, 2026 · 2 revisions

Build: cmake --preset linux-ninja-release && cmake --build --preset linux-ninja-release

Coding Platform - ThemisDB als intelligente Code-Verwaltung mit VSCode Integration

πŸ“ Übersicht

Eine vollstΓ€ndige Coding-Plattform, die ThemisDB als Backend nutzt, um Code-Snippets, Projekte und Dokumentationen zu verwalten. Die Plattform bietet VSCode-Integration und kann Code-Beispiele aus dem Internet scrapen und intelligent indexieren.

✨ Features

Core Features

  • βœ… Code-Snippet-Verwaltung - Speichern und organisieren von Code-Fragmenten
  • βœ… Projekt-Management - VollstΓ€ndige Projekte mit Dateien und Strukturen
  • βœ… Dokumentations-Hub - Technische Dokumentationen zentral verwalten
  • βœ… Tagging & Kategorisierung - Flexible Organisation nach Sprachen, Frameworks, Topics

Web Scraping & Ingestion

  • βœ… Internet-Quellen scrapen - Automatisches Extrahieren von Code-Beispielen
  • βœ… GitHub-Integration - Repositories und Gists importieren
  • βœ… Stack Overflow - Fragen und Antworten crawlen
  • βœ… Dokumentations-Crawler - ReadTheDocs, DevDocs, etc.
  • βœ… Smart Parsing - Automatische Erkennung von Code-BlΓΆcken und Sprachen
  • βœ… Duplikat-Erkennung - Γ„hnliche Code-Snippets identifizieren

Semantic Search & AI

  • βœ… Vector Search - Semantische Code-Suche mit Embeddings
  • βœ… Code2Vec - Code in hochdimensionale Vektoren konvertieren
  • βœ… Γ„hnlichkeits-Suche - "Finde Γ€hnlichen Code"
  • βœ… Natural Language Queries - "Zeige mir Python Beispiele fΓΌr async/await"
  • βœ… Code-Empfehlungen - Basierend auf aktuellem Kontext

VSCode Integration

  • βœ… Extension - Native VSCode-Erweiterung
  • βœ… Snippet-Browser - Code-Snippets direkt in VSCode durchsuchen
  • βœ… Quick Insert - Snippets mit einem Klick einfΓΌgen
  • βœ… Context-Aware - VorschlΓ€ge basierend auf aktuellem Code
  • βœ… Sync - Lokale Snippets mit ThemisDB synchronisieren

Tkinter Desktop App

  • βœ… Code-Editor - Syntax-Highlighting und Bearbeitung
  • βœ… Tree-View - Hierarchische Projektstruktur
  • βœ… Search Interface - Leistungsstarke Suchfunktionen
  • βœ… Import/Export - Batch-Import von Code-Dateien
  • βœ… Preview - Live-Vorschau von Code-Rendering

πŸ“Š Datenmodell

CodeSnippet

{
    "id": "snippet_uuid",
    "title": "Async HTTP Request in Python",
    "description": "Example of async HTTP requests using aiohttp",
    "code": "import aiohttp\n...",
    "language": "python",
    "framework": "aiohttp",
    "tags": ["async", "http", "networking"],
    "embedding": [0.123, -0.456, ...],  # 512D code embedding
    "metadata": {
        "author": "max@example.com",
        "source_url": "https://github.com/...",
        "source_type": "github",
        "license": "MIT",
        "stars": 125,
        "created_at": "2025-12-22T10:00:00Z",
        "updated_at": "2025-12-22T15:30:00Z"
    },
    "stats": {
        "views": 245,
        "copies": 18,
        "likes": 12
    }
}

Project

{
    "id": "project_uuid",
    "name": "FastAPI REST API Example",
    "description": "Complete REST API with authentication",
    "language": "python",
    "framework": "fastapi",
    "files": [
        {
            "path": "main.py",
            "content": "from fastapi import FastAPI\n...",
            "language": "python"
        },
        {
            "path": "requirements.txt",
            "content": "fastapi==0.104.1\n...",
            "language": "text"
        }
    ],
    "structure": {
        "type": "tree",
        "root": {
            "name": "project_root",
            "children": [...]
        }
    },
    "dependencies": ["fastapi", "uvicorn", "pydantic"],
    "readme": "# FastAPI Example\n...",
    "tags": ["api", "rest", "authentication"],
    "metadata": {
        "source_url": "https://github.com/...",
        "source_type": "github_repo",
        "stars": 1500,
        "forks": 234
    }
}

Documentation

{
    "id": "doc_uuid",
    "title": "Python AsyncIO Guide",
    "content": "# AsyncIO\n\nAsync programming in Python...",
    "type": "guide",  # guide, tutorial, reference, api_doc
    "language": "python",
    "framework": "asyncio",
    "sections": [
        {
            "title": "Introduction",
            "content": "...",
            "code_examples": ["snippet_id_1", "snippet_id_2"]
        }
    ],
    "embedding": [0.234, -0.567, ...],
    "metadata": {
        "source_url": "https://docs.python.org/...",
        "source_type": "official_docs",
        "version": "3.12",
        "last_updated": "2025-12-01"
    },
    "related_snippets": ["snippet_uuid_1", "snippet_uuid_2"],
    "related_projects": ["project_uuid_1"]
}

ScrapingJob

{
    "id": "job_uuid",
    "type": "github_repo",  # github_repo, stackoverflow, docs_site
    "source_url": "https://github.com/user/repo",
    "status": "completed",  # pending, running, completed, failed
    "config": {
        "max_depth": 3,
        "file_patterns": ["*.py", "*.js", "*.md"],
        "exclude_patterns": ["test_*", "*_test.py"],
        "min_file_size": 100,
        "max_file_size": 100000
    },
    "results": {
        "snippets_created": 45,
        "projects_created": 1,
        "docs_created": 8,
        "duplicates_found": 12,
        "errors": 2
    },
    "started_at": "2025-12-22T10:00:00Z",
    "completed_at": "2025-12-22T10:15:23Z",
    "error_log": []
}

πŸ”§ Installation

Voraussetzungen

# Python 3.8+
python --version

# ThemisDB Server
docker run -d \
  --name themisdb \
  -p 8080:8080 \
  -p 18765:18765 \
  themisdb/themisdb:latest

# Node.js fΓΌr VSCode Extension (optional)
node --version  # v16+

Setup

cd examples/21_coding_platform

# Python Dependencies installieren
pip install -r requirements.txt

# Embedding-Modell herunterladen (automatisch beim ersten Start)
python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('microsoft/codebert-base')"

VSCode Extension installieren (Optional)

cd vscode_extension
npm install
npm run compile

# Extension in VSCode laden
# DrΓΌcke F5 in VSCode, um Extension Development Host zu starten

πŸš€ Verwendung

Desktop-Anwendung starten

python main.py

Web Scraping

# GitHub Repository scrapen
from web_scraper import GitHubScraper

scraper = GitHubScraper()
job_id = scraper.scrape_repository(
    url="https://github.com/fastapi/fastapi",
    max_files=100,
    file_patterns=["*.py"]
)

# Status prΓΌfen
status = scraper.get_job_status(job_id)
print(f"Scraped {status['results']['snippets_created']} snippets")
# Stack Overflow scrapen
from web_scraper import StackOverflowScraper

scraper = StackOverflowScraper()
job_id = scraper.scrape_questions(
    tags=["python", "asyncio"],
    min_score=10,
    max_questions=50
)
# Dokumentation crawlen
from web_scraper import DocsCrawler

crawler = DocsCrawler()
job_id = crawler.crawl_documentation(
    base_url="https://docs.python.org/3/library/asyncio.html",
    max_depth=2
)

Semantic Code Search

from code_indexer import CodeIndexer
from themis_client import ThemisClient

client = ThemisClient()
indexer = CodeIndexer(client)

# Natural Language Query
results = indexer.search_by_description(
    query="asynchronous HTTP requests in Python",
    limit=10
)

for snippet in results:
    print(f"{snippet['title']} - Similarity: {snippet['score']:.2f}")
    print(snippet['code'][:200])
    print("---")

VSCode Integration

  1. Extension installieren: Siehe Installation
  2. Command Palette ΓΆffnen (Ctrl+Shift+P)
  3. "ThemisDB: Search Snippets" eingeben
  4. Suchbegriff eingeben
  5. Snippet auswΓ€hlen und automatisch einfΓΌgen

Oder:

  • Sidebar ΓΆffnen: ThemisDB Icon in der Activity Bar
  • Snippets durchsuchen: Hierarchische Ansicht nach Sprachen
  • Drag & Drop: Snippet in Editor ziehen

πŸ“– Detaillierte Guides

πŸ—οΈ Architektur

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Tkinter Desktop App                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Editor  β”‚  β”‚  Search  β”‚  β”‚  Scraper Dashboard  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Code Indexer   β”‚     β”‚   Web Scraper    β”‚
β”‚  - Embeddings   β”‚     β”‚  - GitHub        β”‚
β”‚  - Vector DB    β”‚     β”‚  - StackOverflow β”‚
β”‚  - Similarity   β”‚     β”‚  - Docs Sites    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  ThemisDB API   β”‚
            β”‚  - Vector Model β”‚
            β”‚  - Doc Model    β”‚
            β”‚  - Graph Model  β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  ThemisDB Core  β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         VSCode Extension                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Sidebar  β”‚  β”‚  Command Palette    β”‚  β”‚
β”‚  β”‚ Browser  β”‚  β”‚  - Search           β”‚  β”‚
β”‚  β”‚          β”‚  β”‚  - Insert           β”‚  β”‚
β”‚  β”‚          β”‚  β”‚  - Sync             β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚ REST API
             β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  ThemisDB API   β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Use Cases

1. PersΓΆnliche Code-Bibliothek

Sammeln und organisieren Sie Ihre eigenen Code-Snippets:

# Snippet speichern
client.create_snippet(
    title="JWT Authentication Decorator",
    code=my_decorator_code,
    language="python",
    tags=["auth", "jwt", "decorator"]
)

# SpΓ€ter finden
snippets = client.search_snippets(
    query="authentication decorator",
    language="python"
)

2. Team Knowledge Base

Teilen Sie Code-Wissen im Team:

# Projekt importieren
project = client.import_project_from_github(
    url="https://github.com/company/internal-lib",
    visibility="team"
)

# Team-Mitglieder kΓΆnnen suchen
results = client.search_projects(
    query="database connection pooling",
    team="backend"
)

3. Learning Platform

Lernen Sie aus echtem Code:

# Beispiele von GitHub sammeln
scraper.scrape_repositories(
    search_query="fastapi authentication",
    min_stars=100,
    max_repos=20
)

# Tutorials generieren
tutorial = client.generate_tutorial(
    topic="FastAPI JWT Authentication",
    level="beginner"
)

4. Code Review Assistant

Finden Sie Best Practices:

# Γ„hnlichen Code finden
similar = client.find_similar_code(
    code=my_implementation,
    language="python",
    min_similarity=0.7
)

# Best Practices identifizieren
best_practices = [s for s in similar if s['metadata']['stars'] > 500]

πŸ› οΈ Technologie-Stack

Backend

  • ThemisDB - Multi-Model Database
    • Vector Model fΓΌr Code-Embeddings
    • Document Model fΓΌr Snippets und Docs
    • Graph Model fΓΌr Beziehungen
  • Python 3.8+ - Hauptsprache

Frontend

  • Tkinter - Desktop GUI
  • tkinter-code-editor - Syntax-Highlighting

Web Scraping

  • requests - HTTP Client
  • beautifulsoup4 - HTML Parsing
  • PyGithub - GitHub API Client
  • selenium (optional) - JavaScript-rendered Seiten

Code Analysis

  • tree-sitter - Code Parsing
  • pygments - Syntax-Highlighting
  • sentence-transformers - Text-Embeddings
  • microsoft/codebert-base - Code-Embeddings

VSCode Extension

  • TypeScript - Extension Sprache
  • VSCode Extension API - Integration
  • axios - API Client

πŸ“‹ Datei-Struktur

21_coding_platform/
β”œβ”€β”€ README.md                      # Diese Datei
β”œβ”€β”€ HOW_TO.md                      # Bedienungsanleitung
β”œβ”€β”€ VSCODE_INTEGRATION.md          # VSCode Setup
β”œβ”€β”€ WEB_SCRAPING.md                # Scraping Guide
β”œβ”€β”€ ARCHITECTURE.md                # System-Design
β”œβ”€β”€ requirements.txt               # Python Dependencies
β”œβ”€β”€ main.py                        # Desktop App Entry Point
β”œβ”€β”€ themis_client.py               # ThemisDB Client
β”œβ”€β”€ models.py                      # Datenmodelle
β”œβ”€β”€ web_scraper.py                 # Web Scraping Module
β”œβ”€β”€ code_indexer.py                # Code Embedding & Search
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ main_window.py            # Hauptfenster
β”‚   β”œβ”€β”€ editor_panel.py           # Code-Editor
β”‚   β”œβ”€β”€ search_panel.py           # SuchoberflΓ€che
β”‚   β”œβ”€β”€ scraper_panel.py          # Scraper Dashboard
β”‚   └── project_tree.py           # Projekt-Browser
β”œβ”€β”€ scrapers/
β”‚   β”œβ”€β”€ github_scraper.py         # GitHub Integration
β”‚   β”œβ”€β”€ stackoverflow_scraper.py  # Stack Overflow
β”‚   └── docs_crawler.py           # Dokumentations-Crawler
β”œβ”€β”€ vscode_extension/
β”‚   β”œβ”€β”€ package.json              # Extension Manifest
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ extension.ts          # Main Extension
β”‚   β”‚   β”œβ”€β”€ snippetProvider.ts   # Snippet TreeView
β”‚   β”‚   └── api_client.ts        # ThemisDB API Client
β”‚   └── README.md                 # Extension Docs
└── tests/
    β”œβ”€β”€ test_scraper.py
    β”œβ”€β”€ test_indexer.py
    └── test_client.py

πŸ”’ Sicherheit & Best Practices

API Keys

# .env Datei verwenden
GITHUB_TOKEN=ghp_xxxxxxxxxxxxx
STACKOVERFLOW_KEY=xxxxxxxxxxxxx

# In Code laden
from dotenv import load_dotenv
load_dotenv()

Rate Limiting

  • GitHub API: Max 5000 requests/hour (authenticated)
  • Stack Overflow: Max 300 requests/day (free tier)
  • Implementiert mit exponential backoff

Datenschutz

  • Keine Speicherung von PasswΓΆrtern oder Tokens in ThemisDB
  • Nur ΓΆffentlicher Code wird gescrapet
  • Respektierung von robots.txt

πŸ› Troubleshooting

Scraper funktioniert nicht

Error: GitHub API rate limit exceeded

LΓΆsung: GitHub Personal Access Token konfigurieren:

export GITHUB_TOKEN=ghp_your_token_here

Embeddings zu langsam

Warning: Embedding generation taking > 5s per snippet

LΓΆsung: GPU-Beschleunigung aktivieren:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

VSCode Extension lΓ€dt nicht

Error: Cannot find module 'axios'

LΓΆsung:

cd vscode_extension
npm install
npm run compile

πŸ“š WeiterfΓΌhrende Ressourcen

🀝 Beitragen

Wollen Sie neue Scraper hinzufΓΌgen oder Features verbessern?

  1. Forken Sie das Repository
  2. Erstellen Sie einen Feature Branch
  3. Implementieren Sie Ihre Γ„nderungen
  4. FΓΌgen Sie Tests hinzu
  5. Erstellen Sie einen Pull Request

Neue Scraper hinzufΓΌgen

# scrapers/my_scraper.py
from web_scraper import BaseScraper

class MyScraper(BaseScraper):
    def scrape(self, url: str) -> List[CodeSnippet]:
        # Ihre Implementierung
        pass

πŸ“„ Lizenz

Dieses Beispiel ist unter der MIT-Lizenz lizenziert - siehe LICENSE fΓΌr Details.

πŸ†˜ Support

Bei Fragen oder Problemen:


NΓ€chste Schritte:

  1. Starten Sie mit HOW_TO.md fΓΌr eine detaillierte Anleitung
  2. Lesen Sie WEB_SCRAPING.md um Code aus dem Internet zu importieren
  3. Installieren Sie die VSCode Extension fΓΌr nahtlose Integration

Status: Ready | Letzte Aktualisierung: 2025-12-24


ThemisDB 1.9.0-beta Β· Home Β· Module-Index Β· GitHub Β· Issues

ThemisDB Wiki

🏠 Overview

πŸš€ Getting Started

πŸ“– Tutorials

πŸ“— User Guide

βš™οΈ Operations & Security

πŸ“Ÿ Ops Runbooks

πŸ—οΈ Architecture

πŸ“ ADRs

πŸ”§ Contributing

πŸ“‹ Governance

πŸ” Audit

🧩 Plugins

πŸ”Œ Adapters

πŸ’‘ Examples

πŸ“¦ Client SDKs

πŸŽ“ Training

πŸ› οΈ Tools

πŸ€– Developer LLM Wiki

Clone this wiki locally