You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1
+
This is a [Next.js](https://nextjs.org)demo project that uses [Trigger.dev Realtime](https://trigger.dev/docs/realtime) and the Trigger.dev [React Hooks](https://trigger.dev/docs/frontend/react-hooks) to perform a background task that updates the page in real-time.
2
2
3
3
## Getting Started
4
4
5
-
First, run the development server:
5
+
If you haven't already, sign up for a free account at [Trigger.dev](https://trigger.dev) and create a new project. Update the project reference in `trigger.config.ts` with your project's reference.
6
+
7
+
Then, copy the `.env.local.example` file to `.env.local` and update the `TRIGGER_API_KEY` with your API key and the `OPENAI_API_KEY` with your OpenAI API key.
8
+
9
+
```bash
10
+
TRIGGER_API_KEY=your-api-key
11
+
OPENAI_API_KEY=your-openai-api-key
12
+
```
13
+
14
+
Next, run the Next.js development server:
6
15
7
16
```bash
8
17
npm run dev
@@ -14,23 +23,17 @@ pnpm dev
14
23
bun dev
15
24
```
16
25
17
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
-
19
-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
-
21
-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
26
+
And in a new terminal window, run the Trigger.dev CLI:
22
27
23
-
## Learn More
24
-
25
-
To learn more about Next.js, take a look at the following resources:
26
-
27
-
-[Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
-
-[Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
-
30
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
-
32
-
## Deploy on Vercel
28
+
```bash
29
+
npx trigger.dev@latest dev
30
+
```
33
31
34
-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
32
+
### Relevant Files
35
33
36
-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
34
+
-`src/trigger/tasks.ts`: Where our `generateFunctionDocs` background task is defined.
35
+
-`src/app/page.tsx`: The main page that invokes the server action function that triggers the background task.
36
+
-`src/app/actions.ts`: The server action function that triggers the background task and redirects to `/runs/[id]`.
37
+
-`src/app/runs/[id]/page.tsx`: The page that displays the status of the background task and the result when it's done.
38
+
-`src/app/hooks/useGenerateFunctionDocs.ts`: A custom React Hook that uses the Trigger.dev React Hooks to fetch the function documentation in real-time.
39
+
-`src/app/components/GenerateFunctionDocs.tsx`: A component that uses the `useGenerateFunctionDocs` hook to display the function documentation in real-time.
0 commit comments