Most social feeds optimize for outrage and endless scrolling. I wanted to build the opposite: a calm, bilingual (EN/ES) space where people share pure thoughts, cross ideas semantically with other thinkers like neurons, and synthesize perspectives with AI—without addictive algorithms.

That became Think it (Live App · MIT GitHub Repo).

Rather than just shipping prompts in a wrapper, I focused on the system design, database isolation, and cloud/local AI parity behind it.

1. 3-Layer Decoupled Architecture

[React 19 + TypeScript + Tailwind v4 PWA (Vercel)]
│ HTTPS + JWT + FormData
▼
[Async FastAPI + SQLAlchemy (Render)]
├── /api/auth -> JWT, bcrypt, server-enforced is_demo blocks
├── /api/thoughts -> Feeds, private Daily Think, pgvector HNSW RAG
├── /api/interactions -> Sparks, Bounces, Neurons, Follows
└── /api/messages -> 1-on-1 DMs with privacy enforcement
│
┌─────────────┴─────────────┐
▼ ▼
[Groq / QLoRA Qwen .gguf] [Supabase PostgreSQL 16 + pgvector]



  1. Hard-Won Production Lessons

Async SQLAlchemy + PgBouncer (statement_cache_size=0)

Deploying async FastAPI (asyncpg) behind managed PostgreSQL transaction pooling (PgBouncer) immediately breaks prepared statements unless statement_cache_size=0 is explicitly configured in the async engine connect args. Catching and enforcing that early keeps pooled serverless connections stable under load.

Dual Cloud / Local AI Parity (THINKIT_AI_PROVIDER)

During development, I fine-tuned Qwen 2.5 7B via QLoRA (Unsloth) and quantized it to q4_k_m.gguf running locally in Ollama for 5 synthesis lenses (Perspective Spark, Critical Contrast, Micro-Steps, Synthesis Quote, Open Question). For zero-GPU cloud production, a single environment switch routes the exact same lens prompts through Groq—while semantic crossing uses pgvector HNSW cosine similarity over 384d embeddings.

Server-Enforced Demo Isolation & Rate Limiting

Interactive demo accounts (is_demo) let visitors test the live app safely without polluting real users' DMs or mutating restricted account settings—all blocked server-side in FastAPI dependencies alongside sliding-window rate limiting.

Packaging Reproducible Rules in SKILL.md

To avoid losing architectural context between iterations, I documented the deployment topology, pooler constraints, test gates (pytest, tsc --noEmit, oxlint, ruff), and launch policies in .skills/thinkit-lifecycle/SKILL.md.

Try It & Inspect the Code

Would love feedback from fellow Python, FastAPI, and React engineers on the architecture trade-offs!