Skip to content

Commit a847b49

Browse files
matt-aitkenH4adwesleymatosdevvisheshrwlericallam
authored
NestJS framework suport (from @H4ad) (#574)
* feat: added nestjs package adapter * Latest lockfile * Updated Astro setup docs: env import * Astro docs improvements * Docs: improved the limitations * Bumped package versions to 2.1.3 * Updated the Astro docs with SSR notes * test/368/use vitest instead of jest (#470) * chore: add vitest dependencies * refactor: replace jest by vitest * test: disable broken test * Update pnpm-lock.yaml * Update pnpm-lock.yaml --------- Co-authored-by: Matt Aitken <[email protected]> * Created Temp for pull req, bugreport & feature req * A few teaks to the templates * Added instructions for how to do Changeset snapshots * Redirect people to discord to ask a question * Documentation Update: Added <github_username> instead of triggerdotdev to avoid confusion while cloning the repository (#477) * Added a link to the homepage from the side menu (#479) * Added 2 new named icons * New side menu link to the homepage * Updated lock file * Removed un-used import * Renamed the examples dir to references (true examples are in another repo and this was confusing) * Add a references README * Fixes broken pnpm lock file * Improve the Astro manual setup guide * Fixed cal.com link * Upgrade to the latest remix (pre v2) * React status hooks (#493) * Added stripInternal to SDK tsconfig * Statuses can now be set from a run, and are stored in the database * Added the key to the returned status * Made the test job have an extra step and only pass in some of the options * client.getRunStatuses() and the corresponding endpoint * client.getRun() now includes status info * Fixed circular dependency schema * Translate null to undefined * Added the react package to the nextjs-reference tsconfig * Removed unused OpenAI integration from nextjs-reference project * New hooks for getting the statuses * Disabled most of the nextjs-reference jobs * Updated the hooks UI * Updated the endpoints to deal with null statuses values * The hook is working, with an example * Changeset: “You can create statuses in your Jobs that can then be read using React hooks” * Changeset config is back to the old changelog style * WIP on new React hooks guide * Guide docs for the new hooks * Added the status hooks to the React hooks guide * Removed the links to the status hooks reference for now * Re-ordered the hooks * Fix for an error in the docs * Set a default of a blank array for the GetRunSchema * Fixed dependency * Revert "Upgrade to the latest remix (pre v2)" This reverts commit 4edc711. * Update introduction.mdx (#498) Changed https://github.com/triggerdotdev/examples/tree/main/resend (which was a 404) to https://github.com/triggerdotdev/examples/tree/main/resend-email-form * Use the bell icon for the new status Tasks * Going exponential with `Linear` (#478) * Unleash GPT magic * Clean up after GPT * All the hooks * Provisional integration catalog entry * Sample webhook jobs * Attachments with alpha warnings * Remove some verbose logs * Fix IP restrictions * Remove tunnel * Revert "Remove tunnel" This reverts commit c5b69ce. * Resolve event name clashes * Remove circular dependency * Use correct payload uuid * Schema fixes * Fix webhook event name * Start to Linearify catalog entry * Remove todo * More catalog updates * Make OAuth work * Rename webhook helper * Schema juggling * More discrimination * Add Issue SLA event * Simplify triggers * Handle rate limits * Fix Project schema * Payload examples * Improve event props * Remove redundant source metadata * One type to rule them all * Recursive WithoutFunctions type * Linear output serializer * Some tasks * Update catalog entry * Dynamic usage sample * Bump version * Remove tunnel * More tasks * Add optional skipRetrying on runTask errors * Fail fast on user errors * Entity getter tasks * Another couple of tasks * Token to apiKey * Sort tasks * Add filtered issue SLA triggers * Add docs * Type fixes * Job catalog examples * Serialization helper docs * Add changeset * Refactor webhooks * Enhance properties * Pagination helper and docs * Clean up imports * Change misc catalog job --------- Co-authored-by: Matt Aitken <[email protected]> * Use absolute image paths (#490) * Update sendevent.mdx * fix: Fail client-side on invalid Stripe event names (#492) * Parse event names * Add changeset * feat: BYO Auth (#491) * feat: BYO Auth Define client-side auth resolvers to be able to supply custom authentication credentials for integrations before a run is performed - Added new defineAuthResolver - Update all integrations to support the new auth resolvers - Strip internal symbols from .d.ts in integrations and trigger-sdk - Added BYO Auth docs - Update Dynamic Schedule to support associated account IDs - Create external accounts just-in-time - Added Account ID field to test job when there are external auth integrations - Show Account ID on run dashboard - Added new Run error state called “Unresolved auth” * Added changeset * Remove @internal from TriggerIntegration public methods * Add void to the result union * DynamicTriggers now work with the new BYO auth system, and added a bunch of docs and docs changes * Add additional key material for registering dynamic trigger task * Add new define* instance methods to the overview * CLI now supports multiple frameworks (with tests) (#480) * Early work defining CLI framework support * WIP moving CLI init logic to the Framework class * Installing files should now work for Nextjs * Some fixes * WIP creating unit tests for Next.js project detection * Delete old jest config * Latest lockfile * Detect use of src directory test * Tests for detection pages/app directory * Correct detection of Next.js project * Renamed test file * Create install files from template files with replacements. With tests * Added multiple uses of the same replacement * Created a test for the install step (it fails right now with JS) * Removed unused import * Another test that should pass but currently fails… * Path alias fixed and now has tests * New pathAlias function used * Nextjs page install tests * Fixed app directory install (with tests) * Removed e2e CLI test, switched to unit testing strategy instead * Latest lockfile * The install files are now actual files that are copied and transformed * Got the template files working correctly after building * Next steps are now framework specific * createFileFromTemplate now works with a path again. Uses mock if specified. * Renamed apiRoute.js to pagesApiRoute.js * Simplified pages file generation * Next.js app API route template * Next.js App routing support, with common files logic shared * Dev command now uses framework default values if they exist and aren’t overridden * Unused import * pathAlias now works for all frameworks * Added a test to detect Next from the next.config.js * WIP on Remix framework support * Tests for Remix install * Replaced references to Next.js * Use a green ✔️ instead of ✅ in the CLI * Support for multiple hostnames * Tunneling can now use the hostname and port * Work on multiple ports * Improved the error messages. Added some extra pots to Next.js * Update the Remix templates to have .server in the imports * Remix updated to use server-runtime instead of node. Node v18+ * Frameworks can specify the watch paths and ignore paths * Define the watch variables above, so we can easily log them for debugging * Don’t wait for outdated package checking when running the dev command * Improved the Remix manual setup guide * Rewriting docs for quickstart * Updated the Next.js quickstart * Remix quick start * Added a changeset * Improved the Next.js manual setup * Tweaked the Linear scopes * Latest lockfile * Fix for getPathAlias typecheck failure * Linear getAll type error (weirdly not in VSCode…) and removed the pagination example that uses the SDK as won’t work with timeouts * Add BYO auth for oauth options * Add back in Job.toJSON to fix the testing package * Removed dynamicTrigger @internal from toJSON * The CLI now checks for a dev server API key in init and dev commands * Remix onboarding now uses the CLI init command * Decouple zod (#500) Zod Schemas is no longer required for validating/inferring event triggers. We’ve taken inspiration from how domain-functions did it: seasonedcc/composable-functions#114 * chore: Update version for release (#481) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Latest lockfile * feat: Basic usage dashboard to show run volume (#501) * New usage dashboard with static data * Implement org usage dash * Grab chart data for the last 12 months * If no org is found just return undefined so a 404 will be shown * Remove mock data * Fill in missing months with 0s --------- Co-authored-by: James Ritchie <[email protected]> * Fixed duplicate end month * hotfix * hotfix 2 * Astro CLI support (#506) * Astro framework CLI support * Changeset: Added Astro automatic installation * Fixed the package name – was remix, now astro * Fixed the export of the example * Added IPv6 localhost to Astro hostnames * Updated Astro onboarding to show the CLI init command, instead of manual instructions * Astro quickstart * Fix for type in Remix quickstart * Next.js framework detection allows different config file extensions and “next” devDependency * Made the dev command port more general so it works with various frameworks * chore: Update version for release (#508) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Fix for incorrectly named Next.js package in manual setup * Latest lockfile * Increased the intervalTrigger max from 1 day to 30 days * Implement the task output redacting to prevent redacted values from showing in the logs * Express frameworks docs + CLI (#512) * Manual setup docs * Added the onboarding * The emails package now works with Node > 18 * Added CLi support for Express, including custom init command finished messages * Need to actually log out the installation complete message… * Fix for an old Remix reference * Renamed the page export * Use resolvedOptions.triggerUrl * Typo in manual instructions * chore: Update version for release (#513) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Latest lockfile * Add the STAGING environment by default * Fixed sparodically failed run creations - Use a better way of getting the latest job run number to increment - Make the CreateRunService transaction more reliable - Invoke dispatchers in parallel - No longer swallow prisma errors in $transaction * Swapped out the Homepage link in the side menu for a link to the Changelog * Youtube embedded video fits its aspect ratio instead of going full width * Improved CLI init Next.js middleware detection * CLI init: adds public key as “TRIGGER_PUBLIC_API_KEY” except for Next which overrides this * Updated the docs for the React hooks * chore: Update version for release (#521) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Display framework logos on the onboarding setup pages (#519) * autofocus the search field on the Job page * Add some documentation around canceling scheduled events * Updated outdated lockfile * Updated docs README.md * Improves the performance of run resuming (#522) * Improves the perform of run resuming When runs resume, we try and make sure that tasks that have already been completed are cached and reused. Worst case scenario the client needs to hit the API server once for a non-cached task that is indeed completed on the server, but this can get pretty expensive when there are a larger number of tasks. This commit does 2 different things to help: - noop tasks are no longer “cached” using the cachedTasks strategy, instead their idempotency keys are shoved into a bloom filter and the client tests for their inclusion in the bloom filter before running them (since they don’t have any concept of output, this works) - Additional cached tasks are lazy loaded when a task is run. This allows us to progressively fetch additional tasks to be cached on the client, which will cut down on cache misses by a decent amount * Create warm-carrots-float.md * Make io.yield backwards compat with older platform versions * Better support old clients connecting to server versions that support lazy loading cached tasks * Fixed type errors when settings headers with unknown value * Better yield not support error message * Rename _version to _serverVersion to be more clear * Add typed filters to `Linear` getAll helper (#517) * Fix getAll params type * Changeset * Search param types * Update changeset * `Replicate` integration and remote callbacks (#507) * Support tasks with remote callbacks * Add common integration tsconfig * Add Replicate integration * Basic job catalog example * Integration catalog entry * Check for callbackUrl during executeTask * Fix getAll * Improve JSDoc * Bump version * Remove named queue * Simplify runTask types * Trust the types * Fail tasks on timeout * Callback timeout as param * Mess with types * performRunExecutionV1 * Update runTask docs * Shorten callback task methods * Fix run method return type * Image processing jobs * Replicate docs * Text output example * Changeset * Version bump * Roll back ugly types * Remove missing types * Quicker return when waiting on remote callback * Remote callback example * Bump version * Remove schema parsing * Only schedule positive callback timeout * Decrease callback secret length * Explicit default timeouts * Import deployments tasks * JSDoc * Deployments docs * Fix runTask examples, mention wrappers --------- Co-authored-by: Eric Allam <[email protected]> * Update pnpm lock file * Allow blank issues * chore: Update version for release (#538) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Fix pnpm lock file * feat: New Test page (#558) * Improvements to the shortcut keys * Updated code mirror theme to the new dark mode style * Removed the old test page help panel copy * WIP new structure for the test page * Added some of the side panel options for examples and account ID * Conditionally hide the side panel components if they’re blank * Example with selected state working * Allow selecting the example again to overwrite any edits * Previous run payloads working * Select a recent payload if there’s no example * Created Icon and DetailCell components * The integrations now use the DetailCell * Use DetailCell on the integrations page * Added support for description to DetailCell. With proper variants now * DateTimeAccurate and formatDateTimeAccurate weren’t displaying correctly. fractionalSecondDigits isn’t in the types, but is supported for 92.5% of users * DetailCell now allows label and description to be React components * Using the DetailCell on the Test page * Styled the CodeMirror scrollbars to match elsewhere * Adding copy and clear to the JSONEditor, not working properly yet though * Removed the copy/clear buttons from the Test route * Delete the light color theme * The editor now supports copying/clearing etc * Made it clear when text is copied * Changed the learn link to a tertiary button * Fixed CMD shortcut keys * Run test button now works with ⌘ Enter * CodeMirror now allows ⌘Enter to escape the field * Added JSON linter to the test editor * Fix for buttons not being aligned correctly * Copy/clear buttons now aligned * Made the integration DetailCell text smaller * The test recent payloads now have colored text to help identify the status * DetailCell descriptions are dimmer * Added link to docs for BYOA * Fix for buttons going full width when they shouldn’t --------- Co-authored-by: James Ritchie <[email protected]> * chore: update doc title for groups (#539) * chore: update doc title for groups * update docs for sdk and integrations * Add instructions for triggering job runs to the job catalog readme * Updated the Test docs * Removed a console.log when a user’s file is changed that CLI dev is listening for * feat: allow cancelling jobs from trigger-client sdk (#562) * feat: allow cancelling jobs from trigger-client sdk * use presenter instead of service for non-mutating logic * chore: upgrade zod to 3.22.3 (#570) * chore: upgrade zod to 3.22.3 * add changeset * Created a changeset with the correct starting package version * Added headers to NestJS response * Added some types to the NestJS project * Added fastify types * Removed log from CodeMirror * Added InstallPackages component * Improved the NestJS onboarding instructions * Updated the onboarding instructions * Made all the quickstart framework cards snippets, so the page isn’t a nightmare to edit * NestJS docs updates * Added dotenv to the earlier code sample * Latest lockfile * Moved the nestjs-example to the reference folder --------- Co-authored-by: Vinícius Lourenço <[email protected]> Co-authored-by: Wesley <[email protected]> Co-authored-by: Vishesh Rawal <[email protected]> Co-authored-by: Eric Allam <[email protected]> Co-authored-by: Aniket Bindhani <[email protected]> Co-authored-by: James Ritchie <[email protected]> Co-authored-by: D-K-P <[email protected]> Co-authored-by: Gregory <[email protected]> Co-authored-by: nicktrn <[email protected]> Co-authored-by: Eric Allam <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: James Ritchie <[email protected]> Co-authored-by: Hemachandar <[email protected]>
1 parent 0df6410 commit a847b49

Some content is hidden

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

42 files changed

+3442
-394
lines changed

.changeset/fair-waves-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/nestjs": patch
3+
---
4+
5+
First release of NestJS adaptor
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {
2+
ClientTabs,
3+
ClientTabsList,
4+
ClientTabsTrigger,
5+
ClientTabsContent,
6+
} from "../primitives/ClientTabs";
7+
import { ClipboardField } from "../primitives/ClipboardField";
8+
9+
type InstallPackagesProps = {
10+
packages: string[];
11+
};
12+
13+
export function InstallPackages({ packages }: InstallPackagesProps) {
14+
return (
15+
<ClientTabs defaultValue="npm">
16+
<ClientTabsList>
17+
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
18+
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
19+
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
20+
</ClientTabsList>
21+
<ClientTabsContent value={"npm"}>
22+
<ClipboardField
23+
variant="primary/medium"
24+
className="mb-4"
25+
value={`npm install ${packages.join(" ")}`}
26+
/>
27+
</ClientTabsContent>
28+
<ClientTabsContent value={"pnpm"}>
29+
<ClipboardField
30+
variant="primary/medium"
31+
className="mb-4"
32+
value={`pnpm install ${packages.join(" ")}`}
33+
/>
34+
</ClientTabsContent>
35+
<ClientTabsContent value={"yarn"}>
36+
<ClipboardField
37+
variant="primary/medium"
38+
className="mb-4"
39+
value={`yarn add ${packages.join(" ")}`}
40+
/>
41+
</ClientTabsContent>
42+
</ClientTabs>
43+
);
44+
}

apps/webapp/app/components/code/codeMirrorSetup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export function getEditorSetup(showLineNumbers = true, showHighlights = true): A
2828
{
2929
key: "Mod-Enter",
3030
run: () => {
31-
console.log("Mod-Enter");
3231
return true;
3332
},
3433
preventDefault: false,

apps/webapp/app/components/frameworks/FrameworkSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function FrameworkSelector() {
7272
<FrameworkLink to={projectSetupFastifyPath(organization, project)}>
7373
<FastifyLogo className="w-36" />
7474
</FrameworkLink>
75-
<FrameworkLink to={projectSetupNestjsPath(organization, project)}>
75+
<FrameworkLink to={projectSetupNestjsPath(organization, project)} supported>
7676
<NestjsLogo className="w-36" />
7777
</FrameworkLink>
7878
</div>
Lines changed: 211 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,220 @@
1-
import { NestjsLogo } from "~/assets/logos/NestjsLogo";
2-
import { FrameworkComingSoon } from "~/components/frameworks/FrameworkComingSoon";
1+
import { ChatBubbleLeftRightIcon, Squares2X2Icon } from "@heroicons/react/20/solid";
2+
import invariant from "tiny-invariant";
3+
import { Feedback } from "~/components/Feedback";
4+
import { PageGradient } from "~/components/PageGradient";
5+
import { StepContentContainer } from "~/components/StepContentContainer";
6+
import { InlineCode } from "~/components/code/InlineCode";
7+
import { InstallPackages } from "~/components/code/InstallPackages";
38
import { BreadcrumbLink } from "~/components/navigation/NavBar";
9+
import { Button, LinkButton } from "~/components/primitives/Buttons";
10+
import { Header1 } from "~/components/primitives/Headers";
11+
import { Paragraph } from "~/components/primitives/Paragraph";
12+
import { StepNumber } from "~/components/primitives/StepNumber";
13+
import { useAppOrigin } from "~/hooks/useAppOrigin";
14+
import { useDevEnvironment } from "~/hooks/useEnvironments";
15+
import { useOrganization } from "~/hooks/useOrganizations";
16+
import { useProject } from "~/hooks/useProject";
17+
import { useProjectSetupComplete } from "~/hooks/useProjectSetupComplete";
418
import { Handle } from "~/utils/handle";
5-
import { trimTrailingSlash } from "~/utils/pathBuilder";
19+
import { projectSetupPath, trimTrailingSlash } from "~/utils/pathBuilder";
20+
import { CodeBlock } from "../../components/code/CodeBlock";
21+
import { TriggerDevStep } from "~/components/SetupCommands";
622

723
export const handle: Handle = {
8-
breadcrumb: (match) => <BreadcrumbLink to={trimTrailingSlash(match.pathname)} title="Nest.js" />,
24+
breadcrumb: (match) => <BreadcrumbLink to={trimTrailingSlash(match.pathname)} title="NestJS" />,
925
};
1026

11-
export default function Page() {
27+
const AppModuleCode = `
28+
import { Module } from '@nestjs/common';
29+
import { ConfigModule, ConfigService } from '@nestjs/config';
30+
import { TriggerDevModule } from '@trigger.dev/nestjs';
31+
32+
@Module({
33+
imports: [
34+
ConfigModule.forRoot({
35+
isGlobal: true,
36+
}),
37+
TriggerDevModule.registerAsync({
38+
inject: [ConfigService],
39+
useFactory: (config: ConfigService) => ({
40+
id: 'my-nest-app',
41+
apiKey: config.getOrThrow('TRIGGER_API_KEY'),
42+
apiUrl: config.getOrThrow('TRIGGER_API_URL'),
43+
verbose: false,
44+
ioLogLocalEnabled: true,
45+
}),
46+
}),
47+
],
48+
})
49+
export class AppModule {}
50+
`;
51+
52+
const JobControllerCode = `
53+
import { Controller, Get } from '@nestjs/common';
54+
import { InjectTriggerDevClient } from '@trigger.dev/nestjs';
55+
import { eventTrigger, TriggerClient } from '@trigger.dev/sdk';
56+
57+
@Controller()
58+
export class JobController {
59+
constructor(
60+
@InjectTriggerDevClient() private readonly client: TriggerClient,
61+
) {
62+
this.client.defineJob({
63+
id: 'test-job',
64+
name: 'Test Job One',
65+
version: '0.0.1',
66+
trigger: eventTrigger({
67+
name: 'test.event',
68+
}),
69+
run: async (payload, io, ctx) => {
70+
await io.logger.info('Hello world!', { payload });
71+
72+
return {
73+
message: 'Hello world!',
74+
};
75+
},
76+
});
77+
}
78+
79+
@Get()
80+
getHello(): string {
81+
return \`Running Trigger.dev with client-id \${this.client.id}\`;
82+
}
83+
}`;
84+
85+
const AppModuleWithControllerCode = `
86+
import { Module } from '@nestjs/common';
87+
import { ConfigModule, ConfigService } from '@nestjs/config';
88+
import { TriggerDevModule } from '@trigger.dev/nestjs';
89+
import { JobController } from './job.controller';
90+
91+
@Module({
92+
imports: [
93+
ConfigModule.forRoot({
94+
isGlobal: true,
95+
}),
96+
TriggerDevModule.registerAsync({
97+
inject: [ConfigService],
98+
useFactory: (config: ConfigService) => ({
99+
id: 'my-nest-app',
100+
apiKey: config.getOrThrow('TRIGGER_API_KEY'),
101+
apiUrl: config.getOrThrow('TRIGGER_API_URL'),
102+
verbose: false,
103+
ioLogLocalEnabled: true,
104+
}),
105+
}),
106+
],
107+
controllers: [
108+
//...existingControllers,
109+
JobController
110+
],
111+
})
112+
export class AppModule {}
113+
`;
114+
115+
const packageJsonCode = `"trigger.dev": {
116+
"endpointId": "my-nest-app"
117+
}`;
118+
119+
export default function SetupNestJS() {
120+
const organization = useOrganization();
121+
const project = useProject();
122+
useProjectSetupComplete();
123+
const devEnvironment = useDevEnvironment();
124+
const appOrigin = useAppOrigin();
125+
126+
invariant(devEnvironment, "devEnvironment is required");
127+
12128
return (
13-
<FrameworkComingSoon
14-
frameworkName="Nest.js"
15-
githubIssueUrl="https://github.com/triggerdotdev/trigger.dev/issues/449"
16-
githubIssueNumber={449}
17-
>
18-
<NestjsLogo className="w-56" />
19-
</FrameworkComingSoon>
129+
<PageGradient>
130+
<div className="mx-auto max-w-3xl">
131+
<div className="flex items-center justify-between">
132+
<Header1 spacing className="text-bright">
133+
Get setup in 2 minutes
134+
</Header1>
135+
<div className="flex items-center gap-2">
136+
<LinkButton
137+
to={projectSetupPath(organization, project)}
138+
variant="tertiary/small"
139+
LeadingIcon={Squares2X2Icon}
140+
>
141+
Choose a different framework
142+
</LinkButton>
143+
<Feedback
144+
button={
145+
<Button variant="tertiary/small" LeadingIcon={ChatBubbleLeftRightIcon}>
146+
I'm stuck!
147+
</Button>
148+
}
149+
defaultValue="help"
150+
/>
151+
</div>
152+
</div>
153+
<>
154+
<StepNumber stepNumber="1" title="Add the dependencies" />
155+
<StepContentContainer>
156+
<InstallPackages
157+
packages={["@trigger.dev/sdk", "@trigger.dev/nestjs", "@nestjs/config"]}
158+
/>
159+
</StepContentContainer>
160+
<StepNumber stepNumber="2" title="Add the environment variables" />
161+
<StepContentContainer className="flex flex-col gap-2">
162+
<Paragraph>
163+
Inside your <InlineCode>.env</InlineCode> file, create the following env variables:
164+
</Paragraph>
165+
<CodeBlock
166+
fileName=".env"
167+
showChrome
168+
code={`TRIGGER_API_KEY=${devEnvironment.apiKey}\nTRIGGER_API_URL=${appOrigin}`}
169+
/>
170+
</StepContentContainer>
171+
<StepNumber stepNumber="3" title="Add the TriggerDevModule" />
172+
<StepContentContainer className="flex flex-col gap-2">
173+
<Paragraph>
174+
Now, go to your <InlineCode>app.module.ts</InlineCode> and add the{" "}
175+
<InlineCode>TriggerDevModule</InlineCode>:
176+
</Paragraph>
177+
<CodeBlock fileName="app.module.ts" showChrome code={AppModuleCode} />
178+
</StepContentContainer>
179+
<StepNumber stepNumber="4" title="Add the first job" />
180+
<StepContentContainer className="flex flex-col gap-2">
181+
<Paragraph>
182+
Create a <InlineCode>controller</InlineCode> called{" "}
183+
<InlineCode>job.controller.ts</InlineCode> and add the following code:
184+
</Paragraph>
185+
<CodeBlock fileName="src/job.controller.ts" showChrome code={JobControllerCode} />
186+
</StepContentContainer>
187+
<StepNumber stepNumber="5" title="Update your app.module.ts" />
188+
<StepContentContainer className="flex flex-col gap-2">
189+
<Paragraph>
190+
Now, add the new <InlineCode>controller</InlineCode> to your{" "}
191+
<InlineCode>app.module.ts</InlineCode>:
192+
</Paragraph>
193+
<CodeBlock fileName="app.module.ts" showChrome code={AppModuleWithControllerCode} />
194+
</StepContentContainer>
195+
<StepNumber stepNumber="6" title="Update your package.json" />
196+
<StepContentContainer className="flex flex-col gap-2">
197+
<Paragraph>
198+
Now, add this to the top-level of your <InlineCode>package.json</InlineCode>:
199+
</Paragraph>
200+
<CodeBlock fileName="package.json" showChrome code={packageJsonCode} />
201+
</StepContentContainer>
202+
<StepNumber stepNumber="7" title="Run your app" />
203+
<StepContentContainer className="flex flex-col gap-2">
204+
<Paragraph>
205+
Finally, run your project with <InlineCode>npm run start</InlineCode>:
206+
</Paragraph>
207+
</StepContentContainer>
208+
<StepNumber stepNumber="8" title="Run the CLI 'dev' command" />
209+
<StepContentContainer>
210+
<TriggerDevStep />
211+
</StepContentContainer>
212+
<StepNumber stepNumber="9" title="Wait for Jobs" displaySpinner />
213+
<StepContentContainer>
214+
<Paragraph>This page will automatically refresh.</Paragraph>
215+
</StepContentContainer>
216+
</>
217+
</div>
218+
</PageGradient>
20219
);
21220
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Card
2+
icon={
3+
<svg
4+
width="150"
5+
height="49"
6+
viewBox="-38 0 226 49"
7+
fill="none"
8+
xmlns="http://www.w3.org/2000/svg"
9+
>
10+
<g clipPath="url(#clip0_5336_22429)">
11+
<mask id="mask0_5336_22429" maskUnits="userSpaceOnUse" x="0" y="0" width="184" height="49">
12+
<path d="M184 0H0V48.4533H184V0Z" fill="white" />
13+
</mask>
14+
<g mask="url(#mask0_5336_22429)">
15+
<path
16+
d="M12.4424 40.9986C10.2625 39.0108 9.62608 34.8341 10.5343 31.8083C12.1092 33.716 14.2912 34.3203 16.5514 34.6615C20.0406 35.1879 23.4674 34.991 26.7087 33.4002C27.0795 33.218 27.4221 32.9759 27.8273 32.7306C28.1315 33.6107 28.2106 34.4993 28.1044 35.4037C27.8461 37.6063 26.7472 39.3077 24.9995 40.5974C24.3006 41.1133 23.5611 41.5744 22.8393 42.0609C20.6218 43.5559 20.0219 45.3089 20.8551 47.8589C20.8749 47.921 20.8926 47.9831 20.9374 48.1347C19.8053 47.6293 18.9783 46.8934 18.3481 45.9258C17.6825 44.9046 17.3659 43.7749 17.3492 42.5525C17.3409 41.9577 17.3409 41.3576 17.2607 40.7711C17.0649 39.3413 16.3921 38.7013 15.1245 38.6644C13.8236 38.6265 12.7945 39.4287 12.5216 40.6921C12.5008 40.789 12.4706 40.8849 12.4404 40.9975L12.4424 40.9986Z"
17+
fill="url(#paint0_linear_5336_22429)"
18+
/>
19+
<path
20+
d="M0 31.3041C0 31.3041 6.45527 28.1673 12.9286 28.1673L17.8093 13.1001C17.992 12.3714 18.5256 11.8762 19.1278 11.8762C19.7302 11.8762 20.2637 12.3714 20.4464 13.1001L25.3271 28.1673C32.9938 28.1673 38.2557 31.3041 38.2557 31.3041C38.2557 31.3041 27.2909 1.50808 27.2694 1.44829C26.9547 0.567361 26.4234 0 25.7072 0H12.5496C11.8333 0 11.3235 0.567361 10.9874 1.44829C10.9637 1.50695 0 31.3041 0 31.3041Z"
21+
fill="white"
22+
/>
23+
<path
24+
d="M68.0598 26.9653C68.0598 29.6056 64.7674 31.1825 60.2089 31.1825C57.2422 31.1825 56.1929 30.4491 56.1929 28.9089C56.1929 27.2954 57.4954 26.5253 60.4622 26.5253C63.1396 26.5253 65.4188 26.5619 68.0598 26.892V26.9653ZM68.096 23.7016C66.4682 23.3349 64.0081 23.1149 61.0773 23.1149C52.5388 23.1149 48.5228 25.1318 48.5228 29.8257C48.5228 34.7029 51.2725 36.5731 57.6402 36.5731C63.031 36.5731 66.6853 35.2163 68.0236 31.8792H68.2407C68.2045 32.6859 68.1683 33.4927 68.1683 34.1161C68.1683 35.8396 68.4578 35.9864 69.8691 35.9864H76.5262C76.1644 34.9596 75.9472 32.0626 75.9472 29.5689C75.9472 26.892 76.0558 24.8751 76.0558 22.1615C76.0558 16.6241 72.7272 13.1037 62.3073 13.1037C57.821 13.1037 52.8282 13.8738 49.0293 15.0106C49.3911 16.5141 49.8977 19.5578 50.1509 21.538C53.4433 19.9979 58.1105 19.3378 61.7283 19.3378C66.7215 19.3378 68.096 20.4745 68.096 22.7848V23.7016Z"
25+
fill="white"
26+
/>
27+
<path
28+
d="M86.3622 28.5055C85.4576 28.6155 84.2278 28.6155 82.9613 28.6155C81.6224 28.6155 80.3927 28.5788 79.5604 28.4688C79.5604 28.7622 79.5242 29.0922 79.5242 29.3856C79.5242 33.9695 82.5271 36.6464 93.0917 36.6464C103.041 36.6464 106.261 34.0062 106.261 29.3489C106.261 24.9484 104.127 22.7848 94.6833 22.3081C87.3393 21.9781 86.6879 21.1713 86.6879 20.2545C86.6879 19.1911 87.6288 18.641 92.5489 18.641C97.6506 18.641 99.0251 19.3378 99.0251 20.8046V21.1346C99.7489 21.098 101.052 21.0613 102.39 21.0613C103.656 21.0613 105.031 21.098 105.827 21.1713C105.827 20.8413 105.863 20.5479 105.863 20.2912C105.863 14.9006 101.377 13.1404 92.6937 13.1404C82.9251 13.1404 79.6327 15.524 79.6327 20.1812C79.6327 24.3617 82.2738 26.9653 91.6443 27.3687C98.5547 27.5887 99.3146 28.3588 99.3146 29.4223C99.3146 30.559 98.1928 31.0725 93.345 31.0725C87.7735 31.0725 86.3622 30.3024 86.3622 28.7255V28.5055Z"
29+
fill="white"
30+
/>
31+
<path
32+
d="M118.203 9.17995C115.562 11.6369 110.822 14.0939 108.181 14.7539C108.217 16.1107 108.217 18.6044 108.217 19.9612L110.641 19.9979C110.605 22.6015 110.569 25.7552 110.569 27.8454C110.569 32.7226 113.137 36.3897 121.133 36.3897C124.498 36.3897 126.741 36.023 129.527 35.4363C129.237 33.6394 128.912 30.8891 128.804 28.7988C127.139 29.3489 125.041 29.6423 122.725 29.6423C119.505 29.6423 118.203 28.7622 118.203 26.2319C118.203 24.0316 118.203 21.9781 118.239 20.0712C122.364 20.1078 126.488 20.1812 128.912 20.2545C128.876 18.3477 128.948 15.5973 129.057 13.7638C125.547 13.8371 121.604 13.8738 118.348 13.8738C118.384 12.2603 118.42 10.7201 118.456 9.17995H118.203Z"
33+
fill="white"
34+
/>
35+
<path
36+
d="M139.812 18.861C139.848 16.9541 139.884 15.3406 139.92 13.7638H132.648C132.757 16.9175 132.757 20.1445 132.757 24.8751C132.757 29.6056 132.72 32.8693 132.648 35.9864H140.969C140.824 33.7861 140.788 30.0823 140.788 26.9286C140.788 21.9414 142.815 20.5112 147.409 20.5112C149.544 20.5112 151.063 20.768 152.402 21.2446C152.438 19.3745 152.8 15.744 153.017 14.1305C151.642 13.7271 150.123 13.4705 148.278 13.4705C144.334 13.4338 141.44 15.0473 140.101 18.8977L139.812 18.861Z"
37+
fill="white"
38+
/>
39+
<path
40+
d="M176.038 24.7284C176.038 28.7255 173.143 30.5957 168.584 30.5957C164.062 30.5957 161.167 28.8355 161.167 24.7284C161.167 20.6213 164.098 19.0811 168.584 19.0811C173.107 19.0811 176.038 20.7313 176.038 24.7284ZM183.599 24.5451C183.599 16.5875 177.376 13.0304 168.584 13.0304C159.757 13.0304 153.75 16.5875 153.75 24.5451C153.75 32.4659 159.359 36.7198 168.548 36.7198C177.81 36.7198 183.599 32.4659 183.599 24.5451Z"
41+
fill="white"
42+
/>
43+
</g>
44+
</g>
45+
<defs>
46+
<linearGradient
47+
id="paint0_linear_5336_22429"
48+
x1="10.1338"
49+
y1="48.1347"
50+
x2="31.1641"
51+
y2="38.1736"
52+
gradientUnits="userSpaceOnUse"
53+
>
54+
<stop stopColor="#D83333" />
55+
<stop offset="1" stopColor="#F041FF" />
56+
</linearGradient>
57+
<clipPath id="clip0_5336_22429">
58+
<rect width="184" height="48.4533" fill="white" />
59+
</clipPath>
60+
</defs>
61+
</svg>
62+
}
63+
href="/documentation/quickstarts/astro"
64+
/>

0 commit comments

Comments
 (0)