Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added nextjs-auth tutorial. #314

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@playwright/test": "^1.37.1",
"@sveltejs/adapter-node": "^1.3.1",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.24.1",
"@sveltejs/kit": "^1.27.1",
"@types/compression": "^1.7.3",
"@types/glob": "^8.1.0",
"@types/markdown-it": "^13.0.1",
Expand Down
11 changes: 11 additions & 0 deletions src/routes/docs/tutorials/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@
</p>
</a>
</li>
<li class="is-mobile-col-span-2">
<a href="/docs/tutorials/nextjs-auth" class="aw-card is-normal">
<header class="u-flex u-cross-baseline u-gap-4">
<span class="icon-nextjs aw-u-font-size-24" aria-hidden="true" />
<h4 class="aw-sub-body-500 aw-u-color-text-primary">Nextjs</h4>
</header>
<p class="aw-sub-body-400 u-margin-block-start-4">
Learn Appwrite Auth, Databases, and more with Nextjs.
</p>
</a>
</li>
<li class="is-mobile-col-span-2">
<a href="/docs/tutorials/vue" class="aw-card is-normal">
<header class="u-flex u-cross-center u-gap-4">
Expand Down
10 changes: 10 additions & 0 deletions src/routes/docs/tutorials/nextjs-auth/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
import { globToTutorial } from '$lib/utils/tutorials.js';
import { setContext } from 'svelte';

export let data;
const tutorials = globToTutorial(data);
setContext('tutorials', tutorials);
</script>

<slot />
11 changes: 11 additions & 0 deletions src/routes/docs/tutorials/nextjs-auth/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { LayoutLoad } from './$types';

export const load: LayoutLoad = ({ url }) => {
const tutorials = import.meta.glob('./**/*.markdoc', {
eager: true
});
return {
tutorials,
pathname: url.pathname
};
};
6 changes: 6 additions & 0 deletions src/routes/docs/tutorials/nextjs-auth/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';

export const load: PageLoad = async () => {
throw redirect(303, '/docs/tutorials/nextjs-auth/step-1');
};
35 changes: 35 additions & 0 deletions src/routes/docs/tutorials/nextjs-auth/step-1/+page.markdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: tutorial
title: Getting Started with Appwrite Authentication in Next.js
description: Set up a Next.js project and integrate Appwrite for authentication.
step: 1
difficulty: beginner
readtime: 15
---

**Welcome to the Appwrite Authentication Deep Dive for Next.js!**
In this tutorial series, you will learn how to build a secure authentication system for your Next.js application using Appwrite.

{% only_dark %}
![Create project screen](/images/docs/tutorials/dark/idea-tracker.png)
{% /only_dark %}
{% only_light %}
![Create project screen](/images/docs/tutorials/idea-tracker.png)
{% /only_light %}

# Concepts {% #concepts %}
This tutorial series will cover the following key concepts:

1. Setting up a Next.js project.
2. Integrating Appwrite for authentication.
3. User sign-up and login workflows.
4. Email verification and password recovery.
5. Managing user preferences and account deletion.

# Prerequisites {% #prerequisites %}
Before you begin, make sure you have the following prerequisites:

1. Basic knowledge of JavaScript and Next.js.
2. Node.js and NPM installed on your computer. You can download them from [Node.js website](https://nodejs.org/en/).

Let's get started with setting up your Next.js project and integrating Appwrite for authentication!
27 changes: 27 additions & 0 deletions src/routes/docs/tutorials/nextjs-auth/step-2/+page.markdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: tutorial
title: Create app
description: Create a SvelteKit app project using Appwrite.
step: 2
---

# Create a Nextjs project {% #create-nextjs-project %}

Create a Nextjs app with the `npm create` command and select `Skeleton project`

```sh
npx create-next-app@latest && cd my-app
```

# Add dependencies
Install the JavaScript Appwrite SDK.

```sh
npm install appwrite
```

You can start the development server to watch your app update in the browser as you make changes.

```sh
npm run dev -- --open --port 3000
```