Skip to content

Commit aec51a2

Browse files
Update fullstack authentication tutorial for Next.js. Adjusted the tutorial's update date, refined package manager arguments, and added notes on D1 database creation and Windows support.
1 parent fd55d3f commit aec51a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/content/docs/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
updated: 2025-01-13
2+
updated: 2025-04-21
33
difficulty: Intermediate
44
pcx_content_type: tutorial
55
title: Setup Fullstack Authentication with Next.js, Auth.js, and Cloudflare D1
@@ -46,7 +46,7 @@ From within the repository or directory where you want to create your project ru
4646
<PackageManagers
4747
type="create"
4848
pkg="cloudflare@latest"
49-
args={"auth-js-d1-example --framework=next --experimental"}
49+
args={"auth-js-d1-example --framework=next"}
5050
/>
5151

5252
<Render
@@ -424,6 +424,8 @@ Now, it's time to preview our app. Run the following to preview your application
424424

425425
:::caution[Windows support]
426426
OpenNext has [limited Windows support](https://opennext.js.org/cloudflare#windows-support) and recommends using WSL2 if developing on Windows.
427+
428+
Also, you may need to comment out the `@import "tw-animate-css"` line in the `globals.css` file.
427429
:::
428430

429431
You should see our login form. But wait, we're not done yet. Remember to create your database tables by visiting `/api/setup`. You should see `Migration completed`. This means your database is ready to go.
@@ -445,6 +447,10 @@ npx wrangler secret put AUTH_URL
445447

446448
After the changes are deployed, you should now be able to access and try out your new application.
447449

450+
:::note[D1 Database Creation]
451+
You will need to hit the `/api/setup` on your deployed URL to create the necessary tables in your D1 database. It will create 4 tables if they don’t already exist: `accounts`, `sessions`, `users`, and `verification_tokens`. If the `api/setup` route is not working, you can also initialize your tables manually. Look in [migrations.ts](https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-d1/src/migrations.ts) of the Auth.js D1 adapter for the relevant SQL.
452+
:::
453+
448454
You have successfully created, configured, and deployed a fullstack Next.js application with authentication powered by Auth.js, Resend, and Cloudflare D1.
449455

450456
## Related resources

0 commit comments

Comments
 (0)