Skip to content

Commit 142a685

Browse files
Merge branch 'main' into feat/sync-env-secrets
2 parents b00fc41 + 436d951 commit 142a685

File tree

307 files changed

+18429
-14837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+18429
-14837
lines changed

.cursor/mcp.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"mcpServers": {
3-
"trigger.dev": {
4-
"url": "http://localhost:3333/sse"
5-
}
6-
}
7-
}
2+
"mcpServers": {}
3+
}

.cursor/rules/webapp.mdc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ alwaysApply: false
66

77
The main trigger.dev webapp, which powers it's API and dashboard and makes up the docker image that is produced as an OSS image, is a Remix 2.1.0 app that uses an express server, written in TypeScript. The following subsystems are either included in the webapp or are used by the webapp in another part of the monorepo:
88

9-
- `@trigger.dev/database` exports a Prisma 5.4.1 client that is used extensively in the webapp to access a PostgreSQL instance. The schema file is [schema.prisma](mdc:internal-packages/database/prisma/schema.prisma)
9+
- `@trigger.dev/database` exports a Prisma 6.14.0 client that is used extensively in the webapp to access a PostgreSQL instance. The schema file is [schema.prisma](mdc:internal-packages/database/prisma/schema.prisma)
1010
- `@trigger.dev/core` is a published package and is used to share code between the `@trigger.dev/sdk` and the webapp. It includes functionality but also a load of Zod schemas for data validation. When importing from `@trigger.dev/core` in the webapp, we never import the root `@trigger.dev/core` path, instead we favor one of the subpath exports that you can find in [package.json](mdc:packages/core/package.json)
1111
- `@internal/run-engine` has all the code needed to trigger a run and take it through it's lifecycle to completion.
1212
- `@trigger.dev/redis-worker` is a custom redis based background job/worker system that's used in the webapp and also used inside the run engine.
@@ -31,7 +31,10 @@ We originally the Trigger.dev "Run Engine" not as a single system, but just spre
3131
- The batch trigger API endpoint is [api.v1.tasks.batch.ts](mdc:apps/webapp/app/routes/api.v1.tasks.batch.ts)
3232
- Setup code for the prisma client is in [db.server.ts](mdc:apps/webapp/app/db.server.ts)
3333
- The run engine is configured in [runEngine.server.ts](mdc:apps/webapp/app/v3/runEngine.server.ts)
34-
- All the "services" that are found in app/v3/services/**/*.server.ts
34+
- All the "services" that are found in app/v3/services/\*_/_.server.ts
3535
- The code for the TaskEvent data, which is the otel data sent from tasks to our servers, is in both the [eventRepository.server.ts](mdc:apps/webapp/app/v3/eventRepository.server.ts) and also the [otlpExporter.server.ts](mdc:apps/webapp/app/v3/otlpExporter.server.ts). The otel endpoints which are hit from production and development otel exporters is [otel.v1.logs.ts](mdc:apps/webapp/app/routes/otel.v1.logs.ts) and [otel.v1.traces.ts](mdc:apps/webapp/app/routes/otel.v1.traces.ts)
36-
- We use "presenters" to move more complex loader code into a class, and you can find those are app/v3/presenters/**/*.server.ts
36+
- We use "presenters" to move more complex loader code into a class, and you can find those are app/v3/presenters/\*_/_.server.ts
3737

38+
- All the "services" that are found in app/v3/services/\*_/_.server.ts
39+
- The code for the TaskEvent data, which is the otel data sent from tasks to our servers, is in both the [eventRepository.server.ts](mdc:apps/webapp/app/v3/eventRepository.server.ts) and also the [otlpExporter.server.ts](mdc:apps/webapp/app/v3/otlpExporter.server.ts). The otel endpoints which are hit from production and development otel exporters is [otel.v1.logs.ts](mdc:apps/webapp/app/routes/otel.v1.logs.ts) and [otel.v1.traces.ts](mdc:apps/webapp/app/routes/otel.v1.traces.ts)
40+
- We use "presenters" to move more complex loader code into a class, and you can find those are app/v3/presenters/\*_/_.server.ts

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
**/dist
1717
**/node_modules
1818

19+
**/generated/prisma
20+
1921
apps/webapp/build
2022
apps/webapp/public/build
2123

.github/workflows/unit-tests-webapp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
8686
SESSION_SECRET: "secret"
8787
MAGIC_LINK_SECRET: "secret"
88-
ENCRYPTION_KEY: "secret"
88+
ENCRYPTION_KEY: "dummy-encryption-keeeey-32-bytes"
8989
DEPLOY_REGISTRY_HOST: "docker.io"
9090
CLICKHOUSE_URL: "http://default:password@localhost:8123"
9191

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,5 @@ apps/**/public/build
6363
/packages/core/src/package.json
6464
/packages/trigger-sdk/src/package.json
6565
/packages/python/src/package.json
66-
.claude
66+
.claude
67+
.mcp.log

.vscode/launch.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"request": "launch",
6060
"name": "Debug V3 Dev CLI",
6161
"command": "pnpm exec trigger dev",
62-
"cwd": "${workspaceFolder}/references/v3-catalog",
62+
"cwd": "${workspaceFolder}/references/hello-world",
6363
"sourceMaps": true
6464
},
6565
{
@@ -83,31 +83,31 @@
8383
"request": "launch",
8484
"name": "Debug V3 Deploy CLI",
8585
"command": "pnpm exec trigger deploy --self-hosted --load-image",
86-
"cwd": "${workspaceFolder}/references/v3-catalog",
86+
"cwd": "${workspaceFolder}/references/hello-world",
8787
"sourceMaps": true
8888
},
8989
{
9090
"type": "node-terminal",
9191
"request": "launch",
9292
"name": "Debug V3 list-profiles CLI",
9393
"command": "pnpm exec trigger list-profiles --log-level debug",
94-
"cwd": "${workspaceFolder}/references/v3-catalog",
94+
"cwd": "${workspaceFolder}/references/hello-world",
9595
"sourceMaps": true
9696
},
9797
{
9898
"type": "node-terminal",
9999
"request": "launch",
100100
"name": "Debug V3 update CLI",
101101
"command": "pnpm exec trigger update",
102-
"cwd": "${workspaceFolder}/references/v3-catalog",
102+
"cwd": "${workspaceFolder}/references/hello-world",
103103
"sourceMaps": true
104104
},
105105
{
106106
"type": "node-terminal",
107107
"request": "launch",
108108
"name": "Debug V3 Management",
109109
"command": "pnpm run management",
110-
"cwd": "${workspaceFolder}/references/v3-catalog",
110+
"cwd": "${workspaceFolder}/references/hello-world",
111111
"sourceMaps": true
112112
},
113113
{

CONTRIBUTING.md

Lines changed: 15 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ branch are tagged into a release periodically.
8484
8585
2. Once the app is running click the magic link button and enter your email. You will automatically be logged in, since you are running locally. Create an Org and your first project in the dashboard.
8686
87-
## Manual testing using v3-catalog
87+
## Manual testing using hello-world
8888
89-
We use the `<root>/references/v3-catalog` subdirectory as a staging ground for testing changes to the SDK (`@trigger.dev/sdk` at `<root>/packages/trigger-sdk`), the Core package (`@trigger.dev/core` at `<root>packages/core`), the CLI (`trigger.dev` at `<root>/packages/cli-v3`) and the platform (The remix app at `<root>/apps/webapp`). The instructions below will get you started on using the `v3-catalog` for local development of Trigger.dev (v3).
89+
We use the `<root>/references/hello-world` subdirectory as a staging ground for testing changes to the SDK (`@trigger.dev/sdk` at `<root>/packages/trigger-sdk`), the Core package (`@trigger.dev/core` at `<root>packages/core`), the CLI (`trigger.dev` at `<root>/packages/cli-v3`) and the platform (The remix app at `<root>/apps/webapp`). The instructions below will get you started on using the `hello-world` for local development of Trigger.dev.
9090
9191
### First-time setup
9292
9393
First, make sure you are running the webapp according to the instructions above. Then:
9494
95-
1. Visit http://localhost:3030 in your browser and create a new V3 project called "v3-catalog".
95+
1. Visit http://localhost:3030 in your browser and create a new V3 project called "hello-world".
9696
97-
2. In Postgres go to the "Projects" table and for the project you create change the `externalRef` to `yubjwjsfkxnylobaqvqz`.
97+
2. In Postgres go to the "Projects" table and for the project you create change the `externalRef` to `proj_rrkpdguyagvsoktglnod`.
9898
9999
3. Build the CLI
100100
@@ -105,10 +105,10 @@ pnpm run build --filter trigger.dev
105105
pnpm i
106106
```
107107

108-
4. Change into the `<root>/references/v3-catalog` directory and authorize the CLI to the local server:
108+
4. Change into the `<root>/references/hello-world` directory and authorize the CLI to the local server:
109109

110110
```sh
111-
cd references/v3-catalog
111+
cd references/hello-world
112112
cp .env.example .env
113113
pnpm exec trigger login -a http://localhost:3030
114114
```
@@ -118,7 +118,7 @@ This will open a new browser window and authorize the CLI against your local use
118118
You can optionally pass a `--profile` flag to the `login` command, which will allow you to use the CLI with separate accounts/servers. We suggest using a profile called `local` for your local development:
119119

120120
```sh
121-
cd references/v3-catalog
121+
cd references/hello-world
122122
pnpm exec trigger login -a http://localhost:3030 --profile local
123123
# later when you run the dev or deploy command:
124124
pnpm exec trigger dev --profile local
@@ -137,84 +137,29 @@ The following steps should be followed any time you start working on a new featu
137137
pnpm run dev --filter trigger.dev --filter "@trigger.dev/*"
138138
```
139139

140-
3. Open another terminal window, and change into the `<root>/references/v3-catalog` directory.
140+
3. Open another terminal window, and change into the `<root>/references/hello-world` directory.
141141

142-
4. You'll need to run the following commands to setup prisma and migrate the database:
142+
4. Run the `dev` command, which will register all the local tasks with the platform and allow you to start testing task execution:
143143

144144
```sh
145-
pnpm exec prisma migrate deploy
146-
pnpm run generate:prisma
147-
```
148-
149-
5. Run the `dev` command, which will register all the local tasks with the platform and allow you to start testing task execution:
150-
151-
```sh
152-
# in <root>/references/v3-catalog
145+
# in <root>/references/hello-world
153146
pnpm exec trigger dev
154147
```
155148

156149
If you want additional debug logging, you can use the `--log-level debug` flag:
157150

158151
```sh
159-
# in <root>/references/v3-catalog
152+
# in <root>/references/hello-world
160153
pnpm exec trigger dev --log-level debug
161154
```
162155

163-
6. If you make any changes in the CLI/Core/SDK, you'll need to `CTRL+C` to exit the `dev` command and restart it to pickup changes. Any changes to the files inside of the `v3-catalog/src/trigger` dir will automatically be rebuilt by the `dev` command.
164-
165-
7. Navigate to the `v3-catalog` project in your local dashboard at localhost:3030 and you should see the list of tasks.
166-
167-
8. Go to the "Test" page in the sidebar and select a task. Then enter a payload and click "Run test". You can tell what the payloads should be by looking at the relevant task file inside the `/references/v3-catalog/src/trigger` folder. Many of them accept an empty payload.
168-
169-
9. Feel free to add additional files in `v3-catalog/src/trigger` to test out specific aspects of the system, or add in edge cases.
170-
171-
## Running end-to-end webapp tests (deprecated)
156+
6. If you make any changes in the CLI/Core/SDK, you'll need to `CTRL+C` to exit the `dev` command and restart it to pickup changes. Any changes to the files inside of the `hello-world/src/trigger` dir will automatically be rebuilt by the `dev` command.
172157

173-
To run the end-to-end tests, follow the steps below:
174-
175-
1. Set up environment variables (copy example envs into the correct place)
176-
177-
```sh
178-
cp ./.env.example ./.env
179-
cp ./references/nextjs-test/.env.example ./references/nextjs-test/.env.local
180-
```
181-
182-
2. Set up dependencies
183-
184-
```sh
185-
# Build packages
186-
pnpm run build --filter @references/nextjs-test^...
187-
pnpm --filter @trigger.dev/database generate
158+
7. Navigate to the `hello-world` project in your local dashboard at localhost:3030 and you should see the list of tasks.
188159

189-
# Move trigger-cli bin to correct place
190-
pnpm install --frozen-lockfile
160+
8. Go to the "Test" page in the sidebar and select a task. Then enter a payload and click "Run test". You can tell what the payloads should be by looking at the relevant task file inside the `/references/hello-world/src/trigger` folder. Many of them accept an empty payload.
191161

192-
# Install playwrite browsers (ONE TIME ONLY)
193-
npx playwright install
194-
```
195-
196-
3. Set up the database
197-
198-
```sh
199-
pnpm run docker
200-
pnpm run db:migrate
201-
pnpm run db:seed
202-
```
203-
204-
4. Run the end-to-end tests
205-
206-
```sh
207-
pnpm run test:e2e
208-
```
209-
210-
### Cleanup
211-
212-
The end-to-end tests use a `setup` and `teardown` script to seed the database with test data. If the test runner doesn't exit cleanly, then the database can be left in a state where the tests can't run because the `setup` script will try to create data that already exists. If this happens, you can manually delete the `users` and `organizations` from the database using prisma studio:
213-
214-
```sh
215-
# With the database running (i.e. pnpm run docker)
216-
pnpm run db:studio
217-
```
162+
9. Feel free to add additional files in `hello-world/src/trigger` to test out specific aspects of the system, or add in edge cases.
218163

219164
## Adding and running migrations
220165

0 commit comments

Comments
 (0)