@mevdragon/vidfarm-devcli 0.1.0

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 ADDED
@@ -0,0 +1,41 @@
1
+ NODE_ENV="development"
2
+ PORT="3000"
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="4"
13
+ DEFAULT_JOB_DELAY_SECONDS="20"
14
+
15
+ PUBLIC_BASE_URL="http://localhost:3000"
16
+ STORAGE_DRIVER="local"
17
+ AWS_REGION="us-east-1"
18
+ AWS_S3_BUCKET=""
19
+ AWS_S3_ENDPOINT=""
20
+ AWS_ACCESS_KEY_ID=""
21
+ AWS_SECRET_ACCESS_KEY=""
22
+
23
+ RESEND_API_KEY=""
24
+ RESEND_FROM_EMAIL="noreply@example.com"
25
+
26
+ OPENAI_API_KEY=""
27
+ OPENROUTER_API_KEY=""
28
+ GEMINI_API_KEY=""
29
+ PERPLEXITY_API_KEY=""
30
+
31
+ REMOTION_FUNCTION_NAME=""
32
+ REMOTION_REGION="us-east-1"
33
+ REMOTION_BUCKET_NAME=""
34
+ REMOTION_SITE_NAME="vidfarm-demo-template"
35
+ REMOTION_SERVE_URL=""
36
+ REMOTION_COMPOSITION_ID="demo-template"
37
+ REMOTION_AWS_ACCESS_KEY_ID=""
38
+ REMOTION_AWS_SECRET_ACCESS_KEY=""
39
+ REMOTION_MODE="auto"
40
+
41
+ MOCK_PROVIDER_RESPONSES="true"
@@ -0,0 +1,311 @@
1
+ # New Repo AWS Remotion Handoff
2
+
3
+ This document is for a fresh repo that wants to keep using the current shared Remotion AWS setup.
4
+
5
+ It is not a description of how this repo is organized. It is the operating contract a new repo should follow.
6
+
7
+ ## Live AWS resources to reuse
8
+
9
+ These were verified from AWS on 2026-05-16:
10
+
11
+ - AWS account: `994816277608`
12
+ - Region: `us-east-1`
13
+ - Remotion render bucket: `remotionlambda-useast1-ujg7c0h43q`
14
+ - Shared Lambda function: `remotion-render-4-0-355-mem2048mb-disk2048mb-180sec`
15
+ - Lambda ARN: `arn:aws:lambda:us-east-1:994816277608:function:remotion-render-4-0-355-mem2048mb-disk2048mb-180sec`
16
+ - Lambda execution role: `arn:aws:iam::994816277608:role/remotion-lambda-role`
17
+ - Lambda runtime: `nodejs20.x`
18
+ - Lambda architecture: `arm64`
19
+ - Lambda timeout: `180`
20
+ - Lambda memory: `2048`
21
+ - Lambda ephemeral storage: `2048`
22
+
23
+ The bucket is in `us-east-1` and site URLs follow this pattern:
24
+
25
+ ```text
26
+ https://remotionlambda-useast1-ujg7c0h43q.s3.us-east-1.amazonaws.com/sites/<site-name>/index.html
27
+ ```
28
+
29
+ ## New repo rule set
30
+
31
+ The new repo should treat AWS in two layers:
32
+
33
+ 1. Shared infrastructure you are reusing
34
+ 2. Repo-specific site bundle you will publish
35
+
36
+ Shared infrastructure:
37
+
38
+ - the AWS account
39
+ - the Remotion render bucket
40
+ - the existing Lambda render function
41
+ - the Lambda execution role
42
+
43
+ Repo-specific asset:
44
+
45
+ - your new site bundle under `sites/<site-name>/index.html`
46
+
47
+ That means a new repo does not need to deploy a new Lambda function just to render a new composition. It only needs to:
48
+
49
+ 1. use the same Remotion major/minor version as the shared Lambda
50
+ 2. publish a new site bundle
51
+ 3. render against that site URL and the shared function name
52
+
53
+ ## Required package versions
54
+
55
+ The shared Lambda is tied to Remotion `4.0.355`, so the new repo should pin:
56
+
57
+ ```json
58
+ {
59
+ "dependencies": {
60
+ "@remotion/cli": "4.0.355",
61
+ "@remotion/lambda": "4.0.355",
62
+ "@remotion/renderer": "4.0.355",
63
+ "remotion": "4.0.355"
64
+ }
65
+ }
66
+ ```
67
+
68
+ If you upgrade Remotion later, treat that as shared infra work, not normal app work.
69
+
70
+ ## What the new repo should configure
71
+
72
+ The new repo should store these values in env or a small config module:
73
+
74
+ ```bash
75
+ REMOTION_REGION=us-east-1
76
+ REMOTION_FUNCTION_NAME=remotion-render-4-0-355-mem2048mb-disk2048mb-180sec
77
+ REMOTION_BUCKET_NAME=remotionlambda-useast1-ujg7c0h43q
78
+ REMOTION_SITE_NAME=my-new-site
79
+ REMOTION_SERVE_URL=https://remotionlambda-useast1-ujg7c0h43q.s3.us-east-1.amazonaws.com/sites/my-new-site/index.html
80
+ REMOTION_COMPOSITION_ID=MyComposition
81
+ ```
82
+
83
+ Do not hard-code old values like `tweet-to-tiktok-2`.
84
+
85
+ ## Publish flow for the new repo
86
+
87
+ The new repo should publish its own dedicated site name:
88
+
89
+ ```bash
90
+ npx -y --package remotion@4.0.355 remotion lambda sites create src/index.ts \
91
+ --site-name=my-new-site \
92
+ --region=us-east-1
93
+ ```
94
+
95
+ That writes your bundle into the shared bucket under:
96
+
97
+ ```text
98
+ sites/my-new-site/index.html
99
+ ```
100
+
101
+ Use a dedicated site name per repo or per video format. Do not reuse another repo’s site name unless you intentionally want one repo to overwrite another repo’s published bundle.
102
+
103
+ ## Render flow for the new repo
104
+
105
+ CLI:
106
+
107
+ ```bash
108
+ npx -y --package remotion@4.0.355 remotion lambda render \
109
+ "https://remotionlambda-useast1-ujg7c0h43q.s3.us-east-1.amazonaws.com/sites/my-new-site/index.html" \
110
+ "MyComposition" \
111
+ --props="./src/my-format/composition.json" \
112
+ --region="us-east-1" \
113
+ --timeout="120000" \
114
+ --function-name="remotion-render-4-0-355-mem2048mb-disk2048mb-180sec" \
115
+ --frames-per-lambda=100
116
+ ```
117
+
118
+ Node:
119
+
120
+ ```ts
121
+ import { renderMediaOnLambda } from "@remotion/lambda/client";
122
+
123
+ await renderMediaOnLambda({
124
+ region: "us-east-1",
125
+ functionName: "remotion-render-4-0-355-mem2048mb-disk2048mb-180sec",
126
+ serveUrl:
127
+ "https://remotionlambda-useast1-ujg7c0h43q.s3.us-east-1.amazonaws.com/sites/my-new-site/index.html",
128
+ composition: "MyComposition",
129
+ inputProps: {},
130
+ codec: "h264",
131
+ timeoutInMilliseconds: 120000,
132
+ privacy: "private",
133
+ });
134
+ ```
135
+
136
+ ## IAM: what already exists on the Lambda side
137
+
138
+ The current Lambda execution role is:
139
+
140
+ - `arn:aws:iam::994816277608:role/remotion-lambda-role`
141
+
142
+ Trust policy:
143
+
144
+ - principal: `lambda.amazonaws.com`
145
+ - action: `sts:AssumeRole`
146
+
147
+ Attached managed policy:
148
+
149
+ - `arn:aws:iam::994816277608:policy/remotion-lambda-policy`
150
+
151
+ The attached policy currently grants:
152
+
153
+ - `s3:ListAllMyBuckets` on `*`
154
+ - `s3:CreateBucket`
155
+ - `s3:ListBucket`
156
+ - `s3:PutBucketAcl`
157
+ - `s3:GetObject`
158
+ - `s3:DeleteObject`
159
+ - `s3:PutObjectAcl`
160
+ - `s3:PutObject`
161
+ - `s3:GetBucketLocation`
162
+ on `arn:aws:s3:::remotionlambda-*`
163
+ - `lambda:InvokeFunction`
164
+ on `arn:aws:lambda:*:*:function:remotion-render-*`
165
+ - `logs:CreateLogGroup`
166
+ on `/aws/lambda-insights`
167
+ - `logs:CreateLogStream`
168
+ - `logs:PutLogEvents`
169
+ on `/aws/lambda/remotion-render-*` and `/aws/lambda-insights:*`
170
+
171
+ The new repo does not need to recreate this role if it is reusing the existing shared Lambda.
172
+
173
+ ## IAM: what the new repo runner should have
174
+
175
+ There are two separate permission sets to think about.
176
+
177
+ ### Option A: publish site bundles and render, but do not manage shared infra
178
+
179
+ This is the safest default for a new repo.
180
+
181
+ The repo runner needs enough permission to:
182
+
183
+ - upload a site bundle into the shared Remotion bucket
184
+ - render with the existing Lambda function
185
+ - optionally inspect function metadata
186
+
187
+ Recommended policy shape:
188
+
189
+ ```json
190
+ {
191
+ "Version": "2012-10-17",
192
+ "Statement": [
193
+ {
194
+ "Sid": "RemotionBucketAccess",
195
+ "Effect": "Allow",
196
+ "Action": [
197
+ "s3:CreateBucket",
198
+ "s3:ListBucket",
199
+ "s3:GetBucketLocation",
200
+ "s3:GetObject",
201
+ "s3:PutObject",
202
+ "s3:DeleteObject",
203
+ "s3:PutBucketAcl",
204
+ "s3:PutObjectAcl"
205
+ ],
206
+ "Resource": [
207
+ "arn:aws:s3:::remotionlambda-useast1-ujg7c0h43q",
208
+ "arn:aws:s3:::remotionlambda-useast1-ujg7c0h43q/*"
209
+ ]
210
+ },
211
+ {
212
+ "Sid": "RemotionRenderInvoke",
213
+ "Effect": "Allow",
214
+ "Action": [
215
+ "lambda:InvokeFunction",
216
+ "lambda:GetFunctionConfiguration"
217
+ ],
218
+ "Resource": [
219
+ "arn:aws:lambda:us-east-1:994816277608:function:remotion-render-4-0-355-mem2048mb-disk2048mb-180sec"
220
+ ]
221
+ }
222
+ ]
223
+ }
224
+ ```
225
+
226
+ If the repo uses Remotion commands that list functions or sites, add:
227
+
228
+ - `lambda:ListFunctions`
229
+
230
+ If the repo needs broader compatibility across future Remotion function versions, widen the Lambda ARN to:
231
+
232
+ - `arn:aws:lambda:us-east-1:994816277608:function:remotion-render-*`
233
+
234
+ ### Option B: also allow shared infra changes
235
+
236
+ Only use this if the new repo is allowed to:
237
+
238
+ - redeploy the shared Lambda function
239
+ - rotate or replace the Lambda execution role
240
+ - manage future Remotion infra upgrades
241
+
242
+ That requires more than render permissions. At minimum, expect to need permissions in these areas:
243
+
244
+ - `lambda:*` for create/update of the Remotion function family
245
+ - `iam:PassRole` for `remotion-lambda-role`
246
+ - potentially IAM role/policy create/update if Remotion is allowed to create or change roles
247
+ - S3 bucket/object permissions on the shared Remotion bucket
248
+ - CloudWatch Logs permissions
249
+
250
+ Do not give this to a normal app repo unless that repo really owns shared infrastructure.
251
+
252
+ ## Recommended IAM split
253
+
254
+ For a clean handoff, use two identities:
255
+
256
+ 1. `remotion-app-runner`
257
+ For normal repo use. Can publish sites and render videos.
258
+ 2. `remotion-infra-admin`
259
+ Rarely used. Can redeploy shared Lambda infra and manage IAM if needed.
260
+
261
+ That prevents a content-format repo from accidentally mutating the shared Remotion backend.
262
+
263
+ ## What the new repo should not do
264
+
265
+ - Do not store long-lived AWS keys in repo `.env` files.
266
+ - Do not hard-code old site names from previous repos.
267
+ - Do not assume this repo’s multi-site router pattern is required.
268
+ - Do not redeploy the shared Lambda function during ordinary composition work.
269
+
270
+ ## Suggested new repo scripts
271
+
272
+ `package.json`:
273
+
274
+ ```json
275
+ {
276
+ "scripts": {
277
+ "create-site": "npx -y --package remotion@4.0.355 remotion lambda sites create src/index.ts --site-name=$REMOTION_SITE_NAME --region=$REMOTION_REGION",
278
+ "render:cloud": "npx -y --package remotion@4.0.355 remotion lambda render $REMOTION_SERVE_URL $REMOTION_COMPOSITION_ID --props=./src/composition.json --region=$REMOTION_REGION --function-name=$REMOTION_FUNCTION_NAME --timeout=120000 --frames-per-lambda=100"
279
+ }
280
+ }
281
+ ```
282
+
283
+ If shell interpolation in `package.json` is awkward in your environment, wrap these in small shell scripts instead.
284
+
285
+ ## Bootstrap checklist for the new repo
286
+
287
+ 1. Pin Remotion packages to `4.0.355`.
288
+ 2. Add the config variables listed above.
289
+ 3. Create a new dedicated site name.
290
+ 4. Use a non-admin AWS identity that can publish and render.
291
+ 5. Publish the site bundle once.
292
+ 6. Run one smoke render against the shared function.
293
+ 7. Save the resulting serve URL and composition ID in repo config.
294
+
295
+ ## Verified facts vs inferred guidance
296
+
297
+ Verified from AWS:
298
+
299
+ - account id
300
+ - region
301
+ - bucket name
302
+ - function name
303
+ - function config
304
+ - Lambda execution role name
305
+ - attached Lambda execution policy
306
+
307
+ Not directly readable with the current AWS identity:
308
+
309
+ - the current IAM policies attached to the calling IAM user `remotion-user`
310
+
311
+ Because of that, the caller policy in this document is the recommended minimum policy for a new repo runner, derived from the live setup and the operations the new repo needs to perform.