Skip to content

Commit

Permalink
Add lucia-drizzle-sqlite-turso-qwik example
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavocadev committed Feb 17, 2024
1 parent c2b6b67 commit 8fe349c
Show file tree
Hide file tree
Showing 31 changed files with 10,113 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL=
DATABASE_AUTH_TOKEN=
38 changes: 38 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
**/*.log
**/.DS_Store
*.
.vscode/settings.json
.history
.yarn
bazel-*
bazel-bin
bazel-out
bazel-qwik
bazel-testlogs
dist
dist-dev
lib
lib-types
etc
external
node_modules
temp
tsc-out
tsdoc-metadata.json
target
output
rollup.config.js
build
.cache
.vscode
.rollup.cache
dist
tsconfig.tsbuildinfo
vite.config.ts
*.spec.tsx
*.spec.ts
.netlify
pnpm-lock.yaml
package-lock.json
yarn.lock
server
42 changes: 42 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:qwik/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
ecmaVersion: 2021,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"prefer-spread": "off",
"no-case-declarations": "off",
"no-console": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
},
};
47 changes: 47 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Build
/dist
/lib
/lib-types
/server

# Env
.env

# DB
db.sqlite

# Development
node_modules
*.local

# Cache
.cache
.mf
.rollup.cache
tsconfig.tsbuildinfo

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Editor
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets

.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Yarn
.yarn/*
!.yarn/releases
38 changes: 38 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
**/*.log
**/.DS_Store
*.
.vscode/settings.json
.history
.yarn
bazel-*
bazel-bin
bazel-out
bazel-qwik
bazel-testlogs
dist
dist-dev
# lib
lib-types
etc
external
node_modules
temp
tsc-out
tsdoc-metadata.json
target
output
rollup.config.js
build
.cache
.vscode
.rollup.cache
dist
tsconfig.tsbuildinfo
vite.config.ts
*.spec.tsx
*.spec.ts
.netlify
pnpm-lock.yaml
package-lock.json
yarn.lock
server
3 changes: 3 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
plugins: ['prettier-plugin-tailwindcss'],
}
32 changes: 32 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Username & password example with Lucia and Qwik City

This example uses `@libsql/client` with Turso and Drizzle ORM.

```bash
# install dependencies
pnpm i

# run drizzle kit
pnpm db:push

# run dev server
pnpm dev
```

## Runtime

This example is built for Node.js 20. If you're using Node.js 16/18, un-comment the following lines in `auth/lucia.ts`:

```ts
// import "lucia/polyfill/node";
```

## User schema

| id | type | unique |
| ------------ | -------- | :----: |
| `id` | `string` | |
| `username` | `string` ||
| `names` | `string` | |
| `last_names` | `string` | |
| `email` | `string` ||
13 changes: 13 additions & 0 deletions examples/lucia-drizzle-sqlite-turso-qwik/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "drizzle-kit";
import * as dotenv from "dotenv";
dotenv.config();

export default defineConfig({
schema: "./src/lib/schema.ts",
out: "./drizzle",
driver: "turso",
dbCredentials: {
url: process.env.DATABASE_URL!,
authToken: process.env.DATABASE_AUTH_TOKEN,
},
});
Loading

0 comments on commit 8fe349c

Please sign in to comment.