Skip to content

Commit

Permalink
Add Neon HTTP adapter (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Feb 6, 2024
1 parent 3e337fe commit 40ee158
Show file tree
Hide file tree
Showing 69 changed files with 806 additions and 630 deletions.
54 changes: 27 additions & 27 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ description: Something ain't right...
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Before you start, make sure you have the latest versions of the packages you're using, including adapters. For security issues, please contact the maintainers directly.
- type: dropdown
id: package
attributes:
label: Package
description: What package is affected?
options:
- lucia
- ​@lucia-auth/adapter-test
- ​@lucia-auth/adapter-mongodb
- ​@lucia-auth/adapter-mysql
- ​@lucia-auth/adapter-postgresql
- ​@lucia-auth/adapter-prisma
- ​@lucia-auth/adapter-sqlite
- ​@lucia-auth/session-drizzle
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: Also tell us, what was the expected behavior? Reproduction will be super helpful!
validations:
required: true
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Before you start, make sure you have the latest versions of the packages you're using, including adapters. For security issues, please contact the maintainers directly.
- type: dropdown
id: package
attributes:
label: Package
description: What package is affected?
options:
- lucia
- ​@lucia-auth/adapter-test
- ​@lucia-auth/adapter-mongodb
- ​@lucia-auth/adapter-mysql
- ​@lucia-auth/adapter-postgresql
- ​@lucia-auth/adapter-prisma
- ​@lucia-auth/adapter-sqlite
- ​@lucia-auth/session-drizzle
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: Also tell us, what was the expected behavior? Reproduction will be super helpful!
validations:
required: true
20 changes: 10 additions & 10 deletions .github/ISSUE_TEMPLATE/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ description: Tell us how we can improve the contents of the docs!
title: "[Docs]: "
labels: ["documentation"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this form!
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this form!
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
50 changes: 25 additions & 25 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ description: Propose and discuss future improvements to Lucia
title: "[Feature Request]: "
labels: ["feature request"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: dropdown
id: package
attributes:
label: Package
options:
- lucia
- ​@lucia-auth/adapter-test
- ​@lucia-auth/adapter-mongodb
- ​@lucia-auth/adapter-mysql
- ​@lucia-auth/adapter-postgresql
- ​@lucia-auth/adapter-prisma
- ​@lucia-auth/adapter-sqlite
- ​@lucia-auth/session-drizzle
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: dropdown
id: package
attributes:
label: Package
options:
- lucia
- ​@lucia-auth/adapter-test
- ​@lucia-auth/adapter-mongodb
- ​@lucia-auth/adapter-mysql
- ​@lucia-auth/adapter-postgresql
- ​@lucia-auth/adapter-prisma
- ​@lucia-auth/adapter-sqlite
- ​@lucia-auth/session-drizzle
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
46 changes: 23 additions & 23 deletions .github/workflows/auri.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: "Auri"
on:
push:
branches:
- main
push:
branches:
- main

env:
AURI_GITHUB_TOKEN: ${{secrets.AURI_GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
AURI_GITHUB_TOKEN: ${{secrets.AURI_GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}

jobs:
auri:
runs-on: ubuntu-latest
steps:
- name: setup actions
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20.5.1
registry-url: https://registry.npmjs.org
- name: install dependencies
run: |
npm i -g pnpm
pnpm install --no-frozen-lockfile
- name: publish
run: pnpm exec auri publish
- name: prepare
run: pnpm exec auri prepare
auri:
runs-on: ubuntu-latest
steps:
- name: setup actions
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20.5.1
registry-url: https://registry.npmjs.org
- name: install dependencies
run: |
npm i -g pnpm
pnpm install --no-frozen-lockfile
- name: publish
run: pnpm exec auri publish
- name: prepare
run: pnpm exec auri prepare
54 changes: 27 additions & 27 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: "Publish docs"
on:
push:
branches:
- main
push:
branches:
- main

env:
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_PAGES_API_TOKEN}}
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_PAGES_API_TOKEN}}

jobs:
publish-docs:
name: Publish docs
runs-on: ubuntu-latest
steps:
- name: setup actions
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20.5.1
registry-url: https://registry.npmjs.org
- name: install malta
working-directory: docs
run: |
curl -o malta.tgz -L https://github.com/pilcrowonpaper/malta/releases/latest/download/linux-amd64.tgz
tar -xvzf malta.tgz
- name: build
working-directory: docs
run: ./linux-amd64/malta build
- name: install wrangler
run: npm i -g wrangler
- name: deploy
run: wrangler pages deploy docs/dist --project-name lucia --branch main
publish-docs:
name: Publish docs
runs-on: ubuntu-latest
steps:
- name: setup actions
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20.5.1
registry-url: https://registry.npmjs.org
- name: install malta
working-directory: docs
run: |
curl -o malta.tgz -L https://github.com/pilcrowonpaper/malta/releases/latest/download/linux-amd64.tgz
tar -xvzf malta.tgz
- name: build
working-directory: docs
run: ./linux-amd64/malta build
- name: install wrangler
run: npm i -g wrangler
- name: deploy
run: wrangler pages deploy docs/dist --project-name lucia --branch main
54 changes: 27 additions & 27 deletions .github/workflows/v2-docs.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: "Publish v2 docs"
on:
push:
branches:
- v2
push:
branches:
- v2

env:
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_PAGES_API_TOKEN}}
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_PAGES_API_TOKEN}}

jobs:
publish-docs:
name: Publish docs
runs-on: ubuntu-latest
steps:
- name: setup actions
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20.5.1
registry-url: https://registry.npmjs.org
- name: Install PNPM
run: npm i -g pnpm
- name: Install dependencies
run: pnpm i
- name: Build
working-directory: documentation
run: pnpm build
- name: Install wrangler
run: npm i -g wrangler
- name: deploy
working-directory: documentation
run: wrangler pages deploy dist --project-name lucia-v2 --branch v2
publish-docs:
name: Publish docs
runs-on: ubuntu-latest
steps:
- name: setup actions
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20.5.1
registry-url: https://registry.npmjs.org
- name: Install PNPM
run: npm i -g pnpm
- name: Install dependencies
run: pnpm i
- name: Build
working-directory: documentation
run: pnpm build
- name: Install wrangler
run: npm i -g wrangler
- name: deploy
working-directory: documentation
run: wrangler pages deploy dist --project-name lucia-v2 --branch v2
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Lucia is an auth library written in TypeScript that abstracts away the complexity of handling sessions. It works alongside your database to provide an API that's easy to use, understand, and extend.

- No more endless configuration and callbacks
- Fully typed
- Works in any runtime - Node.js, Bun, Deno, Cloudflare Workers
- Extensive database support out of the box
- No more endless configuration and callbacks
- Fully typed
- Works in any runtime - Node.js, Bun, Deno, Cloudflare Workers
- Extensive database support out of the box

```ts
import { Lucia } from "lucia";
Expand Down
16 changes: 8 additions & 8 deletions docs/pages/database/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ See [`Adapter`](/reference/main/Adapter) for building your own adapters.

Refer to these guides on setting up your database, ORMs, and query builders:

- [Drizzle ORM](/database/drizzle)
- [Kysely](/database/kysely)
- [MongoDB](/database/mongodb)
- [Mongoose](/database/mongoose)
- [MySQL](/database/mysql): `mysql2`, PlanetScale serverless
- [PostgreSQL](/database/postgresql): node-postgres (`pg`), Postgres.js (`postgres`)
- [Prisma](/database/prisma)
- [SQLite](/database/sqlite): `better-sqlite3`, Bun SQLite (`bun:sqlite`), Cloudflare D1, LibSQL (Turso)
- [Drizzle ORM](/database/drizzle)
- [Kysely](/database/kysely)
- [MongoDB](/database/mongodb)
- [Mongoose](/database/mongoose)
- [MySQL](/database/mysql): `mysql2`, PlanetScale serverless
- [PostgreSQL](/database/postgresql): Neon HTTP serverless driver, node-postgres (`pg`), Postgres.js (`postgres`)
- [Prisma](/database/prisma)
- [SQLite](/database/sqlite): `better-sqlite3`, Bun SQLite (`bun:sqlite`), Cloudflare D1, LibSQL (Turso)
4 changes: 2 additions & 2 deletions docs/pages/database/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ title: "MySQL"

`@lucia-auth/adapter-mysql` package provides adapters for MySQL drivers:

- `mysql2`
- PlanetScale serverless
- `mysql2`
- PlanetScale serverless

```
npm install @lucia-auth/adapter-mysql
Expand Down
22 changes: 20 additions & 2 deletions docs/pages/database/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ title: "PostgreSQL"

`@lucia-auth/adapter-postgresql` package provides adapters for PostgreSQL drivers:

- node-postgres (`pg`)
- Postgres.js (`postgres`)
- Neon HTTP serverless driver (`@neondatabase/serverless`)
- node-postgres (`pg`)
- Postgres.js (`postgres`)

```
npm install @lucia-auth/adapter-postgresql
Expand All @@ -29,6 +30,23 @@ CREATE TABLE user_session (

## Drivers

### Neon HTTP serverless driver

`NeonHTTPAdapter` takes a `NeonQueryFunction` and a list of table names. Supports both `fullResults` configuration. Use the node-postgres adapter for the WebSocket driver.

```ts
import { Lucia } from "lucia";
import { NeonHTTPAdapter } from "@lucia-auth/adapter-postgresql";
import { neon } from "@neondatabase/serverless";

const sql = neon();

const adapter = new NeonHTTPAdapter(sql, {
user: "auth_user",
session: "user_session"
});
```

### node-postgres

`NodePostgresAdapter` takes a `Pool` or `Client` instance and a list of table names.
Expand Down
Loading

0 comments on commit 40ee158

Please sign in to comment.