You now have a full‑stack Next.js app with:
use cache + tags)This chapter shows how to ship it and where to take it next.
Vercel is the easiest way to host Next.js.
.env.local is in .gitignore (never commit secrets).In Vercel, go to Settings → Environment Variables and add:
You can also add variables via the CLI:
bash
Locally, prefer .env.local:
bash
https://vercel.com/newVercel will detect your app and build it. Subsequent pushes to your default branch auto‑deploy.
File storage is great to start, but you’ll want a real database for reliability and scale. Popular options:
Two common ORMs:
bash
DATABASE_URL in .env (and in Vercel → Environment Variables)bash
prisma/schema.prismaprisma
bash
db/chat.ts to read/write via Prisma instead of file utils. Keep your cache tags (cacheTag/updateTag) so UI revalidations continue to work.Add a Message model with chatId, role, content, and timestamps. Store/send the history in your API route so the AI has context after refreshes.
OPENAI_API_KEY to the client; use server routes/actionsYou’ve built a real, deployable product. Ship it to Vercel, move storage to a database when you’re ready, and iterate on UX, reliability, and cost controls. From here, you can scale features confidently while keeping your stack simple and modern.
Mark this chapter as finished to continue
Mark this chapter as finished to continue