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.