Cursor rule
.cursor/rules/webapp.mdcMaking updates to the main trigger.dev remix webapp
Cursor rules
Quality
55/100
Scores the file, not the repository.Length
576 words
3 headings · 0 code blocksRepository
16k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1234567The 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.17.4 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:89- `@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)10- `@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)11- `@internal/run-engine` has all the code needed to trigger a run and take it through it's lifecycle to completion.12- `@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.1314## Environment variables and testing1516In the webapp, all environment variables are accessed through the `env` export of [env.server.ts](mdc:apps/webapp/app/env.server.ts), instead of directly accessing `process.env`.1718Ideally, the `env.server.ts` file would never be imported into a test file, either directly or indirectly. Tests should only imported classes and functions from a file matching `app/**/*.ts` of the webapp, and that file should not use environment variables, everything should be passed through as options instead. This "service/configuration" separation is important, and can be seen in a few places in the code for examples:1920- [realtimeClient.server.ts](mdc:apps/webapp/app/services/realtimeClient.server.ts) is the testable service, and [realtimeClientGlobal.server.ts](mdc:apps/webapp/app/services/realtimeClientGlobal.server.ts) is the configuration2122Also for writing tests in the webapp, checkout our [tests.md](mdc:ai/references/tests.md) guide2324## Legacy run engine vs Run Engine 2.02526We originally the Trigger.dev "Run Engine" not as a single system, but just spread out all over the codebase, with no real separate or encapsulation. And we didn't even call it a "Run Engine". With Run Engine 2.0, we've completely rewritten big parts of the way the system works, and moved it over to an internal package called `@internal/run-engine`. So we've retroactively named the previous run engine "Legacy run engine". We're focused almost exclusively now on moving to Run Engine 2.0 and will be deprecating and removing the legacy run engine code eventually.2728## Where to look for code2930- The trigger API endpoint is [api.v1.tasks.$taskId.trigger.ts](mdc:apps/webapp/app/routes/api.v1.tasks.$taskId.trigger.ts)31- The batch trigger API endpoint is [api.v1.tasks.batch.ts](mdc:apps/webapp/app/routes/api.v1.tasks.batch.ts)32- Setup code for the prisma client is in [db.server.ts](mdc:apps/webapp/app/db.server.ts)33- 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.ts35- 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.ts3738- All the "services" that are found in app/v3/services/\*_/_.server.ts39- 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.ts41
Also in triggerdotdev/trigger.dev
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| triggerdotdev/trigger.devpackages/cli-v3/CLAUDE.md · 16k | CLAUDE.md | deploymentdo-notdocs | 51/100 | 3 days ago | |
| triggerdotdev/trigger.dev.cursor/rules/executing-commands.mdc · 16k | Cursor rules | test | 49/100 | 3 days ago | |
| triggerdotdev/trigger.dev.cursor/rules/otel-metrics.mdc · 16k | Cursor rules | styledo-not | 61/100 | 3 days ago | |
| triggerdotdev/trigger.dev.cursor/rules/writing-tasks.mdc · 16k | Cursor rules | setupbuildarchtypes+5 | 64/100 | 3 days ago | |
| triggerdotdev/trigger.dev.github/copilot-instructions.md · 16k | Copilot instructions | teststyletypes | 32/100 | 3 days ago | |
| triggerdotdev/trigger.devAGENTS.md · 16k | AGENTS.md | setupbuildtestlint-format+8 | 88/100 | 3 days ago | |
| triggerdotdev/trigger.devapps/supervisor/CLAUDE.md · 16k | CLAUDE.md | no sections | 25/100 | 3 days ago | |
| triggerdotdev/trigger.devapps/webapp/CLAUDE.md · 16k | CLAUDE.md | setupbuildteststyle+5 | 88/100 | 3 days ago | |
| triggerdotdev/trigger.devinternal-packages/clickhouse/CLAUDE.md · 16k | CLAUDE.md | styletypesdo-not | 61/100 | 3 days ago | |
| triggerdotdev/trigger.devinternal-packages/database/CLAUDE.md · 16k | CLAUDE.md | typesdatabasedo-not | 65/100 | 3 days ago | |
| triggerdotdev/trigger.devinternal-packages/run-engine/CLAUDE.md · 16k | CLAUDE.md | buildteststyle | 70/100 | 3 days ago | |
| triggerdotdev/trigger.devpackages/core/CLAUDE.md · 16k | CLAUDE.md | no sections | 31/100 | 3 days ago | |
| triggerdotdev/trigger.devpackages/redis-worker/CLAUDE.md · 16k | CLAUDE.md | test | 29/100 | 3 days ago | |
| triggerdotdev/trigger.devpackages/trigger-sdk/CLAUDE.md · 16k | CLAUDE.md | do-not | 54/100 | 3 days ago |
Diff against packages/cli-v3/CLAUDE.md Diff against .cursor/rules/executing-commands.mdc Diff against .cursor/rules/otel-metrics.mdc Diff against .cursor/rules/writing-tasks.mdc Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against apps/supervisor/CLAUDE.md Diff against apps/webapp/CLAUDE.md Diff against internal-packages/clickhouse/CLAUDE.md Diff against internal-packages/database/CLAUDE.md Diff against internal-packages/run-engine/CLAUDE.md Diff against packages/core/CLAUDE.md Diff against packages/redis-worker/CLAUDE.md Diff against packages/trigger-sdk/CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
