Skip to content

Commit ef7bae1

Browse files
committed
Add derail.me white-label integration
1 parent b257d40 commit ef7bae1

File tree

7 files changed

+842
-92
lines changed

7 files changed

+842
-92
lines changed

DERAIL-INTEGRATION.md

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
# Derail.me Integration Guide
2+
3+
## Overview
4+
5+
ChittyPro Streamlink has been successfully white-labeled and integrated into the derail.me platform as a camera surveillance module. This integration provides professional camera management capabilities within the derail.me ecosystem.
6+
7+
## White-Label Configuration
8+
9+
### Brand Colors
10+
The system now uses derail.me's brand palette:
11+
- **Primary (Charcoal)**: `#2d3436` - Main UI elements, text
12+
- **Accent (Electric Teal)**: `#00d9ff` - Interactive elements, highlights
13+
- **Background (Cream)**: `#f8f7f4` - Page backgrounds
14+
- **Surface (Sand)**: `#e8dcc4` - Card backgrounds, elevated surfaces
15+
16+
### Branding
17+
- **Name**: "Derail Camera System"
18+
- **Short Name**: "Derail Cameras"
19+
- **Tagline**: "Professional Surveillance, Simplified"
20+
- **Footer**: "© 2025 Derail.me. All rights reserved."
21+
- **ChittyPro branding**: Hidden (as per white-label config)
22+
23+
### Enabled Features
24+
Per derail.me requirements, the following features are configured:
25+
- ✅ Multi-camera grid layout
26+
- ✅ PTZ controls
27+
- ✅ Guest access management
28+
- ✅ Recording capabilities
29+
- ❌ Chat system (disabled)
30+
- ❌ Analytics (disabled)
31+
- ❌ AI features (disabled)
32+
33+
## Technical Implementation
34+
35+
### 1. White-Label System
36+
**Location**: `client/src/hooks/use-whitelabel.ts`
37+
38+
```typescript
39+
// Loads configuration from /config/whitelabel-derail.json
40+
const { config, loading } = useWhitelabel();
41+
42+
// Dynamically applies theme colors via CSS variables
43+
// Updates document title and favicon
44+
// Feature flags control UI elements
45+
```
46+
47+
**Config File**: `config/whitelabel-derail.json`
48+
- Contains all branding, theme, and feature settings
49+
- Served via API endpoint: `GET /config/whitelabel-derail.json`
50+
51+
### 2. CSS Theme Integration
52+
**Location**: `client/src/index.css`
53+
54+
All colors now use CSS variables that are dynamically set by the white-label system:
55+
```css
56+
:root {
57+
--background: 32, 8%, 96%; /* Cream */
58+
--foreground: 195, 7%, 21%; /* Charcoal */
59+
--accent: 190, 100%, 50%; /* Electric Teal */
60+
--surface: 39, 28%, 85%; /* Sand */
61+
/* ... */
62+
}
63+
```
64+
65+
### 3. UI Components Updated
66+
**Camera Dashboard** (`client/src/pages/camera-dashboard.tsx`):
67+
- Displays dynamic branding from config
68+
- Shows/hides features based on white-label settings
69+
- Uses theme variables for all styling
70+
- No inline styles (all CSS variable-based)
71+
72+
**Feature Conditional Rendering**:
73+
```tsx
74+
{config.features.guestAccess && <ShareButton />}
75+
{config.features.multiCamera && <LayoutButton />}
76+
{config.features.chat && <Sidebar />}
77+
```
78+
79+
### 4. Server Integration
80+
**ChittyPro Streamlink Server** (Port 3001):
81+
- Serves white-label config at `/config/whitelabel-derail.json`
82+
- All camera APIs available at `/api/cameras`
83+
- WebSocket for real-time features at `/ws`
84+
85+
**Derail.me Server Integration** (`/Users/nb/.claude/projects/-/derail-me/src/server/index.js`):
86+
- Camera routes registered at `/api/cameras`
87+
- Proxy to ChittyPro service at `http://localhost:3001`
88+
89+
**Camera Routes** (`/Users/nb/.claude/projects/-/derail-me/src/server/routes/cameras.js`):
90+
```javascript
91+
// Proxies all requests to ChittyPro Streamlink
92+
const CAMERA_SERVICE_URL = "http://localhost:3001";
93+
router.get("/", async (req, res) => {
94+
const response = await fetch(`${CAMERA_SERVICE_URL}/api/cameras`);
95+
res.json(await response.json());
96+
});
97+
```
98+
99+
## Deployment Configuration
100+
101+
### Environment Variables
102+
**ChittyPro Streamlink** (`.env`):
103+
```bash
104+
PORT=3001
105+
NODE_ENV=production
106+
DATABASE_URL=postgresql://...
107+
```
108+
109+
**Derail.me** (`.env`):
110+
```bash
111+
CAMERA_SERVICE_URL=http://localhost:3001
112+
PORT=3000
113+
```
114+
115+
### Nginx Configuration
116+
The white-label config includes nginx routing:
117+
```json
118+
"deployment": {
119+
"type": "module",
120+
"port": 3001,
121+
"nginx": {
122+
"locationPath": "/cameras",
123+
"apiPath": "/api/cameras",
124+
"wsPath": "/ws/cameras"
125+
}
126+
}
127+
```
128+
129+
Suggested nginx config:
130+
```nginx
131+
# Camera UI
132+
location /cameras {
133+
proxy_pass http://localhost:3001;
134+
proxy_http_version 1.1;
135+
proxy_set_header Upgrade $http_upgrade;
136+
proxy_set_header Connection 'upgrade';
137+
proxy_set_header Host $host;
138+
proxy_cache_bypass $http_upgrade;
139+
}
140+
141+
# Camera API (via derail.me server)
142+
location /api/cameras {
143+
proxy_pass http://localhost:3000/api/cameras;
144+
}
145+
146+
# Camera WebSocket
147+
location /ws/cameras {
148+
proxy_pass http://localhost:3001/ws;
149+
proxy_http_version 1.1;
150+
proxy_set_header Upgrade $http_upgrade;
151+
proxy_set_header Connection "Upgrade";
152+
}
153+
```
154+
155+
## File Structure
156+
157+
```
158+
chittypro-streamlink/
159+
├── config/
160+
│ └── whitelabel-derail.json # White-label configuration
161+
├── client/src/
162+
│ ├── hooks/
163+
│ │ └── use-whitelabel.ts # White-label hook
164+
│ ├── pages/
165+
│ │ └── camera-dashboard.tsx # Updated with branding
166+
│ └── index.css # Theme colors
167+
├── server/
168+
│ └── routes.ts # Config endpoint added
169+
└── DERAIL-INTEGRATION.md # This file
170+
171+
derail-me/
172+
└── src/server/
173+
├── index.js # Camera routes registered
174+
└── routes/
175+
└── cameras.js # Camera API proxy
176+
```
177+
178+
## Running the Integration
179+
180+
### Development
181+
```bash
182+
# Terminal 1: ChittyPro Streamlink
183+
cd /Users/nb/.claude/projects/-/CHITTYAPPS/chittypro-streamlink
184+
PORT=3001 npm run dev
185+
186+
# Terminal 2: Derail.me
187+
cd /Users/nb/.claude/projects/-/derail-me
188+
npm run dev
189+
```
190+
191+
Access:
192+
- Camera System: `http://localhost:3001`
193+
- Derail.me with Cameras: `http://localhost:3000/cameras`
194+
195+
### Production
196+
```bash
197+
# Build ChittyPro Streamlink
198+
npm run build
199+
npm run start # Runs on PORT=3001
200+
201+
# Build Derail.me
202+
npm run build
203+
npm run start # Runs on PORT=3000
204+
```
205+
206+
## API Endpoints
207+
208+
### ChittyPro Streamlink (Port 3001)
209+
- `GET /config/whitelabel-derail.json` - White-label configuration
210+
- `GET /api/cameras` - List all cameras
211+
- `GET /api/cameras/:id` - Get camera details
212+
- `POST /api/cameras` - Add new camera
213+
- `PATCH /api/cameras/:id/ptz` - PTZ control
214+
- `GET /api/recording-requests` - Recording requests
215+
- `WS /ws` - WebSocket for real-time updates
216+
217+
### Derail.me Integration (Port 3000)
218+
- `GET /api/cameras` - Proxied to ChittyPro (port 3001)
219+
- `GET /api/cameras/:id` - Proxied camera details
220+
- All other camera routes proxied through
221+
222+
## Testing Checklist
223+
224+
- [x] White-label configuration loads correctly
225+
- [x] Derail.me brand colors applied throughout UI
226+
- [x] "Derail Camera System" displays in header
227+
- [x] Chat sidebar hidden (per config)
228+
- [x] Custom footer shows "© 2025 Derail.me..."
229+
- [x] Camera API endpoints functional
230+
- [x] Server integration complete
231+
- [ ] WebSocket streaming working
232+
- [ ] PTZ controls functional
233+
- [ ] Guest access working
234+
- [ ] Recording requests working
235+
236+
## Customization
237+
238+
To modify derail.me branding:
239+
1. Edit `config/whitelabel-derail.json`
240+
2. Update colors, features, or branding text
241+
3. Restart the server
242+
4. Changes apply immediately via white-label hook
243+
244+
## Next Steps
245+
246+
1. **Asset Creation**: Add derail.me logo and favicon
247+
- Logo: `/assets/derail-logo.svg` (180x40px)
248+
- Favicon: `/assets/derail-favicon.ico`
249+
250+
2. **Production Deployment**:
251+
- Configure nginx reverse proxy
252+
- Set up SSL certificates
253+
- Configure environment variables
254+
- Set up process manager (PM2)
255+
256+
3. **Feature Integration**:
257+
- Integrate with derail.me authentication
258+
- Connect to derail.me user system
259+
- Add derail.me-specific camera features
260+
261+
4. **Testing**:
262+
- End-to-end camera streaming
263+
- PTZ control validation
264+
- Guest access workflow
265+
- Recording request workflow
266+
267+
## Support
268+
269+
For issues or questions:
270+
- ChittyPro Streamlink: `/Users/nb/.claude/projects/-/CHITTYAPPS/chittypro-streamlink/CLAUDE.md`
271+
- Derail.me: `/Users/nb/.claude/projects/-/derail-me/CREATIVE_BRIEF.md`
272+
- Integration: This document
273+
274+
---
275+
276+
**Last Updated**: October 3, 2025
277+
**Integration Status**: ✅ Complete - Branding & UI
278+
**Deployment Status**: 🟡 Development - Ready for Production Setup

0 commit comments

Comments
 (0)