Infrai Developer Guides
Production tutorials, troubleshooting guides, comparisons, and reference architectures for Infrai APIs.
account
- An API key leaked into a public repo: the first five minutes
- Building an internal spend dashboard from a usage timeseries
- Excluding vendors from a capability, and testing the chain first
- Attributing API spend to each tenant and charging it back
- Auto-recharge that can't become an unbounded card charge
- Checking the tier and limits a route needs before you call it
- Registering a webhook and verifying its signature properly
- Separating dev, staging and production with scoped API keys
- Rotating an API key with no downtime and no failed requests
- Capping spend so a runaway agent loop can't drain the account
- What happens when the balance hits zero, and seeing it coming
- Webhook deliveries are failing: how to inspect and retry them
ai
- Cheaper than GPT-4 for summarise, classify and extract: five levers
- Batch product-image generation in Node: bulk prompts, pooled image calls
- Evaluating a cheap LLM API gateway: catalogue, telemetry, cache, routing
- A low-cost chatbot backend: what one support turn actually costs
- Tagging support tickets without fine-tuning: zero-shot, rerank or embeddings
- Reranking 50 search candidates: request, response and mapping back
- Backfilling moderation over posts you already have: a Node bulk job
- Cheap semantic search over your docs: embeddings and rerank, priced properly
- Posters and social ads from an image API: resolution, style control, upscale
- Forecast a feature's monthly LLM bill before you ship it
- Cheap RAG in Node: cost the chunks, the index and the answer separately
- Cheap text summarization: per-1K-token rates versus cost per document
analytics
- Admin analytics for a Node SaaS: metrics counter, log search, or an event query?
- A Mixpanel alternative for business metrics: events vs a custom metrics API
- Querying funnels and retention without a BI stack
- A PostHog alternative when all you want is an events API
- Sending product events from your backend instead of the browser
- Stitching anonymous activity to a user once they sign up
auth
- Email OTP login for a Node API, without Auth0 or Clerk
- Add Google and GitHub sign-in without writing the OAuth callback
- Changing a user's email address without losing the account
- Clerk vs Auth0 vs a gateway auth API for a small team
- Handling a deletion request: the four calls and the right order
- Storing user profile fields without your own users table
- Handling AUTH_RATE_LIMIT without locking real users out
- One user, three login methods, no duplicate accounts
- A password reset flow with safe expiry, in three API calls
- Phone verification at signup with SMS OTP, in two calls
- Issue, verify and refresh JWT sessions with a hosted auth API
- Recording and checking per-user consent from your backend
captcha
cron
- Cheapest cron for nightly data cleanup: Actions, Workers or EventBridge?
- A nightly cleanup job for an Express app: which scheduler, which cron expression
- One POST for a daily 8am Eastern webhook: the parameters that matter
- Give each transcode to exactly one homelab box, and reclaim it if that box dies
- A morning webhook for your backup job, without a VPS to patch
- Fire a cron job on demand to test the webhook chain before 3am
- Reminder cron fired at the wrong hour: timezone, missed runs, no backfill
- Daily reminder fan-out: cron plans, the queue paces, the sender batches
- Overlapping cron runs: what skip, allow and queue actually do
- Why your daily email cron should enqueue jobs, not send them inline
db
- Reconciling forgotten database branches against open pull requests
- A Postgres branch per pull request, created through an API
- Production-shaped data in a preview branch, without the personal data
- An internal admin view of projects, branches and snapshots
- Neon vs Supabase vs a gateway DB API for preview environments
- Provisioning one Postgres database per tenant, programmatically
- Snapshot before a risky migration, restore if it goes wrong
- Rolling back a bad deploy without losing the writes since
- What a database branch actually is, and when to delete it
- What a database branch per preview environment really costs
dns
- Auditing every DNS record you manage across customer domains
- Creating and updating DNS records from your own backend
- Domain verification keeps failing: what the check looks at
- Custom domains for your SaaS, added and verified by API
- One onboarding flow for a custom domain and its email sending
- Publishing SPF, DKIM and DMARC for a sending domain, by API
- TXT or CNAME for custom domain verification, and when each breaks
- Removing a churned customer's domain and everything it left
- Upsert a DNS record instead of creating a duplicate
- Wildcard and apex records for per-tenant subdomains
- Campaign-lite onboarding: reusable templates plus a batch send
- Cheapest transactional email API for SaaS welcome emails (Node 22)
- Bounce and complaint handling without webhooks: poll the event feed
- The best template approach for password-reset email in Node 22
- Choosing a transactional email API: an eight-check acceptance test
- Picking a password-reset email API: retries, DKIM, US and EU
- Transactional email over HTTPS, not an SMTP relay, for a Node SaaS
- A SaaS welcome-email integration: four decisions, with defaults
- Rotating DKIM keys from Node 22: one API call, one DNS cutover
- SaaS alert emails: give them their own sending subdomain
- Welcome email deliverability checklist for SaaS, run as code
- Bulk welcome mail after a user import: chunking, pacing and retries
errors
- Cron jobs, workers and the failures that never throw an exception
- Poll-based error alerting for Node: cron, Slack and a watermark
- Error tracking for a small Node SaaS: capture exceptions without an SDK
- A simple SaaS reliability dashboard in Node, built from the errors API
- Errors, logs and metrics: the minimum failure-alert stack that works
- API-only error monitoring: no session replay, no tracing, no agent
- Tracking failed health checks in Node: timeouts, ECONNREFUSED and DNS
- Grouping, fingerprints, releases: error tracking terms explained
- Slack now, email at 08:00: routing alerts from one error poller
- Alerting on repeats in Express: count deltas and resolve as your ack
- Feature flag toggles, retries and duplicate writes: making rollouts idempotent
- Choosing an error tracker for an Express API in Europe: seven questions
flags
- Debugging 400s on a feature flag API: set, toggle and rollout payloads
- Feature flag kill switch for incident response: the one call to go dark
- Feature flag 404s after a delete and recreate: what actually breaks
- A LaunchDarkly alternative that is just a REST flag store
- Percentage rollouts and user targeting in Express with a REST flag API
- Flag stats, custom metrics or events: measuring a rollout from the backend
image
- Where AI-generated images should live, and how to expire the link
- Can an upload signature enforce avatar size and file type limits?
- Short-video UGC: an ingest and moderation pipeline that holds at 200 MB
- ID scans and signed contracts: authorize the request, not the URL
- Reusable transformation presets instead of repeating parameters
- Removing the background from product photos by API
- Resizing and converting user uploads the moment they arrive
- Running an image batch job and handling the items that fail
- Smart cropping one upload into every aspect ratio you need
- Watermarking a whole product catalogue in one submission
- What a hundred thousand image transformations a month costs
- Stripping EXIF and location from uploads while keeping orientation
logs
- Hosted log API, Datadog, or self-hosted ELK: which to start with
- Cheap centralized logging for a small SaaS on Node, Docker and cron
- Error tracking vs logging in a Node SaaS: which one to call, when
- Pino and Winston to an HTTP log ingest API, with request and user ids
- Six Fly.io apps, one log tail: a lightweight alternative to ELK
- Which API for centralized log ingest and search in a startup dashboard
metrics
- Logging vs error tracking vs metrics: which one a small SaaS needs first
- One metrics schema for cron runs, API failures and business events
- Cheap failure alerts for a Node/Express API: counters instead of log search
- Metrics-based failure alerting for a SaaS API: rule shapes that don't flap
- Rollout KPI dashboards on a budget: metrics API vs Statsig and PostHog
- Auto-rollback a bad release in Node: error-rate check, then flip the flag
- Charts for a SaaS admin page: metrics API or log search?
- Can a coding agent wire up observability in one pass? Installs vs REST
- A daily cron that queries your metrics and emails a one-page summary
- Cron heartbeat and missed-run detection for Next.js jobs, without a ping service
- Build an internal uptime page in Node from a 0/1 gauge and two API calls
- Readiness, liveness and startup probes for a Node service on Kubernetes
- What multi-GB instructor uploads need beyond a single HTTP request
- Your backend minted a presigned URL and the browser still gets 403
- Filling a PDF form from JSON and returning a completed file
- HTML to PDF without running Chromium or Gotenberg yourself
- Generating invoices from a template, idempotently
- Long PDF jobs: polling, timeouts and retries without duplicates
- OCR a scanned PDF and get the text out, page by page
- Merging, splitting and rotating PDFs in one chained pipeline
- Password-protecting a generated PDF, and opening it later
- Signing a PDF with your own certificate, and verifying one
- Redacting a PDF properly before you send it outside
- PDF generation cost per document against self-hosting Gotenberg
queue
- Duplicate jobs in an at-least-once queue: the idempotency key that fixes it
- Delayed retries beyond 7 days: chaining hops on a job queue
- Cleanup jobs that retry themselves: Node queue, DLQ, redrive
- Message too large and JSON that won't parse: fixing malformed queue payloads
- Background jobs in Node: create a queue, run a worker, ack and nack
- Job keeps coming back? Three causes of endless queue retries
- Exponential backoff for failed jobs when redelivery is a flat retry budget
- Cron or a job queue? Picking one for file, email and webhook work
- Your push subscriber is returning 429: what the queue does next
- Long-running jobs and the 15-minute wall: checkpoint instead of extending
- Batch enqueue in Node: 100 jobs per publish call, then a paced worker
- DLQ redrive or a Postgres retry table: which one is cheaper to run
realtime
- Authorizing private channels so tenants can't read each other
- A live ops dashboard that updates without polling
- Cutting off an abusive client from a channel immediately
- Finding and deleting realtime channels nothing uses any more
- Short-lived realtime tokens, and revoking one immediately
- Pushing updates to a browser from a background worker over REST
- Publishing thousands of realtime updates without tripping limits
- What realtime messaging costs at a million messages a month
- Showing who's online without your own heartbeat table
- A Pusher alternative when you only need a REST publish endpoint
rtc
- Adding audio and video calling without a media server to run
- A moderator view that lists who is in the room
- Creating and tearing down video rooms for one-to-one calls
- Minting a video room token on the server for a browser client
- LiveKit vs Agora vs a gateway RTC API for support calls
- Removing someone from a call so they can't rejoin
- Stop paying for idle video rooms: lifecycle and cleanup
- Designing RTC token TTL and permissions for a leaked token
sms
- Choosing a 2FA SMS provider: sender registration sets your date
- Phone OTP as a service: what send-plus-verify actually takes off you
- 2FA SMS API with resend and cancel: a Node 22 login controller
- A beginner's 2FA login stack: OTP, suppression preflight, polling
- SMS-primary 2FA with an email fallback: the beginner architecture
- The cheapest event-notification API depends on your channel mix
- SMS 2FA in Express: switch lanes when the code never arrives
- The simplest SMS OTP API for SaaS login: two calls, one key
- Picking an SMS alerts API when you refuse to run a webhook endpoint
- Picking an SMS alerts provider for reminders, shipping and logins
- Email or SMS for SaaS alerts: what a delivered notification costs
- Cheap SMS alerts for a startup: the unit, the sender, the receipt
storage
- 429s in an image pipeline: retry the upload, never the render
- Trigger transcoding the moment a video upload completes
- Fixing upload timeouts for large AI-generated PNG and WebP renders
- Malformed base64 when saving a generated PNG to object storage
- Expire backups after 30 days with object-storage lifecycle rules
- Square avatar crops with sharp, stored as a size set in private storage
- No object versioning? Give avatars a rollback window instead
- The restore half of a backup: an admin download flow in Node 22
- Replacing an avatar safely when two uploads race for the same key
- Cheapest object storage for app backups: price the restore, not the archive
- Cheapest object storage for SaaS documents: measure before you shop
- Object storage key naming for originals, thumbnails, WebP and AVIF
vector
- Does a rerank stage actually fix a noisy RAG top-20?
- Shrinking embedding dimensions: measured recall loss at 512, 256 and 64
- Re-indexing when the source changes, without leaving stale chunks
- Embed, upsert and query with the model and the index on one key
- Filtering vector search by tenant without leaking rows
- What a million vectors costs to keep and to query
video
- AI video cost per second, and capping a single job
- Cancelling a running video job before it finishes billing
- Archiving a generated video before its URL expires
- Reaching a specific video vendor without its own account
- Generating a video from a prompt and polling it to completion
- Building a model picker from the live video catalogue
- Video generation timeouts and retries without paying twice
- Text-to-video after the Sora 2 API closes: what to integrate