# Build & Deployment

### Development Build
```bash
npm run build
```

### Production Build
```bash
ng build --configuration production
```

### Build Configuration
Configured in `angular.json`:

```json
{
  "configurations": {
    "production": {
      "fileReplacements": [{
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
      }],
      "optimization": true,
      "outputHashing": "all",
      "sourceMap": false,
      "namedChunks": false,
      "extractLicenses": true,
      "vendorChunk": false,
      "buildOptimizer": true,
      "budgets": [...]
    }
  }
}
```

### Environment Variables
Update environment files before building:

**Development** (`src/environments/environment.ts`):
```typescript
export const environment = {
  production: false,
  enableConsoleLogs: true
};
```

**Production** (`src/environments/environment.prod.ts`):
```typescript
export const environment = {
  production: true,
  enableConsoleLogs: false
};
```

### Deployment Options

#### 1. Static Hosting (Recommended)
Deploy to static hosting services:
- **Firebase Hosting**
- **Netlify**
- **Vercel**
- **AWS S3 + CloudFront**
- **GitHub Pages**

#### 2. Web Server
Deploy to traditional web servers:
- **Apache**
- **Nginx**
- **IIS**

**Important**: Configure server to redirect all routes to `index.html` for Angular routing to work.

#### Nginx Configuration Example:
```nginx
server {
  listen 80;
  server_name onmarket.id;
  root /var/www/onmarket/dist/sapp;
  index index.html;

  location / {
    try_files $uri $uri/ /index.html;
  }
}
```