# QUICK START GUIDE - Get Running in 5 Minutes

## 🚀 Follow These Steps Exactly

### Step 1: Create the Database (2 minutes)

```bash
cd src/PowderCoating.Web

# Create the migration
dotnet ef migrations add InitialCreate --project ../PowderCoating.Infrastructure

# Create the database
dotnet ef database update --project ../PowderCoating.Infrastructure
```

**Expected Output:**
```
Build succeeded.
Applying migration '20250204_InitialCreate'.
Done.
```

✅ **Success!** The database is now created with all tables and seed data.

---

### Step 2: Run the Application (1 minute)

```bash
# Still in src/PowderCoating.Web
dotnet run
```

**Expected Output:**
```
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:7001
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
```

✅ **Success!** The app is running!

---

### Step 3: Open in Browser (30 seconds)

1. Open your browser
2. Navigate to: **https://localhost:7001**
3. You should see the home page

---

### Step 4: Login (1 minute)

1. Click **"Login"** in the top right
2. Use these credentials:
   - **Email:** `admin@powdercoating.com`
   - **Password:** `Admin123!`

✅ **Success!** You're logged in as administrator!

---

## ✅ You're Done!

The application is now running. Next steps:

1. **Change the admin password** (important!)
2. **Start building features** - See `NEXT_STEPS.md`
3. **Create your first customer** - Follow the guide in NEXT_STEPS.md

---

## 🐛 Troubleshooting

### Problem: "dotnet ef command not found"

**Fix:**
```bash
dotnet tool install --global dotnet-ef
```

### Problem: App hangs when starting

**Cause:** SQL Server isn't running or connection failed.

**Fix:**
1. Make sure SQL Express is running
2. Or switch to LocalDB (see `TROUBLESHOOTING_STARTUP.md`)

### Problem: "Database already exists" error

**Fix:**
```bash
# Drop the database and start over
dotnet ef database drop --project ../PowderCoating.Infrastructure
dotnet ef database update --project ../PowderCoating.Infrastructure
```

### Problem: Can't connect to database

**Try LocalDB instead:**

Edit `appsettings.json` and change connection string to:
```json
"Server=(localdb)\\mssqllocaldb;Database=PowderCoatingDb;Trusted_Connection=true;MultipleActiveResultSets=true"
```

---

## 📋 Complete Command Reference

**Create Database:**
```bash
cd src/PowderCoating.Web
dotnet ef migrations add InitialCreate --project ../PowderCoating.Infrastructure
dotnet ef database update --project ../PowderCoating.Infrastructure
```

**Run Web App:**
```bash
cd src/PowderCoating.Web
dotnet run
```

**Run API (Optional):**
```bash
cd src/PowderCoating.Api
dotnet run
```

**Run with Auto-Reload:**
```bash
dotnet watch run
```

**Stop the App:**
Press `Ctrl + C` in the terminal

---

## 🎯 Default Credentials

**Admin User:**
- Email: `admin@powdercoating.com`
- Password: `Admin123!`

**⚠️ IMPORTANT:** Change this password after first login!

---

## 📖 More Help

- **Startup Issues:** See `TROUBLESHOOTING_STARTUP.md`
- **Next Features:** See `NEXT_STEPS.md`
- **Development Guide:** See `DEVELOPMENT.md`
- **Full README:** See `README.md`

---

## ✅ Quick Verification

Run these to verify everything is working:

```bash
# 1. Check database was created
dotnet ef database update --project src/PowderCoating.Infrastructure --startup-project src/PowderCoating.Web

# 2. Build the solution
dotnet build

# 3. Run the app
cd src/PowderCoating.Web
dotnet run

# 4. Open browser to https://localhost:7001

# 5. Login with admin@powdercoating.com / Admin123!
```

If all of these work, you're ready to start building! 🎉
