A comprehensive feedback collection and management system for restaurants, built with Next.js 15, TypeScript, Tailwind CSS, and Prisma ORM. Optimized for Cloudflare Workers deployment with D1 database support.
- Customer Feedback Submission: Easy-to-use form with rating system (1-5 stars)
- Feedback Tracking: Customers can check their feedback status using a unique ID
- Admin Dashboard: Secure admin panel for managing all feedback
- Status Management: Track feedback processing (Unprocessed → Processing → Processed)
- Modern UI: Clean, responsive interface with Tailwind CSS
- Cloudflare Workers: Serverless deployment with edge computing
- Database Support: Cloudflare D1 (SQLite-compatible) for production, SQLite for development
- Node.js 18+
- npm/yarn/pnpm
- Wrangler CLI (for Cloudflare deployment)
- Clone the repository:
git clone <repository-url>
cd louis-steakhouse-feedback- Install dependencies:
npm install- Set up local environment:
# Copy development environment variables
cp .dev.vars.example .dev.varsConfigure .dev.vars for local development.
- Initialize the local database:
# Generate Prisma client
npm run db:generate
# Apply database schema locally
npx wrangler d1 migrations apply prod-louis-steakhouse-feedback --local- Start the development server:
npm run devOpen http://localhost:3000 to view the application.
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm run lint- Run ESLint
npm run db:generate- Generate Prisma clientnpm run db:push- Push schema to databasenpm run db:migrate- Create and run migrationsnpm run db:studio- Open Prisma Studio
npm run deploy- Build and deploy to Cloudflare Workersnpm run preview- Build and preview deployment locallynpm run cf-typegen- Generate Cloudflare environment types
- Submit Feedback: Visit the homepage and click "Submit Feedback"
- Fill Form: Add your name (optional), contact info (optional), dining time (optional), rating (1-5), and feedback content
- Get ID: After submission, save the feedback ID to track status later
- Check Status: Use "View My Feedback" to check processing status
- Login: Visit
/admin/loginwith configured credentials - Dashboard: View all feedback with filtering options
- Manage: Update feedback status and add responses
- Filter: View by status (Unprocessed/Processing/Processed)
This project uses Cloudflare D1 (SQLite-compatible) for production and local SQLite for development.
The database is initialized using migrations located in /migrations/0001_init_database.sql. The process is:
- Generate migration:
# Create migration file (already done)
npx wrangler d1 migrations create prod-louis-steakhouse-feedback init_database
# Generate SQL from Prisma schema (already done)
npx prisma migrate diff --from-empty --to-schema-datamodel ./prisma/schema.prisma --script --output migrations/0001_init_database.sql- Apply migration locally:
npx wrangler d1 migrations apply prod-louis-steakhouse-feedback --local- Apply migration to production:
npx wrangler d1 migrations apply prod-louis-steakhouse-feedback --remoteThe app uses src/lib/db.ts which:
- Uses
@opennextjs/cloudflareto get the Cloudflare context - Creates a PrismaD1 adapter for D1 database access
- Returns a configured Prisma client instance
This project is pre-configured for Cloudflare Workers deployment using OpenNext.js.
- Install Wrangler CLI:
npm install -g wrangler
# or use the local version: npx wrangler- Authenticate with Cloudflare:
wrangler login- Create D1 Database (if not already created):
wrangler d1 create prod-louis-steakhouse-feedback- Update
wrangler.tomlwith your database ID:
[[d1_databases]]
binding = "DB"
database_name = "prod-louis-steakhouse-feedback"
database_id = "your-actual-database-id" # Replace with actual ID- Deploy database schema:
npx wrangler d1 migrations apply prod-louis-steakhouse-feedback --remote- Build and deploy in one command:
npm run deployOr manually:
# Build the application
npx opennextjs-cloudflare build
# Deploy to Cloudflare Workers
npx opennextjs-cloudflare deployThe production environment variables are configured in wrangler.toml:
[vars]
NODE_ENV = "production"
ADMIN_USERNAME = "admin"
ADMIN_PASSWORD = "secret_for_2025" # Change this!Important: Update the ADMIN_PASSWORD in wrangler.toml before deployment.
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS 4
- Database: Prisma ORM with Cloudflare D1 (SQLite-compatible)
- Database Adapter:
@prisma/adapter-d1for D1 integration - Caching: Custom TypeScript cache handler for Cloudflare Workers
- Authentication: Cookie-based session management
- Deployment: Cloudflare Workers with OpenNext.js
- Build Tool: Turbopack (dev), OpenNext.js (production)
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── admin/
│ │ │ ├── dashboard/ # Admin dashboard
│ │ │ └── login/ # Admin login
│ │ ├── api/
│ │ │ ├── admin/ # Admin API routes
│ │ │ └── feedback/ # Feedback API routes
│ │ ├── feedback/
│ │ │ ├── submit/ # Feedback submission form
│ │ │ ├── success/ # Success page
│ │ │ └── view/ # Feedback lookup
│ │ └── page.tsx # Homepage
│ └── lib/
│ ├── auth.ts # Authentication utilities
│ └── db.ts # Cloudflare D1 database connection
├── migrations/ # D1 database migrations
│ └── 0001_init_database.sql
├── prisma/
│ └── schema.prisma # Database schema
├── wrangler.toml # Cloudflare Workers configuration
├── open-next.config.ts # OpenNext.js configuration
└── cloudflare-env.d.ts # Cloudflare environment types
wrangler.toml: Cloudflare Workers configuration with D1 database bindingopen-next.config.ts: OpenNext.js configuration for Cloudflare deploymentsrc/lib/db.ts: Database connection using PrismaD1 adaptermigrations/0001_init_database.sql: D1 database schema migration
This project is private and proprietary.