You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**search**| Semantic search with CLIP text encoder | Medium (torch, transformers) |
17
+
|**processing**| Video processing, embedding generation | Heavy (ffmpeg, opencv, torch, transformers) |
18
+
19
+
This architecture ensures that lightweight API calls (health, status, list) don't need to load heavy ML models.
20
+
21
+
### Local Development (dev)
22
+
23
+
Single combined Modal app (`dev_combined.py`) with all three services:
24
+
25
+
| App | Purpose |
26
+
|-----|---------|
27
+
|**dev-combined**| Server + Search + Processing in one app |
28
+
This allows hot-reload on all services without cross-app lookup issues. Cold start time is acceptable for local development where iteration speed matters more than cold start performance.
4
29
5
30
## Quick Start
6
31
@@ -11,34 +36,58 @@ uv sync
11
36
# 2. Authenticate with Modal (first time only - opens browser)
12
37
uv run modal token new
13
38
14
-
# 3. Configure Modal secrets (dev and prod)
15
-
modal secret create dev \
16
-
ENVIRONMENT=dev \
17
-
PINECONE_API_KEY=your_pinecone_api_key \
18
-
R2_ACCOUNT_ID=your_r2_account_id \
19
-
R2_ACCESS_KEY_ID=your_r2_access_key_id \
20
-
R2_SECRET_ACCESS_KEY=your_r2_secret_access_key
21
-
22
-
modal secret create prod \
23
-
ENVIRONMENT=prod \
24
-
PINECONE_API_KEY=your_pinecone_api_key \
25
-
R2_ACCOUNT_ID=your_r2_account_id \
26
-
R2_ACCESS_KEY_ID=your_r2_access_key_id \
27
-
R2_SECRET_ACCESS_KEY=your_r2_secret_access_key
28
-
29
-
# 4. Start dev server (hot-reloads on file changes, uses "dev" secret)
39
+
# 3. Start dev server
30
40
uv run dev
31
41
```
32
42
33
43
Note: `uv run` automatically uses the virtual environment - no need to activate it manually.
34
44
45
+
## Development CLI
46
+
47
+
### Local Development (Combined App)
48
+
49
+
For local development, use the combined app that includes all services in one:
50
+
51
+
| Command | Description |
52
+
|---------|-------------|
53
+
|`uv run dev`| Run combined dev app (server + search + processing in one) |
54
+
55
+
This uses `apps/dev_combined.py` which combines all three services into a single Modal app. Benefits:
56
+
- Hot-reload works on all services (server, search, processing)
57
+
- No cross-app lookup issues
58
+
- Easy to iterate on any part of the system
59
+
60
+
**Note:** Cold starts will be slower since all dependencies load together, but this is acceptable for local development where iteration speed matters more than cold start performance.
61
+
62
+
### Individual Apps (For Testing/Debugging)
63
+
64
+
You can also run individual apps if needed:
65
+
66
+
| Command | Description |
67
+
|---------|-------------|
68
+
|`uv run server`| Run just the API server |
69
+
|`uv run search`| Run just the search app |
70
+
|`uv run processing`| Run just the processing app |
71
+
72
+
73
+
**Note:** Cross-app communication only works between deployed apps, not ephemeral serve apps. For full system testing, use `uv run dev` (combined app) or deploy the apps.
74
+
35
75
## How It Works
36
76
37
-
-`main.py` defines a Modal App with a `Server` class
38
-
-`/upload` endpoint accepts video files and spawns background processing jobs
77
+
### Production Architecture (staging/prod)
78
+
79
+
-`apps/server.py` - API gateway, delegates heavy work to other apps via `modal.Cls.from_name()`
80
+
-`apps/search_app.py` - Handles semantic search queries with CLIP text encoder
81
+
-`apps/processing_app.py` - Processes video uploads (chunking, embedding, storage)
82
+
- Cross-app communication uses Modal's `Cls.from_name()` for lookups and `spawn()`/`remote()` for calls
39
83
- Environment variables stored in Modal secrets (no .env files needed)
40
-
-`uv run dev` automatically uses "dev" secret for development
41
-
- Production deployment handled via CI/CD or direct Modal CLI
84
+
85
+
### Local Development Architecture (dev)
86
+
87
+
-`apps/dev_combined.py` - All three services in one app for easy iteration
88
+
- Uses `api/fastapi_router.py` (configured for dev combined mode) which accepts worker class references instead of doing lookups
89
+
- No cross-app lookups needed - services call each other directly within the same app
90
+
- Hot-reload works on all services simultaneously
42
91
43
92
## Managing Dependencies
44
93
@@ -56,3 +105,13 @@ uv run pytest # Run all tests
56
105
uv run pytest -v # Verbose output
57
106
uv run pytest --cov # With coverage
58
107
```
108
+
109
+
Note: Some integration tests require `ffmpeg` to be installed locally.
110
+
111
+
## Deployment
112
+
113
+
Deployment is handled via GitHub Actions CI/CD. **Only the individual apps are deployed** (not dev_combined.py):
114
+
115
+
1.`processing_app.py` (heavy dependencies)
116
+
2.`search_app.py` (medium dependencies)
117
+
3.`server.py` (API gateway - depends on the other two)
0 commit comments