I spent a weekend building NexusOS — an AI workspace with research, document Q&A, AI agents and tasks — almost entirely by directing Cursor rather than writing code myself.
It works. It’s live. But the gap between “the AI wrote the code” and “it runs in production” was where all the real work happened. Here’s what actually broke.
1. The build passed locally and died on Vercel
First deploy failed instantly:
throw new Error("DATABASE_URL environment variable is required");
Error: Failed to collect page data for /api/auth/account
Enter fullscreen mode Exit fullscreen mode
Next.js evaluates API routes at build time. Prisma wanted a live database during the build, not just at runtime. Locally there was a Docker Postgres running, so it never surfaced.
Fix: provision the database before the first deploy, not after.
2. Tables didn’t exist, and nothing told me
Second deploy built fine, then every request 500’d:
PrismaClientKnownRequestError:
The table `public.users` does not exist in the current database.
Code: P2021
Enter fullscreen mode Exit fullscreen mode
The database was connected. Migrations had simply never run against it. A green build meant nothing.
Fix — put migrations in the build script:
"build": "prisma generate && prisma migrate deploy && next build"
Enter fullscreen mode Exit fullscreen mode
Also needed prisma/migrations/migration_lock.toml, which doesn’t exist until you run migrate dev at least once. Without it migrate deploy silently does nothing.
3. Swapping OpenAI for Groq took one line
I didn’t want to pay for OpenAI during development. Groq is OpenAI-API-compatible, so the SDK works unchanged — you only redirect the base URL:
const client = new OpenAI({
apiKey: process.env.GROQ_API_KEY,
baseURL: "https://api.groq.com/openai/v1",
});
Enter fullscreen mode Exit fullscreen mode
One caveat: Groq has no embeddings endpoint. Anything doing RAG or vector memory needs a separate embeddings provider.
4. The bug I nearly shipped
The research feature returned confident, well-structured reports. They looked great.
Then I read the sources section:
Sources: [n/a, AI knowledge only]
Enter fullscreen mode Exit fullscreen mode
No web search key was configured, so the model was answering from training data and formatting it like researched output. It never lied — it said so plainly — but nobody reads the sources section when the answer looks authoritative.
After connecting a search API, the same query returned real citations with URLs.
This is the failure mode I’d watch for in any AI product. Plausible output is not verified output, and users assume anything formatted like a citation is one.
5. pgvector on serverless Postgres
Vector search needs the extension enabled inside a migration, not manually:
CREATE EXTENSION IF NOT EXISTS vector;
Enter fullscreen mode Exit fullscreen mode
Neon and Supabase both support it. Run it manually and your next fresh deploy breaks.
6. Webhooks: verify before trusting
For Stripe, never update subscription state from a frontend redirect. Verify the signature server-side:
const event = stripe.webhooks.constructEvent(
rawBody, signature, process.env.STRIPE_WEBHOOK_SECRET
);
Enter fullscreen mode Exit fullscreen mode
Quick way to confirm it’s working — POST an unsigned payload at your endpoint. You want a 400:
{"error":"Missing signature"}
Enter fullscreen mode Exit fullscreen mode
A 200 means anyone can forge a “payment succeeded” event.
What I’d tell someone starting
AI writes the code fast. It doesn’t provision your database, run migrations, configure environment variables per environment, or notice that your research feature is quietly hallucinating. That’s still yours.
Budget your time for infrastructure and verification, not for writing code.
The app is live and needs no signup — it creates a guest workspace when you open it:
👉 https://all-in-one-data-analises-workspace.vercel.app
Pre-registration for launch updates (first 500 get Pro free for a month):
👉 https://nexusos-landing-page.vercel.app/
Happy to answer questions about any of the above.