A modern, full-stack web application built with Next.js and Prisma that helps users compare grocery prices across multiple markets to find the best deals and save money. Features a complete database-driven system with Neon PostgreSQL.
- 🛒 Dynamic Price Comparison: Compare prices across markets with real-time database queries
- 💰 Savings Calculator: See potential savings before making purchases
- 📊 Visual Analytics: Beautiful charts and statistics to analyze price differences
- ✓ Verified Markets: Filter for trusted, verified markets
- 📱 Responsive Design: Works seamlessly on mobile, tablet, and desktop
- 🎨 Modern UI: Built with Tailwind CSS and Framer Motion animations
- 🔍 Search & Filter: Quickly find items and markets with smart search
- 🗄️ Full CRUD Operations: Add, edit, and delete items, markets, and prices
- 🔐 PostgreSQL Database: Powered by Neon serverless PostgreSQL
- Framework: Next.js 15 (React 18)
- Database: Neon PostgreSQL
- ORM: Prisma
- Styling: Tailwind CSS
- Animations: Framer Motion
- Icons: Lucide React
- Language: TypeScript
- API: Next.js API Routes
- Node.js 18+ installed
- npm, yarn, or pnpm package manager
- A Neon PostgreSQL account (free tier available)
- Go to Neon.tech and sign up for free
- Create a new project
- Copy your connection string (it looks like this):
postgresql://username:password@ep-xxx-xxx.region.aws.neon.tech/dbname?sslmode=require
# Clone the repository
git clone <repository-url>
cd react-vite-deploy
# Install dependencies
npm install- Create a
.envfile in the root directory:
# On Windows (PowerShell)
Copy-Item .env.local.example .env
# On Mac/Linux
cp .env.local.example .env- Open
.envand add your Neon connection string:
DATABASE_URL="postgresql://your-username:your-password@your-host.neon.tech/your-database?sslmode=require"Run these commands to set up your database schema and seed it with sample data:
# Generate Prisma Client
npm run db:generate
# Push the schema to your database
npm run db:push
# Seed the database with sample data (20 items, 12 markets, 240 prices)
npm run db:seednpm run devOpen http://localhost:3000 in your browser
npm run dev- Start the development servernpm run build- Build the production applicationnpm start- Start the production servernpm run lint- Run ESLint to check for code issues
npm run db:generate- Generate Prisma Clientnpm run db:push- Push schema changes to databasenpm run db:studio- Open Prisma Studio (database GUI)npm run db:seed- Seed database with sample data
├── app/
│ ├── layout.tsx # Root layout with metadata
│ ├── page.tsx # Main price comparison page
│ ├── globals.css # Global styles and Tailwind imports
│ └── favicon.ico # App icon
├── public/ # Static assets
├── eslint.config.mjs # ESLint configuration
├── next.config.ts # Next.js configuration
├── tailwind.config.ts # Tailwind CSS configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies
- Select Items: Choose grocery items you want to compare by clicking on them
- Select Markets: Pick at least 2 markets to compare prices
- View Savings: Check the potential savings calculator
- Compare: Click "Compare Prices" to see detailed results
- Analyze: View detailed price breakdowns, charts, and statistics
- Copy Report: Export results as a text report
Click the "Manage" button in the header to access admin pages:
-
Manage Items (
/admin/items)- Add new grocery items with name, unit, and emoji
- Edit existing items
- Delete items (also removes associated prices)
-
Manage Markets (
/admin/markets)- Add new markets with name, rating, and verification status
- Edit market details
- Delete markets (also removes associated prices)
-
Manage Prices (
/admin/prices)- Set prices for any item-market combination
- View all prices in a matrix table
- Update prices in real-time
The application uses three main tables:
id- Unique identifiername- Item name (unique)unit- Measurement unit (kg, liter, piece, etc.)emoji- Optional emoji iconcreatedAt,updatedAt- Timestamps
id- Unique identifiername- Market name (unique)rating- Star rating (0-5)verified- Verification statuscreatedAt,updatedAt- Timestamps
id- Unique identifieritemId- Reference to ItemmarketId- Reference to Marketprice- Price valuecreatedAt,updatedAt- Timestamps- Unique constraint on (itemId, marketId) combination
If you see this error:
- Check that your
.envfile exists and has the correctDATABASE_URL - Verify your Neon database is active
- Run
npm run db:pushto ensure schema is synced - Run
npm run db:seedto add sample data - Restart the development server
If you encounter Prisma Client errors:
npm run db:generateAfter modifying prisma/schema.prisma:
npm run db:push
npm run db:generateContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
For support, please open an issue in the GitHub repository.