Because every new learning feels like a progressive dance 💃🏽!
This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
Follow the quickstart tutorial here.
npx convex dev
Is Convex a relational or NoSQL DB? Both, read Document ID's: References and Relationships.
I recommend you to follow this tutorial to get a better idea of how convex works.
/pages
.use client
.This application uses the auth0/nextjs SDK which automatically connects with our Auth0 provider with the env variables provided in the .env.local.example
file, when calling the handleLogin
method under the /app/api/auth/[auth0]/route.ts
it creates for us the dynamic routes needed for Authentication flow. It is important to read the difference between the two SDK's security models read here.
On top of that we are saving, and using our users from the Convex provider, a lightweight backend solution that allow us to connect clients to the sync worker, which delegates running Js to the runner, that then queries the DB layer. Some customization in the auth integration was needed, since the auth0/nextjs
does not provided the same out-of-the-box solution as auth0/react
with the Auth0Provider
HOC component, so we needed to create a hook to provide the state of our idToken
to convex.
See here difference between idToken
and accessToken
.
This library requires Node.js 16 LTS and newer LTS versions.
Awesome, we have our Basic Authentication done, let's integrate with our backend to save the users...
/hooks/next-auth0-provider
for an example.ConvexProviderWithAuth
HOC. See /app/ConvexProvider.tsx
./hooks/user
.The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.