@mevdragon/vidfarm-devcli 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +6 -39
- package/GETTING_STARTED.developers.md +178 -0
- package/README.md +62 -246
- package/SKILL.developer.md +127 -447
- package/dist/src/account-pages.js +57 -5
- package/dist/src/app.js +32 -22
- package/dist/src/config.js +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/services/storage.js +22 -0
- package/dist/templates/template_0000/src/template.js +1 -1
- package/package.json +4 -4
- package/templates/template_0000/README.md +7 -52
- package/templates/template_0000/SKILL.md +3 -3
- package/templates/template_0000/package.json +3 -5
- package/templates/template_0000/src/lib/images.js +242 -0
- package/templates/template_0000/src/remotion/index.js +3 -0
- package/templates/template_0000/src/sdk.js +3 -0
- package/templates/template_0000/src/template.js +1117 -0
- package/templates/template_0000/src/template.ts +1 -1
- package/templates/template_0000/template.config.json +6 -11
- package/AWS_REMOTION_HANDOFF.md +0 -311
- package/PLATFORM_SPEC.md +0 -1038
- package/dist/infra/cdk/bin/vidfarm-prod.js +0 -59
- package/dist/infra/cdk/lib/vidfarm-prod-stack.js +0 -212
- package/templates/template_0000/package-lock.json +0 -5137
- package/templates/template_0000/scripts/create-site.mjs +0 -27
- package/templates/template_0000/scripts/render-cloud.mjs +0 -72
package/.env.example
CHANGED
|
@@ -1,48 +1,15 @@
|
|
|
1
1
|
NODE_ENV="development"
|
|
2
2
|
PORT="3000"
|
|
3
3
|
|
|
4
|
-
VIDFARM_DB_PATH="./data/vidfarm.sqlite"
|
|
5
|
-
VIDFARM_DATA_DIR="./data"
|
|
6
|
-
|
|
7
|
-
ENCRYPTION_SECRET="replace-with-a-long-random-secret"
|
|
8
|
-
API_KEY_SALT="replace-with-a-second-long-random-secret"
|
|
9
|
-
WEBHOOK_SECRET="replace-with-a-third-long-random-secret"
|
|
10
|
-
|
|
11
|
-
WORKER_POLL_MS="1500"
|
|
12
|
-
WORKER_BATCH_SIZE="2"
|
|
13
|
-
WORKER_MAX_CONCURRENT_JOBS="1"
|
|
14
|
-
DEFAULT_JOB_DELAY_SECONDS="20"
|
|
15
|
-
MAX_PENDING_JOBS_GLOBAL="0"
|
|
16
|
-
MAX_PENDING_JOBS_PER_CUSTOMER="0"
|
|
17
|
-
|
|
18
|
-
PUBLIC_BASE_URL="https://vidfarm.cloud.zoomgtm.com"
|
|
19
|
-
VIDFARM_ADMIN_EMAILS="admin@example.com"
|
|
20
|
-
VIDFARM_DEVELOPER_EMAILS="developer@example.com"
|
|
21
|
-
TEMPLATE_SOURCE_ROOT="./data/template-sources"
|
|
22
|
-
STORAGE_DRIVER="local"
|
|
23
|
-
AWS_REGION="us-east-1"
|
|
24
|
-
AWS_S3_BUCKET=""
|
|
25
|
-
AWS_S3_PUBLIC_READ="false"
|
|
26
|
-
AWS_S3_ENDPOINT=""
|
|
27
|
-
AWS_ACCESS_KEY_ID=""
|
|
28
|
-
AWS_SECRET_ACCESS_KEY=""
|
|
29
|
-
|
|
30
|
-
RESEND_API_KEY=""
|
|
31
|
-
RESEND_FROM_EMAIL="noreply@example.com"
|
|
32
|
-
|
|
33
4
|
OPENAI_API_KEY=""
|
|
34
5
|
OPENROUTER_API_KEY=""
|
|
35
6
|
GEMINI_API_KEY=""
|
|
36
7
|
PERPLEXITY_API_KEY=""
|
|
37
8
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
REMOTION_SITE_NAME="vidfarm-template-0000"
|
|
42
|
-
REMOTION_SERVE_URL=""
|
|
43
|
-
REMOTION_COMPOSITION_ID="template-0000"
|
|
44
|
-
REMOTION_AWS_ACCESS_KEY_ID=""
|
|
45
|
-
REMOTION_AWS_SECRET_ACCESS_KEY=""
|
|
46
|
-
REMOTION_MODE="auto"
|
|
9
|
+
# Optional when calling a hosted Vidfarm API directly.
|
|
10
|
+
VIDFARM_USER_ID=""
|
|
11
|
+
VIDFARM_API_KEY=""
|
|
47
12
|
|
|
48
|
-
|
|
13
|
+
# Optional local overrides. The CLI will choose sensible local defaults.
|
|
14
|
+
PUBLIC_BASE_URL="http://localhost:3310"
|
|
15
|
+
REMOTION_MODE="local"
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Vidfarm Third-Party Developer Guide
|
|
2
|
+
|
|
3
|
+
This guide is for external developers building Vidfarm templates locally.
|
|
4
|
+
|
|
5
|
+
It covers:
|
|
6
|
+
|
|
7
|
+
- the local setup
|
|
8
|
+
- the template contract
|
|
9
|
+
- the local CLI workflow
|
|
10
|
+
- the minimum hosted-platform context you need
|
|
11
|
+
|
|
12
|
+
It does not cover platform internals, admin release flow, or cloud infrastructure.
|
|
13
|
+
|
|
14
|
+
## Local Setup
|
|
15
|
+
|
|
16
|
+
1. Create a working folder for your template project.
|
|
17
|
+
2. Install the CLI from npm.
|
|
18
|
+
3. Create a local `.env` from `.env.example`.
|
|
19
|
+
4. Add at least one AI provider key.
|
|
20
|
+
|
|
21
|
+
Typical `.env`:
|
|
22
|
+
|
|
23
|
+
```env
|
|
24
|
+
GEMINI_API_KEY=""
|
|
25
|
+
OPENAI_API_KEY=""
|
|
26
|
+
OPENROUTER_API_KEY=""
|
|
27
|
+
PERPLEXITY_API_KEY=""
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Start the local runtime:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This starts:
|
|
37
|
+
|
|
38
|
+
- the local Vidfarm API
|
|
39
|
+
- the local worker
|
|
40
|
+
- local SQLite state
|
|
41
|
+
- local filesystem-backed media storage
|
|
42
|
+
- local Remotion rendering when your template uses Remotion
|
|
43
|
+
|
|
44
|
+
## Local Session
|
|
45
|
+
|
|
46
|
+
Run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx @mevdragon/vidfarm-devcli session
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This prints a reusable local session so you can test the API with `curl` or your own scripts.
|
|
53
|
+
|
|
54
|
+
## Generate A Starter Template
|
|
55
|
+
|
|
56
|
+
To scaffold a new template:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx @mevdragon/vidfarm-devcli generate-template \
|
|
60
|
+
--slug-id template_0001 \
|
|
61
|
+
--template-dir ./templates/template_0001
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That scaffold includes:
|
|
65
|
+
|
|
66
|
+
- template source files
|
|
67
|
+
- a template-local `SKILL.md`
|
|
68
|
+
- `research/source_notes.md`
|
|
69
|
+
- `research/preview/`
|
|
70
|
+
- `src/template-dna.ts`
|
|
71
|
+
|
|
72
|
+
If preview media is present, the scaffold can also help generate `viral_dna` and `visual_dna`.
|
|
73
|
+
|
|
74
|
+
## Validate Your Template
|
|
75
|
+
|
|
76
|
+
Use the CLI before handing a template off:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx @mevdragon/vidfarm-devcli validate-template --template-id template_0000
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You should also run real local jobs for the operations you added and inspect the results.
|
|
83
|
+
|
|
84
|
+
## Template Contract
|
|
85
|
+
|
|
86
|
+
Vidfarm expects templates to fit a consistent contract.
|
|
87
|
+
|
|
88
|
+
Each template should define:
|
|
89
|
+
|
|
90
|
+
- `id`
|
|
91
|
+
- `slugId`
|
|
92
|
+
- `version`
|
|
93
|
+
- `about`
|
|
94
|
+
- `configSchema`
|
|
95
|
+
- `operations`
|
|
96
|
+
- `jobs`
|
|
97
|
+
|
|
98
|
+
The important idea is:
|
|
99
|
+
|
|
100
|
+
- `operations` are the public actions
|
|
101
|
+
- `jobs` do the actual work
|
|
102
|
+
- every meaningful action should fit the async job pattern
|
|
103
|
+
|
|
104
|
+
Each operation should include a `smokeTestPayload`.
|
|
105
|
+
|
|
106
|
+
Each template should also include:
|
|
107
|
+
|
|
108
|
+
- a template-local `SKILL.md`
|
|
109
|
+
- `about.viral_dna`
|
|
110
|
+
- `about.visual_dna`
|
|
111
|
+
- `about.preview_media`
|
|
112
|
+
- `about.link_to_original` when relevant
|
|
113
|
+
|
|
114
|
+
## How The Hosted Platform Uses Your Template
|
|
115
|
+
|
|
116
|
+
The hosted platform loads templates behind a standard wrapper.
|
|
117
|
+
|
|
118
|
+
From the caller's perspective, templates are used through routes like:
|
|
119
|
+
|
|
120
|
+
- `GET /api/v1/templates/:templateId`
|
|
121
|
+
- `GET /api/v1/templates/:templateId/skill`
|
|
122
|
+
- `POST /api/v1/templates/:templateId/config`
|
|
123
|
+
- `POST /api/v1/templates/:templateId/operations/:operationName`
|
|
124
|
+
- `GET /api/v1/templates/:templateId/jobs/:jobId`
|
|
125
|
+
- `GET /api/v1/templates/:templateId/jobs/:jobId/logs`
|
|
126
|
+
|
|
127
|
+
This means your template should focus on:
|
|
128
|
+
|
|
129
|
+
- clear metadata
|
|
130
|
+
- strong input schemas
|
|
131
|
+
- repeatable workflow logic
|
|
132
|
+
- useful job output
|
|
133
|
+
|
|
134
|
+
Avoid building custom standalone HTTP APIs inside the template.
|
|
135
|
+
|
|
136
|
+
## Review And Approval
|
|
137
|
+
|
|
138
|
+
Finishing a template locally does not make it live automatically.
|
|
139
|
+
|
|
140
|
+
The expected flow is:
|
|
141
|
+
|
|
142
|
+
1. build and validate the template locally
|
|
143
|
+
2. hand off the template source for review
|
|
144
|
+
3. wait for Vidfarm admin approval before the template is made available on the hosted platform
|
|
145
|
+
|
|
146
|
+
This is the key production boundary external developers need to understand. Your job is to produce a clean, repeatable template package that passes review.
|
|
147
|
+
|
|
148
|
+
## Hosted Auth Context
|
|
149
|
+
|
|
150
|
+
When you call a hosted Vidfarm API directly, authenticated requests use:
|
|
151
|
+
|
|
152
|
+
- `vidfarm-user-id`
|
|
153
|
+
- `vidfarm-api-key`
|
|
154
|
+
|
|
155
|
+
Those values come from Vidfarm user auth and settings.
|
|
156
|
+
|
|
157
|
+
For local development, the CLI session command handles this for you by printing a seeded local session.
|
|
158
|
+
|
|
159
|
+
## Remotion
|
|
160
|
+
|
|
161
|
+
For third-party template authors, Remotion is local-only in this workflow.
|
|
162
|
+
|
|
163
|
+
If your template uses Remotion:
|
|
164
|
+
|
|
165
|
+
- build it locally
|
|
166
|
+
- validate it locally
|
|
167
|
+
- keep the template code compatible with local CLI execution
|
|
168
|
+
|
|
169
|
+
You do not need shared cloud Remotion infrastructure details to author a template.
|
|
170
|
+
|
|
171
|
+
## Recommended Reading
|
|
172
|
+
|
|
173
|
+
Start with:
|
|
174
|
+
|
|
175
|
+
1. `README.md`
|
|
176
|
+
2. `SKILL.developer.md`
|
|
177
|
+
3. `templates/template_0000/SKILL.md`
|
|
178
|
+
4. `templates/template_0000/src/template.ts`
|
package/README.md
CHANGED
|
@@ -1,51 +1,28 @@
|
|
|
1
|
-
# Vidfarm
|
|
1
|
+
# Vidfarm Dev CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@mevdragon/vidfarm-devcli` is the local development toolkit for third-party Vidfarm template authors.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package is intentionally scoped to:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- building templates under `templates/*`
|
|
8
|
+
- running the local Vidfarm API and worker
|
|
9
|
+
- testing template operations as async jobs
|
|
10
|
+
- validating template metadata, skills, and smoke test payloads
|
|
11
|
+
- rendering Remotion locally when a template uses Remotion
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
- Async template API under `/api/v1/templates/:templateId/*`
|
|
11
|
-
- User auth/profile/provider-key routes under `/api/v1/user/*`
|
|
12
|
-
- Email OTP login with API key issuance
|
|
13
|
-
- `is_developer` user flag, assigned from allowlisted emails, required for template source submission
|
|
14
|
-
- Customer-scoped provider key vault with encryption at rest
|
|
15
|
-
- SQLite-backed job queue and provider-key lease coordination
|
|
16
|
-
- Structured job logs, artifacts, billing events, and webhook delivery queue
|
|
17
|
-
- Local storage mode plus S3-compatible mode for AWS
|
|
18
|
-
- Remotion adapter seam and a sample `template_0000` slideshow pipeline
|
|
13
|
+
It is intentionally not documentation for platform internals, production deployment, admin release flow, or shared cloud infrastructure.
|
|
19
14
|
|
|
20
15
|
## Quick Start
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
npm run dev
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
The service starts on `http://localhost:3000` by default and creates SQLite plus local artifact storage under `./data`.
|
|
29
|
-
|
|
30
|
-
## Template Developer CLI
|
|
31
|
-
|
|
32
|
-
For local template development, use the bundled CLI instead of manually wiring auth, provider keys, SQLite, and Remotion:
|
|
17
|
+
1. Create a local `.env` from the example file.
|
|
18
|
+
2. Add at least one AI provider key.
|
|
19
|
+
3. Start the local CLI runtime.
|
|
33
20
|
|
|
34
21
|
```bash
|
|
35
|
-
|
|
22
|
+
cp .env.example .env
|
|
36
23
|
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
37
24
|
```
|
|
38
25
|
|
|
39
|
-
What it does:
|
|
40
|
-
|
|
41
|
-
- starts the same REST API and in-process worker as production
|
|
42
|
-
- provisions a local SQLite database automatically
|
|
43
|
-
- uses local filesystem storage as an S3 stand-in
|
|
44
|
-
- seeds a dev customer and API key
|
|
45
|
-
- seeds provider keys from local `.env` variables like `OPENAI_API_KEY`, `GEMINI_API_KEY`, and `OPENROUTER_API_KEY`
|
|
46
|
-
- falls back to mock provider keys plus mocked AI responses when no env keys are present
|
|
47
|
-
- renders Remotion compositions locally instead of using Lambda
|
|
48
|
-
|
|
49
26
|
Useful commands:
|
|
50
27
|
|
|
51
28
|
```bash
|
|
@@ -57,244 +34,83 @@ npx @mevdragon/vidfarm-devcli analyze-viral-dna --template-dir ./templates/templ
|
|
|
57
34
|
npx @mevdragon/vidfarm-devcli analyze-visual-dna --template-dir ./templates/template_0001
|
|
58
35
|
```
|
|
59
36
|
|
|
60
|
-
After install, the package
|
|
61
|
-
|
|
62
|
-
`vidfarm session` prints reusable auth headers and a sample `curl` request for the local REST API.
|
|
63
|
-
|
|
64
|
-
`generate-template` now scaffolds a standard `research/` area for new templates:
|
|
65
|
-
|
|
66
|
-
- `research/source_notes.md` for original-format notes
|
|
67
|
-
- `research/preview/` for source screenshots or video
|
|
68
|
-
- `src/template-dna.ts` as the checked-in metadata module that feeds `about.viral_dna`, `about.visual_dna`, and `about.link_to_original`
|
|
69
|
-
|
|
70
|
-
If preview media is already present, or if you pass `--source-preview-dir`, scaffold generation will run both DNA analyzers automatically unless `--skip-dna-analysis` is set.
|
|
71
|
-
|
|
72
|
-
## Environment
|
|
73
|
-
|
|
74
|
-
Primary variables:
|
|
75
|
-
|
|
76
|
-
- `PORT`
|
|
77
|
-
- `VIDFARM_DB_PATH`
|
|
78
|
-
- `VIDFARM_DATA_DIR`
|
|
79
|
-
- `VIDFARM_ADMIN_EMAILS`
|
|
80
|
-
- `TEMPLATE_SOURCE_ROOT`
|
|
81
|
-
- `ENCRYPTION_SECRET`
|
|
82
|
-
- `API_KEY_SALT`
|
|
83
|
-
- `STORAGE_DRIVER=local|s3`
|
|
84
|
-
- `AWS_REGION`
|
|
85
|
-
- `AWS_S3_BUCKET`
|
|
86
|
-
- `AWS_S3_PUBLIC_READ=true|false`
|
|
87
|
-
- `PUBLIC_BASE_URL`
|
|
88
|
-
- `RESEND_API_KEY`
|
|
89
|
-
- `WEBHOOK_SECRET`
|
|
90
|
-
- `MOCK_PROVIDER_RESPONSES=true|false`
|
|
91
|
-
- `VIDFARM_DEVELOPER_EMAILS`
|
|
92
|
-
- `WORKER_MAX_CONCURRENT_JOBS`
|
|
93
|
-
- `MAX_PENDING_JOBS_GLOBAL`
|
|
94
|
-
- `MAX_PENDING_JOBS_PER_CUSTOMER`
|
|
95
|
-
|
|
96
|
-
Remotion-specific variables:
|
|
97
|
-
|
|
98
|
-
- `REMOTION_REGION`
|
|
99
|
-
- `REMOTION_FUNCTION_NAME`
|
|
100
|
-
- `REMOTION_BUCKET_NAME`
|
|
101
|
-
- `REMOTION_SITE_NAME`
|
|
102
|
-
- `REMOTION_SERVE_URL`
|
|
103
|
-
- `REMOTION_COMPOSITION_ID`
|
|
104
|
-
- `REMOTION_AWS_ACCESS_KEY_ID`
|
|
105
|
-
- `REMOTION_AWS_SECRET_ACCESS_KEY`
|
|
106
|
-
|
|
107
|
-
When `MOCK_PROVIDER_RESPONSES=true`, AI provider calls use the real key-leasing flow but return mocked content. This makes local end-to-end testing possible without burning customer API calls.
|
|
108
|
-
|
|
109
|
-
When using `npx @mevdragon/vidfarm-devcli dev`, the CLI automatically chooses local-friendly defaults:
|
|
110
|
-
|
|
111
|
-
- `STORAGE_DRIVER=local`
|
|
112
|
-
- `REMOTION_MODE=local`
|
|
113
|
-
- a local SQLite path under `.vidfarm/local`
|
|
114
|
-
- `MOCK_PROVIDER_RESPONSES=false` if real provider env keys are present, otherwise `true`
|
|
115
|
-
|
|
116
|
-
## Remotion AWS
|
|
117
|
-
|
|
118
|
-
For shared Remotion AWS infra, use [AWS_REMOTION_HANDOFF.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/AWS_REMOTION_HANDOFF.md) as the operating contract.
|
|
119
|
-
|
|
120
|
-
Shared Remotion AWS publish is an admin-only release step. Template developers may build and test locally, but they should not push directly to the shared production Remotion account. The intended promotion flow is:
|
|
121
|
-
|
|
122
|
-
1. developer pushes template code to GitHub `production`
|
|
123
|
-
2. admin reviews and pins a commit SHA
|
|
124
|
-
3. admin publishes the approved Remotion site bundle
|
|
125
|
-
4. admin activates the approved template release
|
|
126
|
-
5. admin rebuilds and redeploys the production Docker image
|
|
127
|
-
|
|
128
|
-
The key points verified on `2026-05-16` are:
|
|
129
|
-
|
|
130
|
-
- region: `us-east-1`
|
|
131
|
-
- shared Lambda function: `remotion-render-4-0-355-mem2048mb-disk2048mb-180sec`
|
|
132
|
-
- shared bucket: `remotionlambda-useast1-ujg7c0h43q`
|
|
133
|
-
- Remotion package version to pin: `4.0.355`
|
|
134
|
-
|
|
135
|
-
This repo also has separate Remotion AWS runner credentials available in local production env config via:
|
|
136
|
-
|
|
137
|
-
- `REMOTION_AWS_ACCESS_KEY_ID`
|
|
138
|
-
- `REMOTION_AWS_SECRET_ACCESS_KEY`
|
|
139
|
-
|
|
140
|
-
Use those for Remotion site publish/render work rather than assuming the generic app AWS credentials are the right identity.
|
|
141
|
-
|
|
142
|
-
Recommended repo-level config for real Remotion work:
|
|
143
|
-
|
|
144
|
-
```env
|
|
145
|
-
REMOTION_REGION=us-east-1
|
|
146
|
-
REMOTION_FUNCTION_NAME=remotion-render-4-0-355-mem2048mb-disk2048mb-180sec
|
|
147
|
-
REMOTION_BUCKET_NAME=remotionlambda-useast1-ujg7c0h43q
|
|
148
|
-
REMOTION_SITE_NAME=your-site-name
|
|
149
|
-
REMOTION_SERVE_URL=https://remotionlambda-useast1-ujg7c0h43q.s3.us-east-1.amazonaws.com/sites/your-site-name/index.html
|
|
150
|
-
REMOTION_COMPOSITION_ID=YourComposition
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
If you wire real Lambda rendering into `src/services/remotion.ts`, preserve the current platform contract and make the service read these env vars rather than hard-coding one-off values.
|
|
154
|
-
|
|
155
|
-
## API Flow
|
|
156
|
-
|
|
157
|
-
1. `POST /api/v1/user/request-otp`
|
|
158
|
-
2. `POST /api/v1/user/verify-otp`
|
|
159
|
-
3. `POST /api/v1/user/me/provider-keys`
|
|
160
|
-
4. `GET /api/v1/templates/template_0000`
|
|
161
|
-
5. `GET /api/v1/templates/template_0000/skill`
|
|
162
|
-
6. `POST /api/v1/templates/template_0000/config`
|
|
163
|
-
7. `POST /api/v1/templates/template_0000/operations/create_slideshow`
|
|
164
|
-
8. Poll `GET /api/v1/templates/template_0000/jobs/:jobId`
|
|
165
|
-
9. List or filter jobs with `GET /api/v1/templates/template_0000/jobs?tracer=...&start_time=...&end_time=...`
|
|
166
|
-
10. Stream timeline data from `GET /api/v1/templates/template_0000/jobs/:jobId/logs?start_time=...&end_time=...`
|
|
167
|
-
|
|
168
|
-
## Template Release Flow
|
|
37
|
+
After install, the package exposes both `vidfarm` and `vidfarm-devcli` as local binaries.
|
|
169
38
|
|
|
170
|
-
|
|
39
|
+
## What The Local CLI Does
|
|
171
40
|
|
|
172
|
-
|
|
173
|
-
2. the approved branch convention is `production`
|
|
174
|
-
3. admin registers the template source with repo URL, module path, build command, and `SKILL.md` path
|
|
175
|
-
4. admin imports a specific commit, or the current `production` head
|
|
176
|
-
5. platform builds the repo, loads the template module, and runs certification
|
|
177
|
-
6. only certified releases can be activated
|
|
178
|
-
7. activation pins the live template to a specific commit SHA, not a floating branch head
|
|
41
|
+
The local CLI runs the same template contract used by the hosted platform, but with local-first defaults:
|
|
179
42
|
|
|
180
|
-
|
|
43
|
+
- local SQLite state under `.vidfarm/local`
|
|
44
|
+
- local filesystem storage instead of cloud object storage
|
|
45
|
+
- local Remotion rendering
|
|
46
|
+
- a seeded developer session for local testing
|
|
47
|
+
- provider keys sourced from your local `.env`
|
|
48
|
+
- mocked provider responses only when no real provider keys are present
|
|
181
49
|
|
|
182
|
-
|
|
183
|
-
- `POST /api/v1/templates/sources`
|
|
184
|
-
- `GET /api/v1/templates/releases`
|
|
185
|
-
- `POST /api/v1/templates/sources/:sourceId/import`
|
|
186
|
-
- `POST /api/v1/templates/releases/:releaseId/activate`
|
|
50
|
+
Use `vidfarm session` to print reusable auth headers and a sample `curl` request for the local REST API.
|
|
187
51
|
|
|
188
|
-
|
|
52
|
+
## What The Hosted Platform Expects From Templates
|
|
189
53
|
|
|
190
|
-
|
|
54
|
+
Vidfarm treats templates as async job producers, not as ad hoc endpoints.
|
|
191
55
|
|
|
192
|
-
|
|
56
|
+
Each template should provide:
|
|
193
57
|
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
58
|
+
- stable template metadata
|
|
59
|
+
- a `SKILL.md` file for users and agents
|
|
60
|
+
- one or more named operations
|
|
61
|
+
- workflow functions behind those operations
|
|
198
62
|
- a `smokeTestPayload` for each operation
|
|
63
|
+
- `about.viral_dna` and `about.visual_dna`
|
|
199
64
|
|
|
200
|
-
|
|
65
|
+
At runtime, the platform uses the template wrapper to expose a consistent API shape:
|
|
201
66
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
67
|
+
- `GET /api/v1/templates/:templateId`
|
|
68
|
+
- `GET /api/v1/templates/:templateId/skill`
|
|
69
|
+
- `POST /api/v1/templates/:templateId/config`
|
|
70
|
+
- `POST /api/v1/templates/:templateId/operations/:operationName`
|
|
71
|
+
- `GET /api/v1/templates/:templateId/jobs/:jobId`
|
|
72
|
+
- `GET /api/v1/templates/:templateId/jobs/:jobId/logs`
|
|
205
73
|
|
|
206
|
-
|
|
74
|
+
Operations should return work through the job system rather than inventing one-off synchronous routes.
|
|
207
75
|
|
|
208
|
-
##
|
|
76
|
+
## Approval Flow
|
|
209
77
|
|
|
210
|
-
|
|
211
|
-
docker compose up --build
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
For local Docker, `docker-compose.yml` already mounts `./data:/app/data`, which keeps SQLite across container restarts and rebuilds on the same machine.
|
|
215
|
-
|
|
216
|
-
For production on EC2, the CDK stack mounts a dedicated EBS volume at `/var/lib/vidfarm` on the instance and binds it into the container as `/app/data`. That means the following survive shutdowns, reboots, and container updates:
|
|
78
|
+
Third-party developers build and validate templates locally first.
|
|
217
79
|
|
|
218
|
-
|
|
219
|
-
- SQLite WAL/SHM files
|
|
220
|
-
- imported template source checkouts
|
|
221
|
-
- any local fallback runtime data under `/app/data`
|
|
80
|
+
After handoff, a Vidfarm admin reviews the template before it is made available on the hosted platform. Template authors should assume there is an approval step between local development and production availability.
|
|
222
81
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
```env
|
|
226
|
-
STORAGE_DRIVER=s3
|
|
227
|
-
AWS_REGION=us-east-1
|
|
228
|
-
AWS_S3_BUCKET=your-vidfarm-bucket
|
|
229
|
-
AWS_S3_PUBLIC_READ=false
|
|
230
|
-
PUBLIC_BASE_URL=https://vidfarm.cloud.zoomgtm.com
|
|
231
|
-
```
|
|
82
|
+
## Authentication Context
|
|
232
83
|
|
|
233
|
-
|
|
84
|
+
When calling a hosted Vidfarm API directly, authenticated requests use:
|
|
234
85
|
|
|
235
|
-
- `
|
|
236
|
-
- `
|
|
237
|
-
- `MAX_PENDING_JOBS_GLOBAL=0` by default
|
|
238
|
-
- `MAX_PENDING_JOBS_PER_CUSTOMER=0` by default
|
|
86
|
+
- `vidfarm-user-id`
|
|
87
|
+
- `vidfarm-api-key`
|
|
239
88
|
|
|
240
|
-
|
|
89
|
+
Those values come from Vidfarm login and settings, not from platform infrastructure secrets.
|
|
241
90
|
|
|
242
|
-
|
|
91
|
+
For local CLI usage, the `session` command gives you a local seeded session so you can test without manually wiring auth state.
|
|
243
92
|
|
|
244
|
-
|
|
93
|
+
## Provider Keys
|
|
245
94
|
|
|
246
|
-
|
|
247
|
-
- one public ALB with HTTP to HTTPS redirect
|
|
248
|
-
- one ACM certificate for `vidfarm.cloud.zoomgtm.com`
|
|
249
|
-
- one EC2 instance running the Docker image
|
|
250
|
-
- one dedicated encrypted EBS data volume retained separately from the container
|
|
251
|
-
- Route53 `A` and `AAAA` alias records for the production hostname
|
|
95
|
+
Templates should work with the developer's own upstream AI keys.
|
|
252
96
|
|
|
253
|
-
|
|
97
|
+
Typical local `.env`:
|
|
254
98
|
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
export VIDFARM_RECORD_NAME=vidfarm
|
|
261
|
-
export VIDFARM_PUBLIC_BASE_URL=https://vidfarm.cloud.zoomgtm.com
|
|
262
|
-
export VIDFARM_ADMIN_EMAILS=admin@zoomgtm.com
|
|
263
|
-
export VIDFARM_DEVELOPER_EMAILS=dev1@zoomgtm.com,dev2@zoomgtm.com
|
|
264
|
-
export VIDFARM_ENCRYPTION_SECRET='replace-with-a-long-random-secret'
|
|
265
|
-
export VIDFARM_API_KEY_SALT='replace-with-a-second-long-random-secret'
|
|
266
|
-
export VIDFARM_WEBHOOK_SECRET='replace-with-a-third-long-random-secret'
|
|
99
|
+
```env
|
|
100
|
+
GEMINI_API_KEY=""
|
|
101
|
+
OPENAI_API_KEY=""
|
|
102
|
+
OPENROUTER_API_KEY=""
|
|
103
|
+
PERPLEXITY_API_KEY=""
|
|
267
104
|
```
|
|
268
105
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
- `VIDFARM_RESEND_API_KEY`
|
|
272
|
-
- `VIDFARM_RESEND_FROM_EMAIL`
|
|
273
|
-
- `VIDFARM_OPENAI_API_KEY`
|
|
274
|
-
- `VIDFARM_OPENROUTER_API_KEY`
|
|
275
|
-
- `VIDFARM_GEMINI_API_KEY`
|
|
276
|
-
- `VIDFARM_PERPLEXITY_API_KEY`
|
|
277
|
-
- `VIDFARM_REMOTION_*`
|
|
278
|
-
- `VIDFARM_INSTANCE_TYPE`
|
|
279
|
-
- `VIDFARM_DATA_VOLUME_SIZE_GIB`
|
|
280
|
-
- `VIDFARM_WORKER_MAX_CONCURRENT_JOBS`
|
|
281
|
-
- `VIDFARM_MAX_PENDING_JOBS_GLOBAL`
|
|
282
|
-
- `VIDFARM_MAX_PENDING_JOBS_PER_CUSTOMER`
|
|
106
|
+
You usually only need one provider key to develop and test a template locally.
|
|
283
107
|
|
|
284
|
-
|
|
108
|
+
## Remotion
|
|
285
109
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
npm install
|
|
290
|
-
npm run cdk:synth
|
|
291
|
-
npx aws-cdk bootstrap aws://$CDK_DEFAULT_ACCOUNT/$CDK_DEFAULT_REGION
|
|
292
|
-
npm run cdk:deploy
|
|
293
|
-
```
|
|
110
|
+
For third-party template authors, Remotion is local.
|
|
294
111
|
|
|
295
|
-
|
|
112
|
+
If your template uses `ctx.remotion`, develop and validate it locally through the CLI. This package does not document or require shared cloud Remotion infrastructure.
|
|
296
113
|
|
|
297
|
-
##
|
|
114
|
+
## Next Read
|
|
298
115
|
|
|
299
|
-
|
|
300
|
-
- Remotion is still stubbed behind [src/services/remotion.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/services/remotion.ts). When upgrading it to real Lambda submission, follow [AWS_REMOTION_HANDOFF.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/AWS_REMOTION_HANDOFF.md) and use the Remotion-specific AWS credentials already available in local production env config.
|
|
116
|
+
For the external template-author workflow, continue with [GETTING_STARTED.developers.md](./GETTING_STARTED.developers.md) and the example template in [`templates/template_0000`](./templates/template_0000).
|