Mongo-db
Setup
Initialize Next.js Project
Start from the scratch by initializing a new Next.js project using the following command:
Explain
my-app
: The name of your project directory. Replace this with your desired project name.typescript
: Initializes the project with TypeScript configuration.eslint
: Sets up ESLint for linting your code.tailwind
: Includes Tailwind CSS for styling.src-dir
: Creates a src/ directory and places your application code inside it.router
: Enables the App Router feature.alias
: Customizes the default import alias (@/*) to a custom path.
Install Required Packages
- To Apply the Authentication feature with
next-auth
,mongodb
andzod
. - We need to install the required packages by running the following command.
Setup .env credentials
Create a new file named .env.local
in the root of the project and add the following configuration.