Server-side authentication with Next.js

2

Create project

Create a project using Next.js.

Shell
npx create-next-app@latest

The command will give you a prompt with several project types. We'll be starting with a skeleton project.

The prompt will be something similar to this.

Shell
What is your project named? my-app
Would you like to use TypeScript? No
Would you like to use ESLint? No
Would you like to use Tailwind CSS? No
Would you like to use `src/` directory? Yes
Would you like to use App Router? (recommended) Yes
Would you like to customize the default import alias (@/*)? No
What import alias would you like configured? [Enter]

After the prompt is finished, you can head over to the newly created project.

Shell
cd my-app
npm install

Install Appwrite

Appwrite provides a Node SDK that can be used in your Next.js apps. You can use Appwrite by installing the Node SDK as an NPM package. The Node SDK is intended for server-side use. If you want to use Appwrite in a client-side application, you should use the Web SDK instead.

Shell
npm install node-appwrite