Coding

Replit → Vercel Migration

Migrate a Replit project to Vercel: clean Replit files, update scripts, add secure SendGrid API route, audit DB, add docs, and prepare one-click production depl

migrationvercelreplitnode20next.jsviteexpressserverlesssendgridenvironment variablesapi routesprismamongodbreadmegitignore
Prompt text
You are an AI agent. Migrate this project from Replit to Vercel.  

Requirements:
- Remove all Replit-specific files/config (.replit, replit.nix, etc).
- Update package.json scripts for Vercel (`dev`, `build`, etc).
- Ensure the app builds and runs cleanly on Vercel (Node 20).
- Default: rely on Vercel’s auto-detection for frameworks and serverless functions.
  - If auto-detection is not sufficient, create a `vercel.json` with the correct functions and routing.
- Check and restructure all API routes so they conform to Vercel standards:
  - For Next.js → move endpoints into `pages/api/*` or `app/api/*/route.ts`.
  - For non-Next.js → implement endpoints as serverless functions under `api/*.ts`.
  - Ensure routes only expose what is safe to the client.

Environment variables in Vercel:
- SENDGRID_API_KEY (server-only, never exposed client-side)

Email:
- Implement a server route for SendGrid (e.g., `api/email/send`) that never exposes SENDGRID_API_KEY to the client.

Database check:
- If the project uses a database:
  - Inspect whether it has any tables or data.
  - If the DB is empty → skip migration (and remove DB code if unnecessary).
  - If the DB has data/tables → STOP and refer back to the user with a summary of what you found, asking for next steps before proceeding.

Docs & hygiene:
- Add `.env.local.example` showing SENDGRID_API_KEY.
- Add `.gitignore`.
- Add a short README with: overview, env var table, local dev, deploy steps, and API route notes.

Deliverables:
- Make code changes in-place.
- Summarize changes (files touched + purpose).
- List manual follow-ups (confirm SENDGRID_API_KEY in Vercel).
- Provide simple deploy steps:  
  1) `npm i && npx vercel link`  
  2) Set SENDGRID_API_KEY in Vercel  
  3) `npx vercel --prod`

Final step:
- Commit and push all changes so the user can immediately test the deployment on Vercel.

Prompt Author

avatar
Sam Holstein

AI consultant and software creator helping businesses and creators harness artificial intelligence through practical solutions and innovative products. Creator of BestPromptIdeas.com.

Ratings

Related prompts

Coding

Holistic Security Audit Report Generator

Act as a senior security engineer to audit a codebase and deliver a focused, actionable security report on vulnerabilities, threats, risk, and compliance.

Coding

Xcode Project Setup Coach

Reads your Markdown specs and coaches you step by step to create a correctly configured Xcode project with clear choices, confirmations, and a final summary.

Coding

Collaborative Coding Agent

Act as a coding agent that seeks approval before changes and pauses for testing. Review the provided codebase and deliver a concise high‑level summary.