|
| 1 | +# Street Support Platform Documentation |
| 2 | + |
| 3 | +This directory contains comprehensive documentation for the Street Support Admin and API systems. |
| 4 | + |
| 5 | +## 📋 Documentation Index |
| 6 | + |
| 7 | +### Core Documentation |
| 8 | + |
| 9 | +| Document | Description | |
| 10 | +|----------|-------------| |
| 11 | +| [**Permissions System**](./PERMISSIONS.md) | Role-based access control, user creation, and authentication flow | |
| 12 | +| [**Sentry Setup**](./SENTRY.md) | Error monitoring, alerts configuration, and dashboard access | |
| 13 | +| [**Collection Schemas**](./COLLECTION_SCHEMAS.md) | MongoDB collection structures and field definitions | |
| 14 | +| [**Testing Guide**](./TESTING.md) | TDD methodology, test structure, and commands | |
| 15 | +| [**Deployment Guide**](./DEPLOYMENT.md) | CI/CD pipelines, environments, and deployment procedures | |
| 16 | +| [**Cron Jobs & SendGrid**](./CRON_JOBS_AND_SENDGRID.md) | Background jobs and email service configuration | |
| 17 | +| [**Validation (Zod)**](./VALIDATION.md) | Schema validation system for forms and API requests | |
| 18 | +| [**File Uploading**](./FILE_UPLOADING.md) | Azure Blob Storage integration and file handling | |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## 🏗️ Project Architecture |
| 23 | + |
| 24 | +### Three-Project Structure |
| 25 | + |
| 26 | +``` |
| 27 | +street-support-new/ |
| 28 | +├── streetsupport-platform-admin/ # Admin CMS (Next.js 15) |
| 29 | +├── streetsupport-platform-api/ # Backend API (Express.js) |
| 30 | +└── streetsupport-platform-web/ # Public Website (Next.js 15) |
| 31 | +``` |
| 32 | + |
| 33 | +### Technology Stack |
| 34 | + |
| 35 | +#### Admin (This Project) |
| 36 | +- **Framework**: Next.js 15.3.6 |
| 37 | +- **Language**: TypeScript 5 |
| 38 | +- **UI**: React 19.0.1, Tailwind CSS 4 |
| 39 | +- **Authentication**: NextAuth with Auth0 |
| 40 | +- **Deployment**: Vercel |
| 41 | + |
| 42 | +#### API |
| 43 | +- **Framework**: Express.js |
| 44 | +- **Language**: TypeScript |
| 45 | +- **Database**: MongoDB with Mongoose |
| 46 | +- **Authentication**: Auth0 JWT |
| 47 | +- **Deployment**: Azure Web Services |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## 🔐 Authentication Overview |
| 52 | + |
| 53 | +Both Admin and API use **Auth0** for authentication with a shared user database in MongoDB. |
| 54 | + |
| 55 | +**Flow**: |
| 56 | +1. User authenticates via Auth0 (Admin) |
| 57 | +2. NextAuth creates session with JWT token |
| 58 | +3. Token includes Auth0 access token |
| 59 | +4. Admin proxies API requests with Bearer token |
| 60 | +5. API validates token and checks user in MongoDB |
| 61 | +6. RBAC middleware enforces role-based access |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## 📂 Key Directories |
| 66 | + |
| 67 | +### Admin Project |
| 68 | +``` |
| 69 | +src/ |
| 70 | +├── app/ # Next.js App Router pages |
| 71 | +├── components/ # React components |
| 72 | +├── lib/ # Core utilities (auth, API) |
| 73 | +├── schemas/ # Zod validation schemas |
| 74 | +├── types/ # TypeScript interfaces |
| 75 | +├── constants/ # Role definitions, etc. |
| 76 | +└── tests/ # Jest test files |
| 77 | +``` |
| 78 | + |
| 79 | +### API Project |
| 80 | +``` |
| 81 | +src/ |
| 82 | +├── controllers/ # Request handlers |
| 83 | +├── middleware/ # Auth, upload middleware |
| 84 | +├── models/ # Mongoose models |
| 85 | +├── routes/ # Express routes |
| 86 | +├── schemas/ # Zod validation schemas |
| 87 | +├── services/ # Business logic (email, Auth0) |
| 88 | +├── jobs/ # Cron jobs |
| 89 | +└── types/ # TypeScript interfaces |
| 90 | +``` |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## 🔗 Related Resources |
| 95 | + |
| 96 | +- **GitHub Wiki**: Project-specific workarounds and guides |
| 97 | +- **Public Website Docs**: `streetsupport-platform-web/docs/` |
| 98 | +- **Design System**: `.windsurf/rules/` (buttons, typography, colors) |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## 📝 Documentation Standards |
| 103 | + |
| 104 | +### Naming Convention |
| 105 | +- MongoDB uses **PascalCase** for collections and properties |
| 106 | +- Admin and API use **PascalCase** for TypeScript interfaces |
| 107 | +- Web project uses **camelCase** for data transformation |
| 108 | + |
| 109 | +### File Format |
| 110 | +All documentation files use Markdown with: |
| 111 | +- Clear section headings |
| 112 | +- Code blocks with language identifiers |
| 113 | +- Tables for structured information |
| 114 | +- Emoji icons for visual navigation |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## ✅ Quick Reference |
| 119 | + |
| 120 | +### Common Commands |
| 121 | + |
| 122 | +```bash |
| 123 | +# Admin - Development |
| 124 | +npm run dev |
| 125 | + |
| 126 | +# Admin - Run tests |
| 127 | +npm run test |
| 128 | + |
| 129 | +# Admin - Run linting |
| 130 | +npm run lint |
| 131 | + |
| 132 | +# API - Development |
| 133 | +npm run dev |
| 134 | + |
| 135 | +# API - Run tests |
| 136 | +npm run test |
| 137 | + |
| 138 | +# API - Run linting |
| 139 | +npm run lint |
| 140 | +``` |
| 141 | + |
| 142 | +### Important Environment Variables |
| 143 | + |
| 144 | +| Variable | Project | Description | |
| 145 | +|----------|---------|-------------| |
| 146 | +| `AUTH0_CLIENT_ID` | Admin | Auth0 application client ID | |
| 147 | +| `AUTH0_DOMAIN` | API | Auth0 tenant domain | |
| 148 | +| `AZURE_STORAGE_CONNECTION_STRING` | API | Azure Blob Storage connection | |
| 149 | +| `SENDGRID_API_KEY` | API | SendGrid email service API key | |
| 150 | + |
| 151 | +See individual documentation files for complete environment variable lists. |
0 commit comments