# 🏗️ System Architecture — [Project Name]
# Version 1.0

> **Status**: Draft  
> **Last Updated**: [Date]  
> **Author**: ADCS Architect Agent

---

## 1. Architecture Pattern

**Pattern**: [Monolith / Modular Monolith / Microservices / Serverless / Hybrid]

**Rationale**: [Why this pattern was chosen for this project]

---

## 2. System Diagram

```
[Client Layer]
     Browser / Mobile App / Desktop
          │
          ▼
[API Gateway / Load Balancer]
          │
    ┌─────┴─────┐
    │           │
[Service A] [Service B]
    │           │
    └─────┬─────┘
          │
    [Database Layer]
    ┌─────┴─────┐
    │           │
[Primary DB] [Cache]
```

*(Replace with actual architecture diagram using ASCII or Mermaid)*

---

## 3. Technology Stack

| Layer | Technology | Version | Purpose |
|-------|-----------|---------|---------|
| **Frontend** | [tech] | [ver] | [purpose] |
| **Backend** | [tech] | [ver] | [purpose] |
| **Database** | [tech] | [ver] | [purpose] |
| **Cache** | [tech] | [ver] | [purpose] |
| **Queue** | [tech] | [ver] | [purpose] |
| **Search** | [tech] | [ver] | [purpose] |
| **Storage** | [tech] | [ver] | [purpose] |
| **Auth** | [tech] | [ver] | [purpose] |

---

## 4. Database Schema Overview

```
[Table: users]
  - id (PK)
  - name
  - email (unique)
  - password (hashed)
  - role_id (FK → roles)
  - created_at / updated_at

[Table: roles]
  - id (PK)
  - name
  - permissions (JSON)
```

*(Expand with actual schema — full ERD in separate diagram file)*

---

## 5. API Contract Overview

| Method | Endpoint | Description | Auth |
|--------|----------|-------------|------|
| POST | `/api/auth/login` | User login | Public |
| POST | `/api/auth/logout` | User logout | Bearer Token |
| GET | `/api/[resource]` | List resources | Bearer Token |
| POST | `/api/[resource]` | Create resource | Bearer Token |
| PUT | `/api/[resource]/{id}` | Update resource | Bearer Token |
| DELETE | `/api/[resource]/{id}` | Delete resource | Bearer Token |

---

## 6. Security Architecture

| Concern | Solution |
|---------|---------|
| **Authentication** | [e.g., JWT / Session / OAuth2] |
| **Authorization** | [e.g., RBAC / ABAC / Policy-based] |
| **Data Encryption** | [e.g., TLS 1.3 in transit, AES-256 at rest] |
| **Input Validation** | [e.g., Server-side validation, sanitization] |
| **Rate Limiting** | [e.g., X req/min per IP] |
| **CORS Policy** | [e.g., Whitelist specific origins] |

---

## 7. Deployment Architecture

```
[Developer Machine]
       │ git push
       ▼
[CI/CD Pipeline] (GitHub Actions / GitLab CI / Jenkins)
       │
  ┌────┴────┐
  │ Staging │ ← auto-deploy on PR merge
  └────┬────┘
       │ manual approval
  ┌────▼──────┐
  │ Production│ ← tagged release
  └───────────┘
```

| Environment | URL | Server | Notes |
|-------------|-----|--------|-------|
| Development | localhost | Local | Developer machine |
| Staging | staging.[domain] | [Cloud provider] | QA testing |
| Production | [domain] | [Cloud provider] | Live users |

---

*Generated by ADCS v3.0 — Architect Agent*
