Vercel is the primary deployment target for Inventory System. The application is built on Next.js 16 and relies on serverless functions for all API routes, which pair naturally with Neon Serverless Postgres — a connection-pooling-aware Postgres service that communicates over WebSockets via theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/juadariasmar/inventory_project/llms.txt
Use this file to discover all available pages before exploring further.
@neondatabase/serverless driver instead of traditional TCP. This means cold-start latency is minimal and you never exhaust database connections under concurrent load.
Prerequisites
Before you begin, make sure you have the following in place:Vercel Account
A Vercel account with permission to create new projects. The free Hobby tier is sufficient for testing.
Neon Project with Auth
A Neon project with the Neon Auth feature enabled. You will need both a pooled and a direct (unpooled) connection string, plus the Auth base URL and secrets.
Upstash Redis (optional)
An Upstash Redis instance for rate limiting. If omitted, rate limiting is disabled — acceptable for low-traffic deployments.
Deployment steps
Import the repository on Vercel
Log in to the Vercel dashboard and click Add New → Project. Select the Git provider where the repository lives, then choose
inventory_project from the list and click Import.Vercel will auto-detect the Next.js framework and set sensible defaults. No changes to the framework preset are needed.Confirm the build command
In the Build & Output Settings section, verify that the build command is set to:This script (defined in
package.json) runs prisma generate && next build — it generates the Prisma Client from the schema before compiling the application, ensuring the correct engine binary is bundled with the output.Set environment variables
Navigate to Settings → Environment Variables and add each of the following variables. Apply them to the Production, Preview, and Development environments as appropriate.
| Variable | Description |
|---|---|
DATABASE_URL | Pooled Neon connection string (used by the app at runtime). Format: postgresql://user:pass@host-pooler/dbname?sslmode=require |
DATABASE_URL_UNPOOLED | Direct (unpooled) Neon connection string (used by Prisma CLI and migrations). Format: postgresql://user:pass@host/dbname?sslmode=require |
NEXTAUTH_SECRET | A long random string used to sign session tokens. Generate with openssl rand -base64 32. |
NEXTAUTH_URL | The canonical URL of the production deployment, e.g. https://inventory.example.com. Must match the domain you configure in Neon Auth. |
NEXT_PUBLIC_BASE_URL | Same value as NEXTAUTH_URL. Exposed to the browser for building absolute links. |
NEON_AUTH_BASE_URL | The Neon Auth base URL from the Neon Console, e.g. https://your-project.neonauth.tech/dbname/auth. |
NEON_AUTH_COOKIE_SECRET | Secret used to encrypt Neon Auth session cookies. Must be at least 32 characters. |
NEON_WEBHOOK_SECRET | Signing secret for the Neon Auth webhook. Copy this from the Neon Console after creating the webhook endpoint. |
SUPER_ADMIN_EMAIL | Email address that receives the SUPER_ADMIN role on first login. |
ADMIN_EMAILS | Comma-separated list of emails that receive the ADMIN role automatically, e.g. [email protected],[email protected]. |
RESEND_API_KEY | API key from Resend for transactional emails (invitations, notifications). |
EMAIL_FROM | Sender address used in outgoing emails, e.g. [email protected]. Must be verified in Resend. |
UPSTASH_REDIS_REST_URL | REST URL for your Upstash Redis database, e.g. https://your-db.upstash.io. Leave blank to disable rate limiting. |
UPSTASH_REDIS_REST_TOKEN | Authentication token for the Upstash Redis REST API. |
Configure Neon Auth allowed origins
In the Neon Console, open your project and navigate to Auth → Settings. Under Allowed Origins, add your production domain:If you use a custom domain, add that too. Without this step the Neon Auth token exchange will be blocked by CORS and users will be unable to log in.
Set up the Neon Auth webhook
Neon Auth fires a webhook whenever a user is created or updated so the application can sync the user record into its own Copy the signing secret that Neon generates and paste it into the
Usuario table. In the Neon Console, go to Auth → Webhooks and add a new endpoint:NEON_WEBHOOK_SECRET environment variable you set in the previous step.Deploy
Click Deploy. Vercel will run
npm run build (which includes prisma generate), package the output, and route traffic to the serverless functions. The first deploy typically takes two to three minutes.Once complete, open the deployment URL and verify that the login page loads and that you can authenticate with the credentials seeded by npm run seed.Critical next.config.ts settings for Prisma
Preview deployments
Every pull request automatically gets a preview deployment on Vercel. Two helper scripts inpackage.json make preview environment management easier:
npm run clean:previews— runsscripts/cleanup-vercel.tsto delete stale preview deployments and free up Vercel project limits.npm run sync:secrets— runsscripts/sync-github-secrets.tsto push updated secrets to GitHub Actions, keeping CI and Vercel preview environments in sync.
Preview deployments share the same Neon database by default. If you want to isolate preview data, create a separate Neon branch per PR and override
DATABASE_URL in Vercel’s preview environment scope.Post-deploy checklist
After your first successful deployment, confirm the following:Webhook is firing
Register a new test user and check the Neon Console webhook delivery logs. A successful
200 response confirms that Usuario records are being created in the database.Allowed origins include deploy URL
Log in on the production domain. If the Neon Auth modal fails to redirect, re-check that the exact production URL (including
https://) is listed under Auth → Settings → Allowed Origins in the Neon Console.NEXTAUTH_URL matches domain
Confirm
NEXTAUTH_URL is set to the exact canonical URL (no trailing slash). A mismatch causes callback redirect failures after OAuth sign-in.Emails are delivering
Trigger an invitation email from the admin panel and verify it arrives. Check Resend’s delivery dashboard if it does not.