A modern fullstack application built with Next.js 16, featuring an inventory management system with authentication, product management, and analytics dashboard.
- β‘ Next.js 16.0.7 - React framework with App Router
- βοΈ React 19.2.0 - UI library
- π TypeScript 5.9.3 - Type safety
- π¨ Tailwind CSS 4 - Utility-first CSS framework
- β¨ Lucide React - Icon library
- π Recharts - Chart library for data visualization
- π§ Next.js Server Actions - Server-side logic
- ποΈ Prisma 6.19.0 - Type-safe database ORM
- π PostgreSQL (via Neon) - Database
- π‘οΈ Zod - Schema validation
- π Stack Auth - Authentication and user management (configured within Neon)
- β Biome - Fast formatter and linter
- β‘ Turbopack - Fast bundler (Next.js default)
- π Authentication - Secure user authentication with Stack Auth
- π¦ Product Management - Create, view, and delete products
- π Dashboard - Analytics dashboard with charts and metrics
- π Inventory - View and manage inventory with pagination and search
- π¨ Modern UI - Clean, responsive design with Tailwind CSS
- π Search - Real-time product search functionality
- π Analytics - Product trends and stock level visualizations
- β‘ Performance - Optimized with Next.js 16 and Turbopack
- π Type Safety - Full TypeScript coverage with Prisma
Before you begin, ensure you have:
- π» Node.js 20.x or higher
- π¦ pnpm (or npm/yarn)
- βοΈ A Neon account (for PostgreSQL database and Stack Auth)
git clone <your-repo-url>
cd nextjs-fullstackpnpm installThis will automatically run prisma generate via the postinstall script.
- Go to Neon Console
- Create a new project if not done so already
- Copy your database connection string (it will look like
postgresql://user:password@host/database) - In your Neon project, navigate to Stack Auth settings (configured within Neon)
- Get your Stack Auth credentials:
NEXT_PUBLIC_STACK_PROJECT_IDNEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEYSTACK_SECRET_SERVER_KEY
Run the Stack Auth initialization command:
npx @stackframe/init-stack . --no-browserThis will set up the necessary Stack Auth configuration files in your project.
Create a .env file in the root directory:
# Database connection string from Neon
DATABASE_URL='postgresql://user:password@host/database?sslmode=require'
# Stack Auth credentials
NEXT_PUBLIC_STACK_PROJECT_ID='your-project-id'
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY='your-publishable-key'
STACK_SECRET_SERVER_KEY='your-secret-key'Generate Prisma Client and run migrations:
# Generate Prisma Client (runs automatically on install, but you can run manually)
pnpm prisma generate
# Run database migrations
pnpm prisma migrate dev --name initPopulate the database with sample data:
node prisma/seed.tspnpm devOpen http://localhost:3000 in your browser.
nextjs-fullstack/
βββ app/ # Next.js App Router pages
β βββ dashboard/ # Dashboard page with analytics
β βββ inventory/ # Inventory management page
β βββ add-product/ # Add new product page
β βββ sign-in/ # Authentication page
β βββ layout.tsx # Root layout
βββ components/ # React components
β βββ sidebar.tsx # Navigation sidebar
β βββ products-chart.tsx # Chart component
βββ lib/ # Utility functions and configurations
β βββ prisma.ts # Prisma client instance
β βββ auth.ts # Authentication helpers
β βββ actions/ # Server actions
β βββ products.ts # Product CRUD operations
βββ prisma/ # Prisma configuration
β βββ schema.prisma # Database schema
β βββ seed.ts # Database seed script
β βββ migrations/ # Database migrations
βββ stack/ # Stack Auth configuration
βββ client.tsx # Client-side Stack Auth setup
βββ server.tsx # Server-side Stack Auth setup
The application uses a single Product model:
id- Unique identifier (CUID)userId- Owner's authentication IDname- Product namesku- Stock keeping unit (optional, unique)price- Product price (Decimal with 2 decimal places)quantity- Current stock quantitylowStockThreshold- Alert threshold for low stockcreatedAt- Creation timestampupdatedAt- Last update timestamp
# Development
pnpm dev # Start development server
# Build
pnpm build # Build for production (includes prisma generate)
pnpm start # Start production server
# Code Quality
pnpm lint # Run Biome linter
pnpm format # Format code with Biome
# Database
pnpm prisma generate # Generate Prisma Client
pnpm prisma studio # Open Prisma Studio (database GUI)
pnpm prisma migrate dev --name <name> # Create and run migration
pnpm prisma db push # Push schema changes without migration# Generate Prisma Client after schema changes
pnpm prisma generate
# Create and apply a new migration
pnpm prisma migrate dev --name <migration_name>
# Open Prisma Studio (database GUI)
pnpm prisma studio
# Push schema changes to database (no migration)
pnpm prisma db push
# Reset database and apply all migrations
pnpm prisma migrate reset
# Pull schema from existing database
pnpm prisma db pull-
Push your code to GitHub/GitLab/Bitbucket
-
Import project in Vercel
-
Configure Environment Variables in Vercel dashboard:
DATABASE_URLNEXT_PUBLIC_STACK_PROJECT_IDNEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEYSTACK_SECRET_SERVER_KEY
-
Build Settings (usually auto-detected):
- Build Command:
pnpm run build - Install Command:
pnpm install - Output Directory:
.next
- Build Command:
-
Deploy! The
postinstallscript will automatically generate Prisma Client during the build.
- The
postinstallscript ensures Prisma Client is generated automatically - Make sure all environment variables are set in your deployment platform
- Run migrations on your production database before first deployment:
pnpm prisma migrate deploy
- Sign In: Use Stack Auth to create an account or sign in
- Add Products: Navigate to "Add Product" and create some products
- View Inventory: Check the inventory page to see all products
- Dashboard: View analytics and charts on the dashboard
- This is a test/learning project for Next.js fullstack development
- The application demonstrates modern Next.js patterns including:
- Server Components
- Server Actions
- Type-safe database queries with Prisma
- Authentication integration
- Responsive UI design
This is a test project, but feel free to fork and modify for your own learning!
This project is for educational purposes.