Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Synapse — Your Second Brain for the Internet

Capture anything, from anywhere — instantly.

Synapse is a universal capture system that allows users to save text, images, videos, or links directly from any webpage using a Chrome extension or through the web app. Each saved item is automatically processed, embedded, and made searchable using AI and vector-based retrieval.


🚀 Architecture Overview

🧩 How It Works

User → Extension / Web App → Backend (Node.js + TypeScript)
          │
          ▼
   PostgreSQL (Dockerized)
   Redis Queue (Dockerized)
   Qdrant Vector DB (Dockerized)
          │
          ▼
   BullMQ Worker → Gemini AI → Vector DB (Embeddings)
          │
          ▼
         Search Layer → Gemini → Vector Search → User Results

🔹 Flow Explanation

  1. User Capture:

    • Data can be captured using the browser extension or directly uploaded via the web app.
  2. Backend Ingestion (Fast Response):

    • When data reaches the backend, it’s immediately stored in PostgreSQL (Dockerized) as-is.
    • The record’s ID is added to a Redis queue (embedding-processing).
    • The user instantly gets a response confirming that the data is saved.
  3. Asynchronous Processing:

    • BullMQ workers pick jobs from Redis.
    • For each ID, data is fetched from PostgreSQL.
    • Sent to Gemini for content extraction & summarization.
    • Resulting processed data is embedded and stored in the Vector DB (Qdrant).
  4. Search Query Flow:

    • User’s query → converted to embeddings via Gemini.
    • Embedding search happens in the Vector DB.
    • Top results are retrieved from PostgreSQL and returned to the user.
    • This enables semantic search and instant retrieval.
  5. Fast + Reliable:

    • Users never wait for background AI jobs.
    • Embeddings, AI analysis, and enrichment happen asynchronously.

🧱 Tech Stack

Layer Technology Description
Frontend Next.js, React, TailwindCSS, shadcn/ui Web app interface for exploring saved data
Browser Extension Chrome Manifest V3 Enables one-click saving of text, links, videos, or images
Backend Node.js (TypeScript), Express / Next API Handles ingestion, queueing, and embedding processing
Database PostgreSQL (Dockerized) + Prisma ORM Main structured data store
Vector DB Qdrant (Dockerized) Embedding-based semantic search
Queue System Redis (Dockerized) + BullMQ Async embedding and data extraction tasks
AI Model Gemini For extraction, summarization, and embedding generation
Containerization Docker Containers for Postgres, Redis, and Qdrant

⚙️ Project Structure

root/
├── backend/                 # Node.js + TypeScript backend
│   ├── src/
│   │   ├── routes/             # Content routes (/api/content, /upload-image)
│   │   ├── workers/         # BullMQ workers for embedding + extraction
│   │   ├── queue/           # Redis queue setup
│   │   └── lib/             # Prisma and redis client and schema
│   │   └── services/        # Embedding and Gemini Services
│   │   └── types/           # Types
│   │   └── DB/              # DB
│   └── package.json
│
├── frontend/                # Next.js + React web app
│   ├── components/
│   ├── pages/
│   ├── Services/
│   ├── types/
│   └── package.json
│
└── extension/               # Chrome extension (Manifest V3)
    ├── manifest.json
    ├── background.js
    ├── content.js
    └── icons/

💻 Installation & Setup

🧠 Backend

cd backend
npm install
npm run dev

🌐 Frontend

cd frontend
npm install
npm run dev

🐳 Using Docker

Docker is used to run the Qdrant containers.

docker-compose up -d

This ensures all required services are available locally without manual setup.

🧩 Chrome Extension Setup

  1. Go to chrome://extensions
  2. Enable Developer Mode
  3. Click Load unpacked
  4. Select the extension folder
  5. Now right-click any text, image, video, or link on any webpage → “Save to Synapse

📦 Features

Category Feature Description
🔗 Universal Capture Right-click to save any text, link, image, or video Works instantly across all sites
⚡ Async Processing Embedding handled in background User never waits
🧠 AI Enrichment Uses Gemini for semantic understanding Extracts meaning + summary
🔍 Semantic Search Vector-based retrieval “Find that quote about tokenization”
🪄 Visual Dashboard Content displayed as cards (article, image, video) Beautiful, type-aware UI
🖼️ Image Upload Upload via extension Saved to /api/content/upload-image
📄 Text + Video URL Upload Saved via /api/content Unified backend ingestion

🔍 Search Flow

  1. User query → sent to backend.
  2. Gemini converts it to embedding.
  3. Vector DB performs nearest-neighbor search.
  4. Matching records retrieved from Postgres.
  5. UI displays them as formatted cards.

This enables searching by meaning, not just keywords.

Example:

"Show me AI papers I saved last week" "Find that quote about minimalism" "Black sneakers under $200"


🧠 Example Backend Flow

User → POST /api/content
│
├── Store in PostgreSQL (status = pending)
├── Add ID to Redis queue (embedding-processing)
│
├── BullMQ Worker → Fetch data → Send to Gemini
│                 → Get extracted summary + embeddings
│                 → Store embeddings in Qdrant
│                 → Update record status = embedded
│
└── ✅ Instant response to user: “Saved Successfully”

📦 Example Payloads

Text / Video / Link

{
  "title": "Understanding Transformers",
  "content": "Transformers use attention mechanisms...",
  "type": "text",
  "sourceUrl": "https://karpathy.ai/transformers",
  "metaTags": ["chrome-extension", "text-selection"]
}

Image Upload (FormData)

image: <Blob>
title: "Design Inspiration"
type: "image"
sourceUrl: "https://dribbble.com/..."
metaTags: ["chrome-extension", "image"]

🧭 Summary

Synapse is a fast, intelligent, and beautiful knowledge capture platform that bridges bookmarking, note-taking, and AI-assisted retrieval. By combining Dockerized Postgres (structure) + Qdrant (semantics) + Gemini (AI) + BullMQ (async), it delivers:

✅ Instant capture ✅ Reliable async processing ✅ AI-powered semantic search ✅ Visual exploration of saved knowledge


📅 Future Roadmap

Phase Feature Description
1. MVP Universal capture (done) Browser + web upload
2. AI Summaries Auto summary on save Gemini summarization
3. Semantic Filtering Time, type, meaning filters Natural queries
4. Collaboration Share collections Workspaces
5. Personal AI Chat Chat with your saved data RAG over embeddings

Developed by: Anuj 🧑‍💻 Node.js (TS) · Next.js · Prisma · BullMQ · Redis · Gemini · Qdrant · Docker

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages