Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

betodealmeida/sqlite-blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Hub

An offline-first social hub that aggregates content from multiple protocols (RSS, email, h-feed) and allows you to interact with them.

Features

  • Offline-first: Uses SQLite in both backend and frontend with bidirectional sync
  • CRDT sync: Conflict-free replicated data types using Hybrid Logical Clocks
  • Real-time updates: WebSocket-based synchronization
  • PWA support: Install as a progressive web app for offline access
  • Multiple protocols: Designed to support RSS, Atom, email, h-feed, and more

Architecture

  • Backend: Litestar (Python) with SQLite
  • Frontend: Vanilla JS with SQL.js (SQLite in WASM)
  • Sync: CRDT-based bidirectional replication over WebSockets
  • Data model: Authors, Messages, and Contacts with flexible JSON content

Getting Started

1. Install dependencies

pip install -e .

2. Seed the database

python -m backend.seed_data

3. Run the server

uvicorn backend.app:app --reload

4. Open the app

Navigate to http://localhost:8000

How it works

CRDT Sync

The app uses Hybrid Logical Clocks (HLC) for causality tracking and last-write-wins conflict resolution. Each record has:

  • hlc_timestamp: Combined physical and logical clock for ordering
  • node_id: Identifies which client/server made the change
  • deleted_at: Soft delete timestamp for CRDT tombstones

Data Flow

  1. Frontend maintains a local SQLite database in the browser (via SQL.js)
  2. WebSocket connection syncs changes bidirectionally
  3. Both client and server apply changes using CRDT logic
  4. Data persists in IndexedDB for offline access
  5. When online, changes sync automatically

Next Steps

  • Implement RSS/Atom feed reading
  • Add email integration
  • Support h-feed and microformats
  • Implement like and reply actions
  • Add webmention sending
  • Multi-contact reply selection
  • Search and filtering
  • Service worker for true offline support

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published