# Bangstack Examples

This directory contains comprehensive examples demonstrating Bangstack's capabilities across different application complexities.

## 📁 Directory Structure

```
examples/
├── demo-bang.yaml                    # Simple demo using auth template
├── stress-tests/                     # Applications from simple to enterprise
│   ├── STRESS-TEST-REPORT.md        # Analysis of all stress tests
│   ├── 1-minimal/                   # Landing page (simplest)
│   ├── 2-simple/                    # Blog + CMS
│   ├── 3-medium/                    # SaaS app with auth/payments
│   ├── 4-complex/                   # Multi-tenant e-learning platform
│   ├── 5-enterprise/                # FinTech with microservices
│   └── 6-monorepo/                  # Multi-product platform
│
└── templates/                        # Reusable workflow templates
    └── auth-clerk-template/         # Example auth template package
```

## 🎯 Stress Tests Overview

The stress tests demonstrate Bangstack's ability to represent applications of any complexity:

| Level | Name | Complexity | Services | Databases | Use Case |
|-------|------|-----------|----------|-----------|----------|
| 1 | Minimal | Simple | 1 | 0 | Static landing page |
| 2 | Simple | Basic | 3 | 1 | Blog with CMS |
| 3 | Medium | Moderate | 5 | 2 | SaaS application |
| 4 | Complex | High | 12 | 10 | E-learning platform |
| 5 | Enterprise | Very High | 20+ | 11 | FinTech system |
| 6 | Monorepo | Very High | 30+ | 1 (multi-schema) | Multi-product platform |

## 🚀 Quick Start

### Try a Stress Test

```bash
# Generate from a stress test
bangstack generate docs/examples/stress-tests/3-medium/saas-app.bang.yaml --output my-saas-app

# Run the generated app
cd my-saas-app
npm install
npm run dev
```

### Use a Template

```bash
# Install a template package
npm install @bangstack/auth-clerk

# Reference it in your workflow
# See demo-bang.yaml for example
```

## 📚 Learn More

- **[Stress Test Report](stress-tests/STRESS-TEST-REPORT.md)** - Detailed analysis of each test level
- **[Architecture Plans](../architecture/)** - Implementation guides for new features
- **[Tutorials](../tutorials/)** - Step-by-step guides

## 💡 Example Highlights

### Level 3: SaaS App (Medium Complexity)

Perfect starting point for most applications. Includes:
- ✅ Authentication (Clerk)
- ✅ Multiple frontends (marketing + app)
- ✅ Real-time features (WebSockets)
- ✅ Background jobs (BullMQ)
- ✅ RBAC permissions
- ✅ Multi-stage environments

**File**: `stress-tests/3-medium/saas-app.bang.yaml`

### Level 5: Enterprise FinTech

Demonstrates advanced patterns:
- ✅ 15+ microservices
- ✅ Event sourcing & CQRS
- ✅ Distributed transactions (saga pattern)
- ✅ PCI DSS compliance
- ✅ Field-level encryption
- ✅ Service mesh (Istio)
- ✅ Per-service databases

**File**: `stress-tests/5-enterprise/fintech-microservices.bang.yaml`

### Template: Auth with Clerk

Reusable authentication template showing:
- ✅ User models
- ✅ Signup/login workflows
- ✅ React components
- ✅ Authentication events
- ✅ npm package structure

**Directory**: `templates/auth-clerk-template/`

## 🔧 Contributing Examples

Have an interesting use case? Add it to the stress tests:

1. Choose appropriate complexity level (or create new one)
2. Create YAML configuration
3. Test with `bangstack generate`
4. Add description to STRESS-TEST-REPORT.md
5. Submit PR

## ❓ Questions?

- Check the [main documentation](../)
- Review the [stress test report](stress-tests/STRESS-TEST-REPORT.md)
- See [architecture plans](../architecture/) for upcoming features
