Skip to content

Commit

Permalink
Move examples to its own repo (#1122)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Sep 15, 2023
1 parent bcb14d4 commit 349c696
Show file tree
Hide file tree
Showing 597 changed files with 96 additions and 24,897 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ const sessionCookie = auth.createSessionCookie(session);

**[Join the Discord server!](https://discord.gg/PwrK3kpVR3)**

**[Changelog](https://github.com/pilcrowOnPaper/lucia/blob/main/packages/lucia/CHANGELOG.md)**
**[Examples](https://github.com/lucia-auth/examples)**

**[Contributing](https://lucia-auth.com/start-here/contributing)**

**[Changelog](https://github.com/pilcrowOnPaper/lucia/blob/main/packages/lucia/CHANGELOG.md)**

## Installation

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ If you're new to Lucia, we recommend starting with [Sign in with username and pa

### Clone project

You can get started immediately by cloning the [Express example](https://github.com/lucia-auth/lucia/tree/main/examples/express/email-and-password) from the repository.
You can get started immediately by cloning the [Express example](https://github.com/lucia-auth/examples/tree/main/express/email-and-password) from the repository.

```
npx degit lucia-auth/lucia/examples/express/email-and-password <directory_name>
npx degit lucia-auth/examples/express/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/express/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/express/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ It will also have a route to handle verification links.

### Clone project

You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/lucia/tree/main/examples/nextjs-app/email-and-password) from the repository.
You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/examples/tree/main/nextjs-app/email-and-password) from the repository.

```
npx degit lucia-auth/lucia/examples/nextjs-app/email-and-password <directory_name>
npx degit lucia-auth/examples/nextjs-app/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nextjs-app/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nextjs-app/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ It will also have a route to handle verification links.

### Clone project

You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/lucia/tree/main/examples/nextjs-pages/email-and-password) from the repository.
You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/examples/tree/main/nextjs-pages/email-and-password) from the repository.

```
npx degit lucia-auth/lucia/examples/nextjs-pages/email-and-password <directory_name>
npx degit lucia-auth/examples/nextjs-pages/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nextjs-pages/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nextjs-pages/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ It will also have a route to handle verification links.

### Clone project

You can get started immediately by cloning the [Nuxt example](https://github.com/lucia-auth/lucia/tree/main/examples/nuxt/email-and-password) from the repository.
You can get started immediately by cloning the [Nuxt example](https://github.com/lucia-auth/examples/tree/main/nuxt/email-and-password) from the repository.

```
npx degit lucia-auth/lucia/examples/nuxt/email-and-password <directory_name>
npx degit lucia-auth/examples/nuxt/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nuxt/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nuxt/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ It will also have a route to handle verification links.

### Clone project

You can get started immediately by cloning the [SvelteKit example](https://github.com/lucia-auth/lucia/tree/main/examples/sveltekit/email-and-password) from the repository.
You can get started immediately by cloning the [SvelteKit example](https://github.com/lucia-auth/examples/tree/main/sveltekit/email-and-password) from the repository.

```
npx degit lucia-auth/lucia/examples/sveltekit/email-and-password <directory_name>
npx degit lucia-auth/examples/sveltekit/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/sveltekit/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/sveltekit/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ To send the session token (ie. session id) from the server back to our applicati

### Clone project

You can get started immediately by cloning the [example](https://github.com/lucia-auth/lucia/tree/main/examples/electron/github-oauth) from the repository.
You can get started immediately by cloning the [example](https://github.com/lucia-auth/examples/tree/main/electron/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/electron/github-oauth <directory_name>
npx degit lucia-auth/examples/electron/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/electron/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/electron/github-oauth).

## Server

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth-native/expo.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ To send the session token (ie. session id) from the server back to our applicati

### Clone project

You can get started immediately by cloning the [example](https://github.com/lucia-auth/lucia/tree/main/examples/expo/github-oauth) from the repository.
You can get started immediately by cloning the [example](https://github.com/lucia-auth/examples/tree/main/expo/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/expo/github-oauth <directory_name>
npx degit lucia-auth/examples/expo/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/expo/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/expo/github-oauth).

## Server

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth-native/tauri.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ The strategy we'll be using is to create a super basic local server in the backg

### Clone project

You can get started immediately by cloning the [example](https://github.com/lucia-auth/lucia/tree/main/examples/tauri/github-oauth) from the repository.
You can get started immediately by cloning the [example](https://github.com/lucia-auth/examples/tree/main/tauri/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/tauri/github-oauth <directory_name>
npx degit lucia-auth/examples/tauri/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/tauri/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/tauri/github-oauth).

## Server

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$astro.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ As a general overview of OAuth, the user is redirected to github.com to be authe

### Clone project

You can get started immediately by cloning the [Astro example](https://github.com/lucia-auth/lucia/tree/main/examples/astro/github-oauth) from the repository.
You can get started immediately by cloning the [Astro example](https://github.com/lucia-auth/examples/tree/main/astro/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/astro/github-oauth <directory_name>
npx degit lucia-auth/examples/astro/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/astro/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/astro/github-oauth).

## Create an OAuth app

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$express.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ This guide will cover how to implement GitHub OAuth using Lucia in Express with

### Clone project

You can get started immediately by cloning the [Express example](https://github.com/lucia-auth/lucia/tree/main/examples/express/github-oauth) from the repository.
You can get started immediately by cloning the [Express example](https://github.com/lucia-auth/examples/tree/main/express/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/express/github-oauth <directory_name>
npx degit lucia-auth/examples/express/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/express/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/express/github-oauth).

## Create an OAuth app

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$nextjs-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ As a general overview of OAuth, the user is redirected to github.com to be authe

### Clone project

You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/lucia/tree/main/examples/nextjs-app/github-oauth) from the repository.
You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/examples/tree/main/nextjs-app/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/nextjs-app/github-oauth <directory_name>
npx degit lucia-auth/examples/nextjs-app/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nextjs-app/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nextjs-app/github-oauth).

## Create an OAuth app

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$nextjs-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ As a general overview of OAuth, the user is redirected to github.com to be authe

### Clone project

You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/lucia/tree/main/examples/nextjs-pages/github-oauth) from the repository.
You can get started immediately by cloning the [Next.js example](https://github.com/lucia-auth/examples/tree/main/nextjs-pages/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/nextjs-pages/github-oauth <directory_name>
npx degit lucia-auth/examples/nextjs-pages/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nextjs-pages/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nextjs-pages/github-oauth).

## Create an OAuth app

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ As a general overview of OAuth, the user is redirected to github.com to be authe

### Clone project

You can get started immediately by cloning the [Nuxt example](https://github.com/lucia-auth/lucia/tree/main/examples/nuxt/github-oauth) from the repository.
You can get started immediately by cloning the [Nuxt example](https://github.com/lucia-auth/examples/tree/main/nuxt/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/nuxt/github-oauth <directory_name>
npx degit lucia-auth/examples/nuxt/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nuxt/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nuxt/github-oauth).

## Create an OAuth app

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$solidstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ As a general overview of OAuth, the user is redirected to github.com to be authe

### Clone project

You can get started immediately by cloning the [SolidStart example](https://github.com/lucia-auth/lucia/tree/main/examples/solidstart/github-oauth) from the repository.
You can get started immediately by cloning the [SolidStart example](https://github.com/lucia-auth/examples/tree/main/solidstart/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/solidstart/github-oauth <directory_name>
npx degit lucia-auth/examples/solidstart/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/solidstart/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/solidstart/github-oauth).

## Create an OAuth app

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/github-oauth/$sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ As a general overview of OAuth, the user is redirected to github.com to be authe

### Clone project

You can get started immediately by cloning the [SvelteKit example](https://github.com/lucia-auth/lucia/tree/main/examples/sveltekit/github-oauth) from the repository.
You can get started immediately by cloning the [SvelteKit example](https://github.com/lucia-auth/examples/tree/main/sveltekit/github-oauth) from the repository.

```
npx degit lucia-auth/lucia/examples/sveltekit/github-oauth <directory_name>
npx degit lucia-auth/examples/sveltekit/github-oauth <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/sveltekit/github-oauth).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/sveltekit/github-oauth).

## Create an OAuth app

Expand Down
4 changes: 2 additions & 2 deletions documentation/content/guidebook/login-throttling.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ One simple approach is to use exponential backoff to increase the timeout on eve

## Basic example

The following example stores the attempts in memory. You can of course use a regular database but running it in within a transaction is recommended. The timeout doubles on every failed login attempt until the user is successfully authenticated. A [demo](https://github.com/lucia-auth/lucia/tree/main/examples/other/login-throttling) is available in the repository.
The following example stores the attempts in memory. You can of course use a regular database but running it in within a transaction is recommended. The timeout doubles on every failed login attempt until the user is successfully authenticated. A [demo](https://github.com/lucia-auth/examples/tree/main/other/login-throttling) is available in the repository.

```ts
const loginTimeout = new Map<
Expand Down Expand Up @@ -51,7 +51,7 @@ try {

One issue with the basic example above is that a valid user may be locked out if an attacker attempts to sign in. This is of course much better than being susceptible to brute force attacks, but one way to avoid it is to remember users/devices that signed in once and skipping the timeout for the first few attempts.

The following example stores the attempts and valid device cookies in memory. When a user is authenticated, a new device cookie is created. This cookie allows the user to bypass the throttling for the first 5 login attempts if they sign out. A [demo](https://github.com/lucia-auth/lucia/tree/main/examples/other/login-throtting-device-cookie) is available in the repository.
The following example stores the attempts and valid device cookies in memory. When a user is authenticated, a new device cookie is created. This cookie allows the user to bypass the throttling for the first 5 login attempts if they sign out. A [demo](https://github.com/lucia-auth/examples/tree/main/other/login-throtting-device-cookie) is available in the repository.

```ts
const loginTimeout = new Map<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export type Auth = typeof auth;

### Clone project

The [email and password Express example](https://github.com/lucia-auth/lucia/tree/main/examples/express/email-and-password) includes password reset.
The [email and password Express example](https://github.com/lucia-auth/examples/tree/main/express/email-and-password) includes password reset.

```
npx degit lucia-auth/lucia/examples/express/email-and-password <directory_name>
npx degit lucia-auth/examples/express/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/express/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/express/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export type Auth = typeof auth;

### Clone project

The [email and password Next.js example](https://github.com/lucia-auth/lucia/tree/main/examples/nextjs-app/email-and-password) includes password reset.
The [email and password Next.js example](https://github.com/lucia-auth/examples/tree/main/nextjs-app/email-and-password) includes password reset.

```
npx degit lucia-auth/lucia/examples/nextjs-app/email-and-password <directory_name>
npx degit lucia-auth/examples/nextjs-app/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nextjs-app/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nextjs-app/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export type Auth = typeof auth;

### Clone project

The [email and password Next.js example](https://github.com/lucia-auth/lucia/tree/main/examples/nextjs-pages/email-and-password) includes password reset.
The [email and password Next.js example](https://github.com/lucia-auth/examples/tree/main/nextjs-pages/email-and-password) includes password reset.

```
npx degit lucia-auth/lucia/examples/nextjs-pages/email-and-password <directory_name>
npx degit lucia-auth/examples/nextjs-pages/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nextjs-pages/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nextjs-pages/email-and-password).

## Database

Expand Down
6 changes: 3 additions & 3 deletions documentation/content/guidebook/password-reset-link/$nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export type Auth = typeof auth;

### Clone project

The [email and password Nuxt example](https://github.com/lucia-auth/lucia/tree/main/examples/nuxt/email-and-password) includes password reset.
The [email and password Nuxt example](https://github.com/lucia-auth/examples/tree/main/nuxt/email-and-password) includes password reset.

```
npx degit lucia-auth/lucia/examples/nuxt/email-and-password <directory_name>
npx degit lucia-auth/examples/nuxt/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/nuxt/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/nuxt/email-and-password).

## Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export type Auth = typeof auth;

### Clone project

The [email and password SvelteKit example](https://github.com/lucia-auth/lucia/tree/main/examples/sveltekit/email-and-password) includes password reset.
The [email and password SvelteKit example](https://github.com/lucia-auth/examples/tree/main/sveltekit/email-and-password) includes password reset.

```
npx degit lucia-auth/lucia/examples/sveltekit/email-and-password <directory_name>
npx degit lucia-auth/examples/sveltekit/email-and-password <directory_name>
```

Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/lucia/tree/main/examples/sveltekit/email-and-password).
Alternatively, you can [open it in StackBlitz](https://stackblitz.com/github/lucia-auth/examples/tree/main/sveltekit/email-and-password).

## Database

Expand Down
Loading

0 comments on commit 349c696

Please sign in to comment.