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
* Added docs images for supabase
* Compressed some existing images
* Improved some of the main quickstart wording
* First draft of the Supabase quickstart
* Tweaks to the Supabase quickstart and the supabase integration docs
---------
Co-authored-by: James Ritchie <[email protected]>
Next, rename the `.env.local.example` file to `.env.local` and add your Supabase URL and public key:
37
+
38
+
```
39
+
NEXT_PUBLIC_SUPABASE_URL=your-project-url
40
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
41
+
```
42
+
43
+
You can find your API keys in Supabase by clicking the cog (⚙️) icon in the left menu and selecting 'API' from the Project Settings menu:
44
+
45
+

46
+
47
+
Finally, in the terminal, go ahead and [Generate the Typescript types](https://supabase.com/docs/reference/javascript/typescript-support) now as we'll be using them shortly:
48
+
49
+
<Tip>
50
+
You may need to login to the supabase CLI first. For more info see the [supabase login
// Use OAuth to authenticate with Supabase Management API
101
+
const supabaseManagement =newSupabaseManagement({
102
+
id: "supabase-management",
103
+
});
104
+
105
+
// Use the types we generated earlier
106
+
const db =supabaseManagement.db<Database>(process.env.NEXT_PUBLIC_SUPABASE_URL!);
107
+
108
+
client.defineJob({
109
+
id: "supabase-test-job",
110
+
name: "My Supabase Test Job",
111
+
version: "1.0.0",
112
+
trigger: db.onInserted({
113
+
schema: "auth",
114
+
table: "users",
115
+
}),
116
+
run: async (payload, io, ctx) => {},
117
+
});
118
+
```
119
+
120
+
## Authenticate to the Supabase Management API
121
+
122
+
The Supabase Triggers use the [Supabase Management API](https://trigger.dev/docs/integrations/apis/supabase/management) to register the triggers in your Supabase projects.
123
+
124
+
You can authenticate using a Personal Access Token or via the new Supabase Management API OAuth implementation, which we are using in this example.
125
+
126
+
Login to Trigger.dev and navigate to the project "Integrations" page. Select the "Supabase Management" integration and configure it like so:
127
+
128
+

129
+
130
+
Authorize access to your Supabase project and then you'll be ready to run the Job.
131
+
132
+

133
+
134
+
## Run and test the Job
135
+
136
+
Now you are ready to run the Next.js app and test the Job. Run the following command to start the Next.js app:
137
+
138
+
```bash
139
+
npm run dev
140
+
```
141
+
142
+
And then in a separate terminal, run the following command to start the Trigger.dev agent:
143
+
144
+
```bash
145
+
npx @trigger.dev/cli dev
146
+
```
147
+
148
+
Head back to your Supabase Dashboard -> Auth, and create a new user (keep "Auto Confirm User?" checked)
Then navigate over to your Trigger.dev project dashboard and you should see the job running.
153
+
154
+

155
+
156
+
## What's next?
157
+
158
+
Checkout our fully-functioning [Supabase Onboarding Email example](https://github.com/triggerdotdev/examples/tree/main/supabase-onboarding-emails) to learn how to build an email drip campaign in 62 lines of code.
159
+
160
+
<CardGroupcols={2}>
161
+
<Cardtitle="Write your first Job"icon="hexagon-plus"href="/documentation/guides/create-a-job">
0 commit comments