68 lines
1.5 KiB
Markdown
68 lines
1.5 KiB
Markdown
# 420Deals.ch
|
||
|
||
A premium collective buying platform for CBD in Switzerland.
|
||
|
||
## Setup
|
||
|
||
### Database
|
||
|
||
1. Create the database using the provided SQL file:
|
||
```bash
|
||
mysql -u root -p < cbd420.sql
|
||
```
|
||
|
||
2. Run the migration to add image support (optional but recommended):
|
||
```bash
|
||
mysql -u root -p cbd420 < migrations/add_image_url.sql
|
||
```
|
||
|
||
3. Create a `.env.local` file in the root directory:
|
||
```env
|
||
DB_HOST=localhost
|
||
DB_PORT=3306
|
||
DB_USER=root
|
||
DB_PASSWORD=your_password
|
||
DB_NAME=cbd420
|
||
```
|
||
|
||
### Installation
|
||
|
||
```bash
|
||
npm install
|
||
```
|
||
|
||
### Development
|
||
|
||
```bash
|
||
npm run dev
|
||
```
|
||
|
||
Visit [http://localhost:3000](http://localhost:3000) for the main site and [http://localhost:3000/admin](http://localhost:3000/admin) for the admin panel.
|
||
|
||
## Admin Panel
|
||
|
||
Access the admin panel at `/admin` to:
|
||
- Create new drops
|
||
- View all drops
|
||
- Monitor drop progress and sold out status
|
||
|
||
### Creating a Drop
|
||
|
||
1. Navigate to `/admin`
|
||
2. Fill in the form:
|
||
- **Product Name**: e.g., "Harlequin – Collective Drop"
|
||
- **Batch Size**: Total amount (e.g., 1000)
|
||
- **Unit**: Custom unit (e.g., g, kg, ml, etc.)
|
||
- **Price Per Gram**: Price in CHF (e.g., 2.50)
|
||
- **Product Image**: Optional product image upload (JPEG, PNG, WebP, max 5MB)
|
||
3. Click "Create Drop"
|
||
|
||
## Project Structure
|
||
|
||
- `app/` - Next.js app directory
|
||
- `api/drops/` - API routes for drop management
|
||
- `admin/` - Admin panel page
|
||
- `components/` - React components
|
||
- `lib/db.ts` - Database connection pool
|
||
- `cbd420.sql` - Database schema
|