Spaces:
Sleeping
Sleeping
File size: 5,550 Bytes
c1ba75f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# API Documentation
This folder contains frontend development guides for the SwiftOps platform.
---
## π Available Guides
### 1. Platform Admin Frontend Guide
**File:** `PLATFORM_ADMIN_FRONTEND_GUIDE.md`
**Purpose:** Comprehensive guide for building platform admin frontend
**Audience:** Frontend developers
**Contents:**
- Complete API reference
- Dashboard & analytics implementation
- Organization management (clients & contractors)
- User management
- System monitoring
- Audit logs
- UI/UX recommendations
- Error handling patterns
- Code examples
**When to use:** Reference this when building any platform admin feature
---
### 2. Platform Admin Quick Reference
**File:** `PLATFORM_ADMIN_QUICK_REFERENCE.md`
**Purpose:** Quick reference for common tasks
**Audience:** Frontend developers who need fast answers
**Contents:**
- Essential API endpoints
- Quick request/response examples
- Form validations
- Error handling
- Common patterns
- Testing credentials
**When to use:** Quick lookups during development
---
## π Getting Started
### Step 1: Authentication
1. Implement login page
2. Setup token storage
3. Create API service layer
### Step 2: Dashboard
1. Create layout with navigation
2. Add statistics cards
3. Implement recent activity feed
### Step 3: Organizations
1. Build clients management pages
2. Build contractors management pages
3. Add create/edit forms
### Step 4: Users & Monitoring
1. Build users list and management
2. Add audit logs page
3. Implement exports
---
## π Related Documentation
### Backend Documentation
- **Organizations API:** `/docs/dev/ORGANIZATIONS_API_GUIDE.md`
- **Auth API:** `/docs/dev/AUTH_API_GUIDE.md`
- **User Management:** `/docs/USER_MANAGEMENT_IMPLEMENTATION.md`
- **Audit Logging:** `/docs/agent/PASSWORD_RESET_COMPLETE.md`
### API Documentation
- **Interactive Docs:** `http://localhost:8000/api/docs` (Swagger UI)
- **Alternative Docs:** `http://localhost:8000/api/redoc` (ReDoc)
- **Health Check:** `http://localhost:8000/health`
---
## π οΈ Development Environment
### Backend Setup
```bash
# Start backend server
cd d:\atomio\swiftops-backend
python -m uvicorn app.main:app --reload --port 8000
```
### API Testing
```bash
# Test with cURL
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@swiftops.com","password":"your-password"}'
```
### Environment Variables
```bash
# Backend .env
PLATFORM_ADMIN_EMAIL=admin@swiftops.com
RESEND_API_KEY=re_xxxxxxxxxxxxx
DATABASE_URL=postgresql://...
SUPABASE_URL=https://...
SUPABASE_KEY=...
```
---
## π Implementation Checklist
### Core Features
- [ ] Authentication (login, registration, logout)
- [ ] Dashboard with statistics
- [ ] Clients management (CRUD)
- [ ] Contractors management (CRUD)
- [ ] Users management
- [ ] User invitations
- [ ] Audit logs viewing
- [ ] Data export functionality
### UI/UX
- [ ] Responsive design (mobile, tablet, desktop)
- [ ] Loading states
- [ ] Error handling
- [ ] Success notifications
- [ ] Confirmation dialogs
- [ ] Pagination
- [ ] Search/filtering
- [ ] Sorting
### Quality
- [ ] Unit tests
- [ ] Integration tests
- [ ] Accessibility (WCAG 2.1)
- [ ] Performance optimization
- [ ] Code documentation
- [ ] API error handling
---
## π¨ Design System
### Colors
- **Primary:** `#2563eb` (Blue)
- **Success:** `#10b981` (Green)
- **Warning:** `#f59e0b` (Amber)
- **Danger:** `#ef4444` (Red)
- **Info:** `#3b82f6` (Blue)
- **Platform Admin:** `#8b5cf6` (Purple)
### Typography
- **Font:** Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto
- **Heading 1:** 32px, 700 weight
- **Heading 2:** 24px, 600 weight
- **Heading 3:** 18px, 600 weight
- **Body:** 14px, 400 weight
### Spacing
- **xs:** 4px
- **sm:** 8px
- **md:** 16px
- **lg:** 24px
- **xl:** 32px
- **2xl:** 48px
---
## π Common Issues
### Issue: 401 Unauthorized
**Solution:** Token expired. Implement token refresh or redirect to login.
### Issue: CORS errors
**Solution:** Backend CORS is configured. Check if you're using correct API URL.
### Issue: 409 Conflict (duplicate email/name)
**Solution:** Show validation error. Email/name must be unique.
### Issue: Slow page loads
**Solution:** Implement pagination, lazy loading, and caching.
---
## π Support
### Questions?
- **Backend Team:** Check `/docs` folder for implementation details
- **API Issues:** Review `http://localhost:8000/api/docs`
- **Bug Reports:** Check audit logs for detailed error traces
### Useful Commands
```bash
# View recent audit logs
curl http://localhost:8000/api/v1/audit-logs?limit=20 \
-H "Authorization: Bearer {token}"
# Test client creation
curl -X POST http://localhost:8000/api/v1/clients \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"name":"Test Client","main_email":"test@example.com"}'
# Check health
curl http://localhost:8000/health
```
---
## π Contributing
When adding new documentation:
1. **Name files clearly:** Use `FEATURE_NAME_GUIDE.md` or `FEATURE_NAME_REFERENCE.md`
2. **Include examples:** Always provide request/response examples
3. **Add to README:** Update this file with new documentation
4. **Keep it updated:** Update docs when API changes
---
## π API Versioning
Current version: **v1**
Base URL: `/api/v1`
All endpoints are prefixed with `/api/v1`. When v2 is released, v1 will continue to work for backward compatibility.
---
**Last Updated:** November 17, 2025
**Maintained By:** SwiftOps Backend Team
|