Standard Grant: FabGraph Proof-of-Concept

Introduction

Project Name: FabGraph
Name of the organisation or individual submitting the proposal: Jules Lai (Fabstir)


Describe your project

FabGraph is a decentralised graph database library built natively on Enhanced S5.js. This proof-of-concept grant delivers the core foundation: graph storage, traversal, and an LLM-friendly JSON Query DSLβ€”proving that graph databases work efficiently on Sia’s decentralised storage.

What is a Graph Database?

A graph database stores data as nodes (things) and edges (relationships between things). Unlike traditional databases that store data in tables, graph databases make relationships first-class citizensβ€”you can traverse connections naturally without complex JOIN operations.

Example: Film Discovery

Imagine searching for films:

β€œFind films where actors who worked with Tom Hanks also appeared in sci-fi films”

In a traditional SQL database, this requires multiple complex JOINs across tables. In a graph database, it’s a natural traversal:

(Tom Hanks)--[ACTED_IN]-->(Film)
                            |
            (Co-Actor)<--[ACTED_IN]
                |
                +--[ACTED_IN]-->(Sci-Fi Film)--[HAS_GENRE]-->(Sci-Fi)

The query follows relationships directly: Tom Hanks β†’ films he appeared in β†’ other actors in those films β†’ their sci-fi films.

Example: Food Delivery Service

For a food delivery app:

β€œFind available drivers who have delivered to this customer’s area before and are near restaurants serving Thai food”

A graph naturally represents:

  • Drivers β†’ DELIVERS_TO β†’ Areas
  • Customers β†’ LIVES_IN β†’ Areas
  • Restaurants β†’ SERVES β†’ Cuisines
  • Restaurants β†’ LOCATED_IN β†’ Areas
  • Drivers β†’ CURRENTLY_NEAR β†’ Areas

Traditional databases struggle with these multi-hop relationship queries. Graph databases handle them elegantlyβ€”which is why companies like Uber, Airbnb, and eBay use graph databases for their core operations.

FabGraph brings these capabilities to Sia, enabling developers to build relationship-aware applications with full data sovereignty.


Background

I have prior experience with graph database challenges. I previously built fabstirdb, a quick implementation covering approximately 80% of GUN’s API for Fabstir’s video streaming software. That experience taught me what’s needed for a production-grade solutionβ€”FabGraph is a fresh implementation built properly from the ground up on Enhanced S5.js.


This POC delivers:

  • Graph data model (nodes, edges, properties as CBOR blobs)
  • Storage layer using Enhanced S5.js with HAMT sharding
  • CRUD operations: createNode(), createEdge(), deleteNode(), updateProperties()
  • Graph traversal (BFS, DFS, n-hop neighbours)
  • Basic path finding
  • JSON Query DSL for LLM-friendly querying
  • Sub-graph encryption with user-controlled keys
  • Integration tests against the S5 network
  • Performance benchmarks
  • API documentation and working examples

Why JSON Query DSL?

LLMs generate structured JSON more reliably than Cypher syntax. The JSON Query DSL provides a clean interface:

{
  "match": { "type": "Person", "name": "Alice" },
  "traverse": { "edge": "KNOWS", "depth": 2 },
  "return": ["name", "email"]
}

A follow-on grant can add a Cypher parser that compiles to this same JSON intermediate representation, giving developers both query options.


Technical Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Developer's Application / LLM Agent     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         FabGraph Library API                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ β€’ graph.createNode()                 β”‚   β”‚
β”‚  β”‚ β€’ graph.createEdge()                 β”‚   β”‚
β”‚  β”‚ β€’ graph.traverse()                   β”‚   β”‚
β”‚  β”‚ β€’ graph.query(jsonDSL)               β”‚   β”‚
β”‚  β”‚ β€’ graph.grantSubGraphAccess()        β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         JSON Query DSL Executor             β”‚
β”‚         Graph Engine Core                   β”‚
β”‚         Caching Layer                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚       Enhanced S5.js (CBOR/HAMT)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What is explicitly deferred to follow-on grant?

  • Cypher query parser (compiles to JSON DSL)
  • Graph algorithms (PageRank, shortest path, clustering)
  • Neo4j/GraphML migration tools
  • Full production hardening

Who benefits from your project?

  • Sia/S5 Developers: Gain graph database capabilities without building from scratch or relying on centralised services
  • Application Builders: Build recommendation engines, social features, knowledge bases, delivery logistics, and more
  • AI/LLM Projects: JSON Query DSL enables AI agents to query decentralised knowledge graphs
  • Privacy-Focused Applications: Client-side encryption ensures data sovereignty
  • The Sia Ecosystem: Completes the decentralised data stack (files β†’ vectors β†’ graphs)

How does the project serve the Foundation’s mission of user-owned data?

FabGraph directly advances user-owned data by enabling:

  1. Relationship Data Sovereignty: Users own their graph data on Sia, not a centralised database provider like Neo4j or Amazon Neptune
  2. Client-Side Encryption: All data encrypted before leaving the user’s device
  3. Sub-Graph Access Control: Users grant granular permissions without exposing entire datasets
  4. No Vendor Lock-in: Open-source library with no licensing fees or proprietary dependencies

Graph databases are essential for knowledge management, social networks, recommendation systems, logistics, and AI applications. Without FabGraph, developers must choose between centralised databases (compromising user ownership) or building custom solutions from scratch (a major hurdle for projects).


Jurisdiction Compliance

Are you a resident of any jurisdiction on that list? No

Will your payment bank account be located in any jurisdiction on that list? No


Grant Specifics

Amount of money requested and justification with a reasonable breakdown of expenses

Total Amount Requested: $24,000 USD

Milestone Description Budget (USD)
Milestone 1 Architecture & Core Storage $8,000
Milestone 2 Traversal & JSON Query DSL $8,000
Milestone 3 Integration Testing, Documentation & Examples $8,000
Total $24,000

Justification:

  • Proven delivery record: Enhanced S5.js completed 25% ahead of schedule, 10.6Γ— under bundle size requirement
  • Prior experience with graph database problem domain (fabstirdb)
  • London-based development costs
  • Senior-level expertise in distributed systems and graph databases

Timeline with measurable objectives and goals

Total Duration: 3 months

Milestone 1: Architecture & Core Storage (Month 1)

Objective: Establish graph data model and storage layer on Enhanced S5.js.

Deliverables:

Task Description Measurable Outcome
1.1 Graph data model design Nodes, edges, properties defined as CBOR schemas
1.2 Storage layer implementation HAMT sharding for scalable node/edge storage
1.3 CRUD API createNode(), createEdge(), deleteNode(), updateProperties() functional
1.4 Sub-graph encryption User-controlled key encryption for graph sections
1.5 Unit tests >90% coverage for all CRUD operations

Milestone Success Criteria:

  • All CRUD operations working against the S5 network
  • Unit tests passing
  • API documentation for core operations

Milestone 2: Traversal & JSON Query DSL (Month 2)

Objective: Implement traversal and query execution.

Deliverables:

Task Description Measurable Outcome
2.1 Graph traversal BFS, DFS, n-hop neighbour queries functional
2.2 Path finding Basic shortest path implementation
2.3 JSON Query DSL Design and executor for structured queries
2.4 Caching layer Client-side cache for frequently accessed nodes
2.5 Unit tests >90% coverage for traversal and query operations

Milestone Success Criteria:

  • All traversal operations functional
  • JSON Query DSL executing successfully
  • Caching layer operational
  • Unit tests passing

Milestone 3: Integration Testing, Documentation & Examples (Month 3)

Objective: Validate production readiness and deliver comprehensive documentation.

Deliverables:

Task Description Measurable Outcome
3.1 Integration tests Full test suite against the S5 network
3.2 Performance benchmarks Documented latency characteristics
3.3 API documentation Complete API reference
3.4 Usage guide Step-by-step developer guide
3.5 Example application Working demo showing graph queries
3.6 NPM package Published and installable package

Milestone Success Criteria:

  • NPM package published and functional
  • Performance benchmarks: cached <100ms, uncached ~800ms
  • 90% test coverage across all modules

  • Zero critical bugs
  • Bundle size <500KB
  • Complete documentation
  • Working example application

Potential risks that will affect the outcome of the project

Risk Mitigation Impact Probability
S5 latency affecting query performance Aggressive caching, proven patterns from vector database work Medium Low
JSON DSL design complexity Follow established patterns (MongoDB query syntax) Low Low
Integration challenges I built Enhanced S5.jsβ€”intimate knowledge of internals Low Very Low

Development Information

Will all of your project’s code be open-source?

Yes, MIT licence.

Links where code will be accessible for review

Links

Previous work:

Have you developed a proof of concept for this idea already?

I have prior experience with graph databases through fabstirdb (built on OrbitDB/IPFS). FabGraph is a fresh implementation designed properly from the ground up for Enhanced S5.js, applying lessons learned from that earlier work.

Do you agree to submit monthly progress reports?

Yes.


Post-Grant Sustainability

FabGraph will be maintained as core open-source infrastructure, ensuring:

  • Ongoing bug fixes and security updates
  • Community contributions via GitHub
  • Guaranteed production usage (Platformless AI integration)

Contact info

Email: jlai [at] fabstir [dot com]

Any other preferred contact methods: Discord @jules_lai


β€œProving graph databases work on decentralised storage”

Submitted by Jules Lai, Fabstir
December 2025

Hi @juleslai - thanks for submitting your proof-of-concept proposal for FabGraph. Everything appears to be order, but I did want to confirm the timeline of 2 months given the workload and the fact that this is a standard grant.

Thanks for the feedback. I’ve revised the timeline to 3 months, which gives proper time for thorough testing and documentation β€” particularly given the holiday period.
Updated timeline:

Milestone 1: Architecture & Core Storage
Milestone 2: Traversal & JSON Query DSL
Milestone 3: Integration Testing, Documentation & Examples

I’ve updated the proposal above with the revised milestones.

1 Like

Hi @juleslai - sounds good. This will be presented to the Committee next Tuesday.

1 Like