Skip to content

Commit 5a5d20c

Browse files
committedOct 25, 2024
Initial commit
1 parent 4db0d02 commit 5a5d20c

24 files changed

+2696
-459
lines changed
 

‎.env.local.example

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
TRIGGER_SECRET_KEY=tr_dev_1234 # Replace with your own secret key
2+
TRIGGER_API_URL="https://api.trigger.dev"
3+
NEXT_PUBLIC_TRIGGER_API_URL="https://api.trigger.dev"
4+
OPENAI_API_KEY="sk-1234" # Replace with your own OpenAI API key

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
.trigger

‎README.md

+22-19
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
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.
22

33
## Getting Started
44

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:
615

716
```bash
817
npm run dev
@@ -14,23 +23,17 @@ pnpm dev
1423
bun dev
1524
```
1625

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:
2227

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+
```
3331

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
3533

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.

‎components.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "src/app/globals.css",
9+
"baseColor": "neutral",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
}
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.