The Technology Behind CitizenX: Building a Decentralized Web Annotation Platform

April 29, 2025

Introduction: A Decentralized Approach to Web Annotation

In our blog post Discover Citizen X - A Decentralied App to Annotate the Internet, we introduced CitizenX—a Chrome extension that empowers users to annotate webpages, engage in threaded discussions, and build a collaborative knowledge layer on the internet. While that post focused on the user experience, today we’re diving into the technology that powers CitizenX. If you’re a developer, tech enthusiast, or someone passionate about decentralized applications (dApps), this post is for you.

CitizenX is more than just a tool for web annotation; it’s a proof-of-concept for how decentralized technologies can transform collaborative tools. By leveraging Gun for distributed storage and peer-to-peer data management, we’ve created a platform that’s serverless, secure, and resilient. Curious to see it in action? You can check out our project deliverables on GitHub at https://github.com/Waltika/CitizenX and even try it out in Chrome’s developer mode before its official release on the Chrome Web Store. Let’s explore the tech behind CitizenX and what makes it a game-changer for decentralized web annotation.

The Core Technology Stack

CitizenX is built with a modern, robust tech stack designed to balance performance, scalability, and decentralization. Here’s a breakdown of the key components:

React and TypeScript for the Frontend

The CitizenX Chrome extension is developed using React and TypeScript, ensuring a modular, type-safe, and maintainable codebase. React powers the dynamic UI, allowing users to seamlessly interact with annotations, threaded comments, and profile settings. TypeScript adds an extra layer of reliability by catching errors during development, which is crucial for a project that will eventually scale to a global user base. The UI components, like the annotation input and settings menu, are designed to be minimal and non-intrusive, aligning with Chrome Manifest V3 requirements for a good user experience.

Gun for Distributed Storage

At the heart of CitizenX’s decentralization is Gun, a peer-to-peer protocol for storing and sharing data in a distributed file system. All annotations, comments, and user profiles are stored on IPFS, eliminating the need for a centralized server. This ensures that data is resilient—there’s no single point of failure—and users can access their contributions even if they switch devices or clear their browser data. IPFS also aligns with our non-functional requirement of zero installation beyond the Chrome extension, as it operates entirely within the browser environment.

Gun for Peer-to-Peer Collaboration

To manage the collaborative aspects of CitizenX, we use Gun, a serverless, distributed, peer-to-peer database built on top of IPFS. Gun handles the storage and synchronization of annotations and comments across users. When you annotate a webpage, Gun ensures that your annotation is replicated to other users who have visited that page, creating a seamless collaborative experience. In future versions, we plan to optimize Gun replication so users only sync data for pages they’ve visited or annotated, reducing resource usage and improving scalability.

Decentralized Authentication

CitizenX implements decentralized authentication to ensure user identities are secure and portable. Instead of relying on a centralized server for user management, we use cryptographic techniques to create unique, device-agnostic identities. This means your profile—complete with a handle and profile picture—remains consistent across devices, even if you clear your browser data or lose your device. We’ve also taken steps to secure JWT tokens and other access mechanisms against hacking, aligning with our non-functional requirements for security.

Vite for Bundling

To comply with Chrome Web Store policies and optimize performance, we use Vite for bundling our code. Vite’s tree-shaking and fast build times help us keep the extension bundle size under 100 MB (compressed), ensuring a lightweight footprint. All code is bundled locally, avoiding external fetches that could violate Chrome’s Content Security Policy (CSP) requirements under Manifest V3.

Decentralized Design: Why It Matters

The decision to build CitizenX as a decentralized application (dApp) wasn’t just a technical choice—it’s a philosophical one. Centralized systems often come with trade-offs: single points of failure, data silos, and privacy concerns. By contrast, a decentralized approach offers several benefits that align with our vision for CitizenX:

  • Data Resilience: With IPFS, data is distributed across a network of nodes. If one node goes offline, your annotations and comments are still accessible via other nodes. This ensures zero loss of data in case of network issues or failures, a key non-functional requirement for v1.0.
  • Privacy and Control: Users own their data. There’s no central server that can be hacked or misused to track user activity. Your annotations, comments, and profile are yours alone, stored securely on IPFS.
  • Serverless Architecture: By eliminating the need for a centralized server, CitizenX reduces operational costs and complexity. It also means we can focus on building features rather than maintaining infrastructure, which is especially important for a community-driven project.
  • Collaborative Power: Gun enables peer-to-peer collaboration without intermediaries. When someone annotates a page you’ve visited, or comments on your annotation, Gun ensures you’re notified in real-time—without relying on a central server to push updates.

This decentralized design makes CitizenX a robust platform for web annotation, setting the stage for future features like AI-powered structured data extraction and crypto-based incentives.

Aligning with Chrome Manifest V3

Building a Chrome extension in 2025 means adhering to Chrome Manifest V3 requirements, which prioritize security, performance, and user experience. Here’s how CitizenX meets these standards:

  • Service Worker Lifecycle: We use background.service_worker instead of persistent background pages, adapting to the stateless nature of service workers. State persistence is handled via chrome.storage, ensuring the extension remains responsive even after the service worker terminates (typically after 30 seconds or up to 5 minutes for certain APIs).
  • Content Security Policy (CSP): We’ve defined a strict CSP in manifest.json (script-src 'self'; object-src 'self'), prohibiting inline scripts and external code fetching. This enhances security and ensures compliance with Chrome Web Store policies.
  • Action API: Toolbar interactions are implemented using the action API, replacing deprecated browserAction and pageAction APIs. This ensures a seamless user experience when interacting with the extension.
  • Minimized Permissions: We’ve minimized permissions to reduce user friction, using specific host_permissions where possible and planning to implement optional_host_permissions for on-demand domain access in future versions.

These measures not only ensure compliance but also make CitizenX a secure and performant tool for users and developers alike.

Try CitizenX Today via GitHub

While we’re preparing CitizenX for its official release on the Chrome Web Store, tech enthusiasts and developers can already give it a try! Our project deliverables are available on GitHub at https://github.com/Waltika/CitizenX. Here’s how you can get started:

  1. Clone the repository: git clone https://github.com/Waltika/CitizenX.git.
  2. Install dependencies: npm install.
  3. Build the extension: npm run build.
  4. Open Chrome in developer mode, go to chrome://extensions/, and load the built extension from the dist/ folder.

This early access lets you explore the decentralized web annotation experience before the official launch. We’d love to hear your feedback—feel free to open an issue on GitHub or contribute to the project!

The Future of CitizenX: A Technical Roadmap

CitizenX v1.0 is just the beginning. Our requirements for future versions include exciting technical advancements:

  • Crypto-Based Incentives: We plan to introduce a crypto/ledger-based ownership structure and a payment system for contributors and users, leveraging blockchain technology to incentivize participation.
  • Optimized Data Replication: We’ll restructure Gun to ensure users only replicate annotations for pages they’ve visited or annotated, improving performance and scalability.
  • AI-Powered Features: Future versions will include AI-powered structured data extraction from annotations and comments, stored in a JSON format for community sharing and voting.
  • Pinning Service: We’ll develop a distributed pinning service for IPFS, incentivizing users to pin data in a crypto-based way, ensuring long-term data availability.

These advancements will make CitizenX a leader in decentralized collaborative tools, blending cutting-edge technology with community-driven innovation.

Join the Decentralized Revolution

CitizenX is more than a Chrome extension—it’s a vision for a decentralized, collaborative web. By building on IPFS and Gun, we’re creating a platform that’s resilient, privacy-focused, and scalable. Whether you’re a developer interested in dApps, a tech enthusiast passionate about distributed systems, or a user looking for better collaborative tools, CitizenX has something for you.

Explore the project on GitHub at https://github.com/Waltika/CitizenX, try it out in developer mode, and join us in shaping the future of web annotation. Stay tuned for more updates as we approach our Chrome Web Store release, and let’s build a smarter, more connected internet together.

Install Extension
Citizen X
Subscribe to get News and Upcoming features!