Deploy API to HuggingFace Spaces (Docker SDK), web to Vercel, Postgres on Neon, Redis on Upstash. All free.
Why HF Spaces: purpose-built for ML, free CPU tier with persistent storage, no cold-start surprise, direct HF Hub integration for model loading.
Docker, hardware CPU basic (free).DATABASE_URL, REDIS_URL, SENTRY_DSN as Secrets.Root of the Space repo = apps/api/. Either:
git subtree push --prefix apps/api space main.deploy-api.yml workflow which rsyncs on tagged releases.7860 (HF default).huggingface_hub.snapshot_download so cold start is < 5s.apps/web.pnpm install --frozen-lockfile.pnpm build.NEXT_PUBLIC_API_URL=https://<user>-<space>.hf.space.pgvector extension: CREATE EXTENSION IF NOT EXISTS vector;....-pooler.neon.tech).arq — or direct TCP if preferred.clinical-nlp/ner-v1.production for the currently-deployed version.huggingface_hub.hf_hub_download at startup (cached on Space persistent storage).migrate against Neon).curl https://<space>.hf.space/health → 200.production tag back to previous version, redeploy API.main branch.