This template comes configured with the bare minimum to get started on anything you need.
- Browse Snacks: View all available snack items with images, descriptions, prices, and categories
- Responsive Design: Fully responsive interface that works on desktop, tablet, and mobile devices
- User Registration & Login: Secure authentication system
- Place Orders: Add snacks to cart and place orders
- Order History: View personal order history with status tracking
- Order Tracking: See order status (Pending, Completed, Cancelled)
- Admin Dashboard: Comprehensive order management interface
- Order Management: Review all orders from all customers
- Status Updates: Update order status (Pending β Completed/Cancelled)
- Order Statistics: View summary statistics of all orders
- Snack Management: Add, edit, and manage snack inventory through Payload CMS admin panel
- Frontend: Next.js 15, React 19, TypeScript
- Backend: Payload CMS 3.0
- Database: Vercel Postgres
- Authentication: Built-in Payload authentication with role-based access
- Styling: Custom CSS with modern responsive design
- Media: Sharp for image processing
- Can view all available snacks
- Can place orders for snacks
- Can view their own order history
- Cannot modify or cancel orders once placed
- All regular user permissions
- Can access admin dashboard
- Can view all orders from all customers
- Can update order status
- Can manage snack inventory through CMS admin panel
- Email, first name, last name
- Role-based authentication (user/admin)
- Default role: 'user'
- Name, description, price, category
- Image upload with media relation
- Availability toggle
- Categories: Chips, Candy, Cookies, Nuts, Crackers, Drinks
- User relationship
- Array of items (snack + quantity)
- Total amount calculation
- Status tracking (pending/completed/cancelled)
- Order date tracking
- Image upload and management
- Alt text for accessibility
- Node.js 18+ or 20+
- pnpm 9+ or 10+
- PostgreSQL database (Vercel Postgres recommended)
-
Clone the repository
git clone <repository-url> cd dyad-snacks
-
Install dependencies
pnpm install
-
Environment Setup
cp .env.example .env
Configure your environment variables:
PAYLOAD_SECRET=your-secret-key POSTGRES_URL=your-postgres-connection-string
-
Start the development server
pnpm dev
-
Open your browser Navigate to
http://localhost:3000
- Create Admin User: Visit
/adminto create your first admin user - Add Snacks: Use the admin panel to add snack items with images
- Test Ordering: Create a regular user account to test the ordering flow
POST /api/orders- Create a new order (authenticated users)PATCH /api/orders/update-status- Update order status (admin only)
/api/users- User management/api/snacks- Snack management/api/media- Media upload/management/admin- Admin panel access
- Homepage: Browse all available snacks
- Login Required: Click "Login to Order" to authenticate
- Registration: Create account with first name, last name, email, password
- Browse & Order: View snacks and click "Order Now"
- Order Form: Select quantity and place order
- Order Confirmation: Redirected to "My Orders" with success message
- Order History: View all personal orders with status
- Admin Dashboard: Access via navigation or direct link
- Order Overview: See statistics and all orders
- Status Management: Update order status with real-time buttons
- Inventory Management: Access full CMS admin panel
The application is fully responsive with breakpoints:
- Desktop: 1200px+ (full grid layout, side-by-side forms)
- Tablet: 768px-1199px (adapted grid, stacked layouts)
- Mobile: <768px (single column, touch-friendly buttons)
- Role-based Access Control: Proper separation of user and admin permissions
- Authentication Required: Protected routes for ordering and admin functions
- Data Validation: Server-side validation for all order data
- Price Verification: Server validates prices to prevent manipulation
- Connect your repository to Payload Cloud
- Configure environment variables
- Deploy automatically with MongoDB and S3 storage
- Connect repository to Vercel
- Configure Vercel Postgres database
- Set environment variables
- Deploy
pnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
pnpm generate:types # Generate TypeScript types
pnpm lint # Run ESLint- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For questions or issues:
- Check the Payload CMS documentation
- Review the Next.js documentation
- Open an issue in the repository
Built with β€οΈ using Payload CMS and Next.js