# My E-Commerce Store

A full-stack e-commerce website with **Strapi** (backend) and **Next.js** (frontend).

## Quick Start

Open two terminal windows and run:

### Terminal 1 - Strapi Backend (port 1337)
```bash
cd /Users/saleem/Desktop/TEST/my-ecommerce
npm run develop
```

### Terminal 2 - Next.js Frontend (port 3000)
```bash
cd /Users/saleem/Desktop/TEST/my-ecommerce/frontend
npm run dev
```

## Access URLs

| Service | URL |
|---------|-----|
| Frontend Store | http://localhost:3000 |
| Products Page | http://localhost:3000/products |
| Strapi Admin | http://localhost:1337/admin |

## First-Time Admin Setup

1. Go to http://localhost:1337/admin
2. Create your admin account (email/password)
3. After login, you'll see the Strapi dashboard

## Adding Products

1. In Strapi admin, find **Products** in the sidebar (under Content Manager)
2. Click **Create new entry**
3. Fill in product details:
   - Name
   - Description
   - Price
   - Upload an image
4. Click **Save** and **Publish**

The product will immediately appear on your Next.js store at http://localhost:3000/products

## Project Structure

```
my-ecommerce/
├── src/                  # Strapi backend source
│   ├── api/              # API routes
│   ├── components/       # Strapi components
│   └── admin/            # Admin panel code
├── frontend/             # Next.js frontend
│   ├── src/
│   │   ├── app/          # Next.js App Router pages
│   │   ├── components/   # React components
│   │   └── lib/          # API utilities
│   └── next.config.ts    # Proxy config
├── config/               # Strapi config
├── package.json          # Backend dependencies
└── start.sh              # Quick start script
```

## How the Proxy Works

The Next.js frontend is configured to proxy API requests:
- `/api/*` → `http://localhost:1337/api/*`
- `/admin/*` → `http://localhost:1337/admin/*`

This lets you access the Strapi admin at http://localhost:3000/admin

## Troubleshooting

- If products don't appear, make sure you've published them in Strapi
- Clear the browser cache after adding new products
- Restart both servers if you make config changes