#Best way to start a new project
4 messages · Page 1 of 1 (latest)
Hi @sonic pelican. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The best and easiest way to start a new project in Convex using ConvexAuth with ResendOTP authentication, especially with Next.js, is to use the npm create convex command. Here's a step-by-step guide based on the knowledge sources:
- Run the following command to create a new Convex project:
npm create convex@latest
-
When prompted, choose "Next.js" as your client and "Convex Auth" for user authentication Start building faster with
npm create convex(https://stack.convex.dev/npm-create-convex#start-building-faster-with-npm-create-convex). -
Follow the setup instructions provided after the project is created. This will typically include:
- Changing to the project directory
- Running
npm run devto start the development server
-
For ResendOTP authentication, you'll need to configure it in your project. Here's how:
-
Install the necessary dependencies:
npm install [email protected] oslo -
Create a custom provider config for sending an OTP. Add a file
ResendOTP.tsin yourconvex/folder with the configuration Auth > Config > OTPs (https://labs.convex.dev/auth/config/otps). -
Set up your Resend API key as an environment variable:
npx convex env set AUTH_RESEND_KEY yourresendkey -
Update your
convex/auth.tsfile to use the ResendOTP provider.
-
-
For the frontend, you can use the provided React components and hooks from Convex Auth to handle authentication in your Next.js pages.
This approach gives you a solid starting point with Next.js and Convex, including ConvexAuth setup. You can then customize the ResendOTP authentication as needed for your specific project requirements.
Remember that Convex Auth is currently in beta, so be prepared for potential changes or updates Convex Auth (https://labs.convex.dev/auth).