This guide walks you through cloning the repository, pointing it at a Neon Postgres database, running migrations, seeding initial data, and launching the development server. By the end you will have a fully functional local instance of Inventory System with seeded user records ready to authenticate through Neon Auth.Documentation 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.
Prerequisites
Before you begin, make sure you have the following ready:- Node.js 20 or later — the project targets the Node.js 20 runtime. Run
node -vto confirm. - A Neon Postgres project — create one for free at neon.tech. You will need both the pooled (
DATABASE_URL) and direct (DATABASE_URL_UNPOOLED) connection strings from the Neon Console. - Neon Auth configured — enable Neon Auth in your Neon project and note the
NEON_AUTH_BASE_URL,NEON_AUTH_COOKIE_SECRET, andNEON_WEBHOOK_SECRETvalues from the Auth settings panel.
Upstash Redis is optional for local development. When
UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are not set, the middleware automatically falls back to an in-memory rate limiter that works fine for a single local process. See the Environment Variables reference for full details.Steps
Clone the repository and install dependencies
Clone the project and install all Node.js dependencies. The
postinstall hook runs prisma generate automatically, so the Prisma Client is ready as soon as npm install completes.Configure environment variables
Copy the example environment file to Open For the full list of available variables — including email, rate limiting, and admin promotion — see the Environment Variables reference.
.env and fill in your values. At minimum you must supply the six variables listed below — everything else is optional for local development..env in your editor and set:Generate the Prisma Client
Generate the typed Prisma Client from
prisma/schema.prisma. This step is already run by postinstall, but re-run it any time you modify the schema.Run database migrations
Apply all pending Prisma migrations against your Neon database. This command uses the
DATABASE_URL_UNPOOLED direct connection under the hood, which is required for DDL operations.Seed the database
Populate the database with initial data: a The seed script prints each created user’s email and role to the console. Because authentication is handled by Neon Auth, these database records must be paired with a real Neon Auth account — sign in through the Neon Auth UI using the email addresses printed by the seed script.
SUPER_ADMIN user (email taken from SUPER_ADMIN_EMAIL, defaulting to [email protected]), an ADMIN user ([email protected]), a USUARIO user ([email protected]), and a set of default categories — each scoped to their own demo Empresa.Start the development server
Launch the Next.js development server. The application will be available at http://localhost:3000.
Available Scripts
The following scripts are defined inpackage.json and cover the full development, testing, and deployment lifecycle.
| Script | Command | Description |
|---|---|---|
| Development server | npm run dev | Starts Next.js in development mode with fast refresh. |
| Production build | npm run build | Runs prisma generate then builds the Next.js production bundle. |
| Production server | npm run start | Starts the compiled production server. |
| Lint | npm run lint | Runs ESLint across all source files. |
| Unit tests | npm run test | Runs all Jest tests with --runInBand (required because tests share the database). |
| Test coverage | npm run test:coverage | Runs Jest and generates an Istanbul coverage report. |
| End-to-end tests | npm run test:e2e | Runs Playwright tests against the running application. |
| Seed database | npm run seed | Executes prisma/seed.ts to load initial users and categories. |
| Generate Prisma Client | npm run prisma:generate | Regenerates the Prisma Client from the current schema. |
| Push schema | npm run prisma:dbpush | Pushes schema changes directly to the database without creating a migration file. Useful for rapid prototyping. |
| Deploy migrations | npm run prisma:migrate | Applies all pending migrations using prisma migrate deploy. Use this in CI and production. |