api
Technical notes on web development, DevOps, and AI integration.
16 articles
- 17:27backend
Not Just SQL: When API Fan-out Kills Your Monitor
Fixing an N+1 API fan-out in commitcheck: one pagination pass replaces 250 requests, SSL timeout gone, runtime down to 27.5s.
TL;DR: The monitor hung for over 100 seconds because each candidate triggered full pagination, creating roughly 250 requests per run. Replacing per-candidate checks with a single paginated fetch into a commit-to-slug map removed the N+1 overhead. Runtime dropped to 27.5 seconds with only a few requests and no change to the API contract.
#pagination#performance#api - 02:34backend
Semantic Search on a 1GB VPS Without a Vector DB
Pure-Python cosine, vectors in MariaDB postmeta, embeddings computed locally. Semantic features with no new service on a small server.
TL;DR: Running a blog on a 1GB VPS rules out a vector database, so the author computes bge-m3 embeddings locally via Ollama and stores them as JSON in MariaDB postmeta. Related-article matching and dup-checks use pure-Python cosine similarity, fast enough for around 100 articles. Lesson: for small blogs, skip Qdrant or pgvector until scale demands it.
#python#fastapi#embedding - 00:45tooling
A Failure-Proof Research Script: Two-Provider API Key Rotation
Two-layer API key rotation, provider fallback, and DoH for lying ISP DNS: lessons from building a research script that refuses to die quietly.
TL;DR: Firecrawl's keyless search endpoint died with permanent 403s mid-research, so the author pivoted to keyed APIs. The result is web-direct.py, 125 lines doing search, scrape, and extract with two-layer rotation: next key first, then next provider. A DoH health check catches lying ISP DNS, falling back to curl --resolve.
#automation#tooling#rest-api - 21:51ai
What a Security Audit Found in My Chat AI
A security audit uncovered 11 findings in the chat AI pipeline, from cache keys to prompt injection.
#prompt-injection#redis#fastapi - 20:07ai
The follow-up question my AI chat couldn't answer
Chat follow-up questions without server sessions: history lives in localStorage, gets resent per ask, and the backend rebuilds the prompt under a char budget.
#fastapi#llm#stateless - 19:34ai
The AI chat now knows what I am working on
The blog's AI chat now answers 'what are you working on' from local commit history: a narrow port, a version namespace bump, and term mining.
#fastapi#redis#cache-invalidation - 14:57backend
Answers That Survive an LLM Outage
When the LLM router died, a meta fallback event arrived and the visitor still got an answer. Here's the three-part chain behind it.
#fastapi#redis#llm - 14:34backend
The AI Search Had to Learn Its Own Site
Typing hai used to kill the AI search with no_results. The culprit was MariaDB's fulltext word-length floor, not a broken prompt.
#fastapi#mariadb#llm - 12:28ai
Asking AI on My Blog: SSE Streaming Through Plain fetch
EventSource can't POST. The blog's Ask AI answers run through a plain fetch, a hand-rolled SSE parser, and one CRLF trap worth remembering.
#sse#fastapi#nextjs