InkdownInkdown
Start writing

Interview Questions

17 files·5 subfolders

Shared Workspace

Interview Questions
Agentic
v2.0

WHY-EDWARD-NOT-EASY-TO-DEPLOY

Shared from "Interview Questions" on Inkdown

Edward: $0 Deployment & Performance Audit

Short answer: You cannot deploy the entire Edward stack at $0 and have it be fast, reliable, and production-grade for multiple users. You can ship a single-user demo on free tiers with real compromises. Full product parity needs paid infra.

This document captures an end-to-end audit of the monorepo — architecture, env contracts, Docker coupling, storage, queues, preview routing, build output, and current free-tier options (2026).


What Edward Actually Is

Edward is not a simple Next.js app. It is a multi-process platform:

LayerComponentMust run continuously?
resume-ans.md
interview-questions.md
Bonkers
BONKERS_END_TO_END_GUIDE.md
BONKERS_INTERVIEW_QUESTIONS.md
interview_questions.md
PROJECT_WALKTHROUGH_SCRIPT.md
shubho-learning-bonkers.md
Edward
pookie
questions
interview-questions-part1.md
interview-questions-part2.md
interview-questions-part3.md
interview-questions-part4.md
interview-questions-part5.md
interview-questions-part6.md
interview-questions-part7.md
WHY-EDWARD-NOT-EASY-TO-DEPLOY.md
Why left Merlin?
Frontendapps/web — Next.js 16Yes (or Vercel)
APIapps/api/server.http.ts — ExpressYes
Workerapps/api/queue.worker.ts — BullMQYes
SandboxesDocker via dockerodeYes (Docker daemon)
StatePostgres + RedisYes
StorageAWS S3 (2 buckets) + CloudFrontFor previews/assets
Preview routerCloudflare Worker + KV (wrangler.toml)Optional (subdomain mode)

Build verified: pnpm turbo build succeeds with stub env vars (~17s).


Hard Blockers for "$0 + Fast + Best"

1. Docker is non-negotiable today

The API exits on boot if Docker is unavailable (apps/api/services/sandbox/lifecycle/control.ts):

TypeScript

This rules out Vercel, Cloudflare Workers/Pages, Netlify Functions, and any pure serverless host for the API.

Each sandbox container is heavy (apps/api/services/sandbox/docker.service.ts):

TypeScript

With defaults (AGENT_RUN_WORKER_CONCURRENCY=2, BUILD_WORKER_CONCURRENCY=3), one host can need 5+ GB just for containers.

2. Two long-running Node processes — worker has no prod script

apps/api/package.json has "start": "node dist/server.http.js" but no start:worker. In dev you run both via concurrently. Production needs a process manager (systemd, PM2, Docker Compose) you must write yourself — no deploy manifests exist in the repo.

3. AWS credentials are mandatory at startup

apps/api/app.config.ts uses validateEnvVar on:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_BUCKET_NAME
  • AWS_CDN_BUCKET_NAME

Empty strings in .env.example will crash the API. The README's "stub locally" story contradicts the code.

storage.config.ts uses a plain S3Client with no R2/custom endpoint — Cloudflare R2 needs a small code change.

4. Redis churn kills managed free tiers

The worker runs a 250ms flush interval plus BullMQ, pub/sub, rate limits, and sandbox state (apps/api/queue.worker.ts):

TypeScript

Upstash Redis free (~10K commands/day) would be exhausted in hours. Self-hosted Redis on the same VM is the only viable $0 path.

5. Long-lived SSE streams

Agent runs stream for up to 20 minutes (configurable via STREAM_GUARD_TIMEOUT_MS in .env.example). Serverless timeouts (10–60s on most free tiers) are incompatible.

6. No deployment infrastructure in repo

What exists:

  • wrangler.toml — CF Worker for *.edwardd.app subdomain previews (hardcoded domain)
  • .github/workflows/ci.yml — quality gates only
  • .github/workflows/build-sandbox-images.yml — pushes to GHCR
  • docker/templates/* — sandbox images, not app deployment

What's missing: docker-compose.yml for prod, Fly/Render/Railway configs, worker start script, systemd units, health checks.


Feature-by-Feature: What Works at $0

Feature$0 viable?Notes
Landing / marketing UI✅Vercel Hobby or CF Pages — fast CDN
GitHub OAuth sign-in✅Free; callback URLs must match deploy domain
Chat UI✅Needs external API URL
AI code generation⚠️Needs Docker VM + user's own LLM key (BYOK)
Sandbox file editing⚠️Same Docker requirement
Path-mode previews⚠️Needs object storage + CLOUDFRONT_DISTRIBUTION_URL
Subdomain previews❌Needs owned domain + CF KV + Worker + storage
Chat image uploads❌buildCdnAssetUrl throws without ASSETS_URL
Web search (Tavily)❌Paid API
Changelog (Linear)❌Paid API
Multi-user concurrency❌Free VM melts past ~2 active sandboxes
GitHub sync✅Uses user's OAuth token

Built-in rate limits already cap abuse (helpful on free infra):

  • 10 chats/min, 10 successful chats/day
  • 6 image uploads/min
  • 2 concurrent runs per user

Docker Alternatives (E2B, etc.)

E2B has a Hobby tier: $100 one-time usage credits, no credit card, up to 20 concurrent sandboxes. But Edward is tightly coupled to dockerode across 10+ files (docker.service.ts, provisioning, backup, build pipeline). Swapping to E2B is a multi-week refactor, not a config flip. After credits run out, usage is metered per second.

Other options (Modal, Daytona, Fly Machines) are similarly not integrated and mostly paid.

Honest take: For $0, self-hosted Docker on a free VM beats E2B for sustained use. E2B is better for a short demo before credits expire.


Best Realistic $0 Stack

Plain text
Per-component free-tier fit
ComponentBest $0 optionFast at scale?
WebVercel Hobby✅ UI is fast (edge, static pages, optimizePackageImports)
API + WorkerOracle Always Free (4 OCPU ARM, 24GB)❌ Single box, no HA
PostgresCo-located on Oracle VM⚠️ Avoids Neon sleep/cold-start
RedisCo-located on Oracle VM✅ Only viable $0 option
Docker sandboxesSame Oracle VM❌ Bottleneck — 2–3 concurrent max
Object storageCloudflare R2 (10GB free)⚠️ Needs code patch
Preview CDNCloudflare CDN in front of R2✅ Generous free bandwidth
Subdomain previewsCF Worker + KV (free)⚠️ Needs paid domain (~$10/yr)
Sandbox imagesGHCR public✅ Free
LLMUser BYOKN/A (users pay)
Required env for minimum $0 deploy

Web: NEXT_PUBLIC_API_URL, DATABASE_URL, BETTER_AUTH_*, GITHUB_*, NEXT_PUBLIC_ASSETS_URL

API: Everything in apps/api/.env.example with non-empty AWS keys, plus CLOUDFRONT_DISTRIBUTION_URL for previews and ASSETS_URL for image uploads.

Tune for free VM survival:

Bash

Performance Reality

What is already well-built for speed:

  • Next.js 16 with static prerendering on /, /privacy, /terms, /changelog
  • optimizePackageImports for lucide-react
  • CF Worker caches assets max-age=31536000, immutable; HTML max-age=60
  • CloudFront path-preview rewrite (documented in README)
  • Redis pub/sub for real-time build status fanout

What will never be "fast and best" on $0:

  • Sandbox builds (pnpm install + compile inside 0.5-CPU containers) — 30s–3min+
  • First preview deploy (S3 upload + optional CF invalidation)
  • Cold starts if you split services across free DB/Redis tiers
  • Multi-user load on a single free VM

Performance is compute-bound on Docker, not CDN-bound. Free tier = slow sandboxes, not slow UI.


Bottom-Line Verdict

QuestionAnswer
Deploy entire project at $0?No — not with full features
Deploy a working demo at $0?Yes — with Oracle VM + Vercel + R2 patch
Fast and best after deploy at $0?No — acceptable for 1–3 users, not production SaaS
Biggest blockers?Docker sandboxes, dual processes, hard-required AWS creds, Redis churn, no deploy config
Credit card needed?Yes for Oracle (and historically AWS if you use S3)
True $0 forever?Only if you never exceed free allowances and accept demo-scale limits
What you'd need for "fast and best" (paid, realistic)
  • Dedicated VM or K8s with 8+ vCPU, 32GB RAM (~$40–80/mo)
  • Managed Postgres (Neon/Supabase ~$0–25/mo)
  • Managed Redis (Upstash ~$10/mo) or co-located
  • R2 or S3 + Cloudflare CDN (~$0–5/mo at low traffic)
  • Custom domain (~$10/yr)

Recommended Next Steps (if you want $0 demo)

  1. Add a start:worker script and a docker-compose.prod.yml for API + worker + Redis + Postgres
  2. Patch storage.config.ts to support R2 S3-compatible endpoint
  3. Provision Oracle Always Free ARM VM, install Docker, pull GHCR sandbox images
  4. Deploy web to Vercel Hobby pointing at the VM API
  5. Set concurrency to 1/1 and EDWARD_DEPLOYMENT_TYPE=path
  6. Skip subdomain previews, Tavily, Linear, Sentry until you have budget

Audit date: June 6, 2026