How mikepred/siftly works
Purpose and current shape
Siftly is currently a local, single-user bookmark organizer focused on Twitter/X bookmarks: import, parse, categorize with AI, search, visualize as a mindmap, and export. The README’s federated multi-tenant graph architecture is a roadmap, not the implemented default. Current legacy mode runs a Next.js app with Prisma-backed SQLite.
Entry points and runtime
• Web application: Next.js App Router, rooted at app/layout.tsx and app/page.tsx; user surfaces include app/import/page.tsx, app/bookmarks/page.tsx, and app/mindmap/page.tsx.
• Server API: route handlers under app/api/**, called by the UI and integrations.
• Direct local CLI: cli/siftly.ts, for operations such as stats and category inspection.
• Deployment/dev bootstrap: start.sh; container runtime assets are docker/Dockerfile and docker/docker-compose.yml.
Persistence and bookmark domain
Prisma defines the authoritative local data model and migrations in prisma/schema.prisma and prisma/migrations/. Database access is centralized in lib/db.ts. The implemented architecture is SQLite-oriented (DATABASE_URL); bookmark records, categories, source metadata, and related stored content are the core application boundary. Planned Postgres, tenancy, graph versioning, and vector storage are not represented by dedicated implementation paths in this tree.
Ingestion pipeline
Import routes normalize several source forms into the bookmark store:
• General and bookmarklet imports: app/api/import/route.ts, app/api/import/bookmarklet/route.ts
• Twitter/X import and live sync: app/api/import/twitter/route.ts, app/api/import/live/sync/route.ts
• X OAuth lifecycle/fetch: app/api/import/x-oauth/authorize/route.ts, app/api/import/x-oauth/fetch/route.ts
Parsing and source extraction live behind lib/parser.ts, lib/rawjson-extractor.ts, lib/twitter-api.ts, and lib/x-sync.ts. This is a key external-service boundary: X APIs/OAuth credentials are isolated from UI routes and persistence logic.
AI enrichment and settings
Categorization and image understanding are server-side enrichment stages exposed through app/api/categorize/route.ts and app/api/analyze/images/route.ts. Core logic is in lib/categorizer.ts, lib/category-suggester.ts, and lib/vision-analyzer.ts. Provider/client support currently includes lib/ai-client.ts, Claude CLI/auth modules, OpenAI auth, and MiniMax-related code implied by the test suite; settings endpoints (app/api/settings/route.ts, app/api/settings/test/route.ts) manage and validate provider configuration. Heavy work currently appears request-driven; workers/queues are future architecture.
Discovery, graph views, and presentation
Keyword/full-text search is implemented through lib/fts.ts and lib/search-utils.ts, exposed at app/api/search/route.ts; AI search has a separate endpoint at app/api/search/ai/route.ts. Category browsing and assignment flow through app/api/categories/route.ts and app/api/bookmarks/[id]/categories/route.ts. The mindmap endpoint app/api/mindmap/route.ts supplies visualization data rendered by components/mindmap/mindmap-canvas.tsx and node components. This is presently a derived bookmark/category visualization, rather than a general persisted graph-edge model.
Egress and integration boundaries
Exports are generated by lib/exporter.ts and lib/obsidian-exporter.ts, served via app/api/export/route.ts and app/api/export/obsidian/route.ts. Link preview and media retrieval are separate API boundaries at app/api/link-preview/route.ts and app/api/media/route.ts, limiting external content fetching to server handlers. No implemented federation, collaboration, vector database, Redis, WebSocket/SSE worker progress, or plugin system is evident in the current tree.
Main entry points: db.ts Database access · route.ts Import routes · categorizer.ts AI categorization & vision · page.tsx User pages
Components 17
Next.js application
- User pages · Import, bookmarks, and mindmap surfaces.
app/page.tsx - Server API routes · UI-facing application boundary.
- Local CLI
cli/siftly.ts - Dev/container bootstrap
start.sh - Mindmap view · Renders bookmark and category relationships.
components/mindmap/mindmap-canvas.tsx - Export services · Produces standard and Obsidian exports.
lib/exporter.ts
Ingestion
- Import routes · Accept general, bookmarklet, Twitter/X, and live-sync imports.
app/api/import/route.ts - Source parsing & X sync · Normalizes source data and isolates X API access.
lib/parser.ts
Enrichment & discovery
- Categorize & image APIs
app/api/categorize/route.ts - AI categorization & vision · Request-driven provider-backed analysis.
lib/categorizer.ts - Search services
lib/fts.ts
Local persistence
- Prisma data model · Authoritative bookmark, category, and source model.
prisma/schema.prisma - SQLite bookmark store · Stores bookmarks, categories, metadata, and content.
- Database access
lib/db.ts
External boundaries
- X APIs & OAuth
- AI providers
- Link & media handlers · Keeps external content retrieval server-side.
app/api/link-preview/route.ts
Connections 21
- User pages → Server API routes: calls
- Local CLI → Database access: inspects
- Dev/container bootstrap → User pages: runs
- Server API routes → Import routes: routes imports
- Import routes → Source parsing & X sync: normalizes through
- Source parsing & X sync → X APIs & OAuth: OAuth and fetch
- Import routes → Database access: stores bookmarks
- Server API routes → Categorize & image APIs: routes analysis
- Categorize & image APIs → AI categorization & vision: enriches with
- AI categorization & vision → AI providers: uses
- AI categorization & vision → Database access: writes categories
- Server API routes → Search services: serves search
- Search services → Database access: queries
- Server API routes → Mindmap view: supplies data to
- Mindmap view → Database access: derives from
- Server API routes → Export services: serves exports
- Export services → Database access: reads
- Server API routes → Link & media handlers: routes fetches
- Database access → Prisma data model: uses model
- Database access → SQLite bookmark store: connects
- Prisma data model → SQLite bookmark store: defines schema