YaCy.Uno Design Plan (Uno Platform / .NET 9 P2P Search Engine)
YaCy.Uno is a proposed C# reimplementation of the YaCy decentralized peer-to-peer search engine, based on Uno Platform 5.x + .NET 9. It aims for full compatibility with the YaCy P2P protocol (network: freeworld), interoperation with the Java and Go YaCy nodes, and deployment on Windows, macOS, Linux, WebAssembly, iOS, and Android. Default ports: 8900 (HTTP) / 8943 (HTTPS).
Key points
- Positioning: Full YaCy P2P Protocol v1 compatibility; Material Design 3 UI; multi-target (Desktop / WASM / Mobile / CLI / Docker); Apache 2.0 license.
- Search stack: SQLite FTS5 full-text index (
tokenize = 'unicode61 porter') over a documents metadata table (EF Core 9), with a pipeline of QueryParser → FTS5 BM25 match → parallel P2P remote search → merged ranking → FTS5 highlight snippets → SSE/SignalR streaming. - Ranking factors: BM25 relevance 40%, title match 20%, inbound links 15%, URL depth 10%, freshness 10%, language match 5%.
- Crawler: parallel workers via
Channel<T>+ Tasks, per-domain rate limiting, robots.txt/meta robots and sitemap support, incremental crawling (If-Modified-Since / ETag), persistent SQLite URL queue, live status via SignalR/SSE. - P2P/DHT: implements YaCy endpoints
/yacy/hello,/yacy/search,/yacy/seedlist,/yacy/transferRWI,/yacy/transferURL,/yacy/crawlReceipt,/yacy/query,/yacy/profile,/yacy/idx.json,/yacy/message. DHT: 256 partitions, redundancy factor 3, background index distribution. Peer types: virgin / junior / senior / principal. - Parsers:
IDocumentParserinterface with 30+ formats — HTML (AngleSharp), PDF (PdfPig), Office (Open XML SDK / NPOI), RSS/Atom, XML/SVG, JSON, plain text, image EXIF. Chinese full-text search via jieba.NET segmenter applied before FTS ingestion. - Technology choices: ASP.NET Core Kestrel (Web API), Serilog, Polly (retry/circuit breaker), CommunityToolkit.Mvvm, LiveChartsCore, Spectre.Console TUI, xUnit / NSubstitute / BenchmarkDotNet for testing.
- Search:
GET /api/search,GET /api/search/stream(SSE),GET /api/suggest - Crawl:
POST /api/crawl, status/history/pause/resume/abort - Peers:
GET /api/peers,POST /api/peers/connect - DHT:
GET /api/dht/stats, distribution stats - Admin: stats, config read/update, index browse/export/import
- Design: Material Design 3, blue-violet gradient primary (
#667eea→#764ba2), light/dark themes with system follow; desktop sidebar navigation, mobile bottom tab bar; pages for Hero (search), Search, Crawl, Peers, DHT, Stats, Config, Help. i18n via.resw(English, zh-CN initially). - Run modes: Desktop (embedded Kestrel), headless server, WASM, mobile (remote API), CLI, Docker (multi-stage build on
mcr.microsoft.com/dotnet/aspnet:9.0). - Requirements: .NET 9 runtime, 256MB RAM minimum (1GB recommended), 100MB disk, Windows 10+ / macOS 12+ / Linux (glibc 2.17+).
- Security: Kestrel TLS, Basic Auth + JWT for admin, RSA 2048 peer identity keys (YaCy-compatible), rate limiting, configurable CORS, input validation.
Architecture
Layered design:
1. Presentation — Uno XAML UI (Desktop/WASM/Mobile), ASP.NET Core Web API (REST/SSE/WebSocket), Spectre.Console TUI.
2. Application services — Search, Crawl, P2P/DHT, and Index services.
3. Core engine — SQLite FTS5 index, document parsers, YaCy-compatible protocol layer.
4. Storage — unified SQLite (EF Core + FTS5) holding documents, FTS virtual table, RWI reverse word index (rwi_terms), seeds, crawl queue/profiles, bookmarks, blacklist, config; plus filesystem for DB file, logs, and exports.
Project layout: YaCy.Uno.Core (engine library), YaCy.Uno.Server (ASP.NET Core API + background services + SignalR hubs), YaCy.Uno.App (Uno UI with Views/ViewModels/Themes), YaCy.Uno.Cli (TUI), plus tests, docs, and Docker files.
API design
REST endpoints mirror the YaCy-Go API for ecosystem compatibility:
Realtime via SSE (streaming search results), SignalR (crawl/P2P events), WebSocket as WASM-compatible fallback.
UI and deployment
url_hash column marked "UNSAFE not indexed"; per the FTS5 DDL shown, all listed columns are indexed — the comment appears inconsistent with the snippet.