feat: Add auth flow (#146)

This adds a simple way to incorporate a centralized authentication flow.

The idea is to have the user, API and SSH (for machine authentication)
all in one place using `openauthjs` + `SST`

We also have a database now :)

> We are using InstantDB as it allows us to authenticate a use with just
the email. Plus it is super simple simple to use _of course after the
initial fumbles trying to design the db and relationships_
This commit is contained in:
Wanjohi
2025-01-04 00:02:28 +03:00
committed by GitHub
parent 33895974a7
commit fc5a755408
136 changed files with 3512 additions and 1914 deletions

View File

@@ -1,7 +1,14 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
"@nestri/eslint-config/qwik.js",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:qwik/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
@@ -12,5 +19,24 @@ module.exports = {
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",
},
};

View File

@@ -29,9 +29,9 @@
"@fontsource/geist-sans": "^5.1.0",
"@modular-forms/qwik": "0.26.1",
"@nestri/core": "*",
"@nestri/eslint-config": "*",
"@nestri/typescript-config": "*",
"@types/eslint": "^8.56.5",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"@types/node": "^20.11.24",
"@types/nprogress": "^0.2.3",
"@types/react": "^18.2.28",
@@ -40,10 +40,12 @@
"body-scroll-lock-upgrade": "^1.1.0",
"clsx": "^2.1.1",
"eslint": "^8.57.0",
"eslint-plugin-qwik": "latest",
"focus-trap": "^7.5.4",
"framer-motion": "^11.3.24",
"nprogress": "^0.2.0",
"postcss": "^8.4.41",
"prettier": "latest",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-wrap-balancer": "^1.1.1",

View File

@@ -1,2 +1,2 @@
export * from "./image-loader.tsx"
export * from "./basic-image-loader.tsx"
export * from "./image-loader"
export * from "./basic-image-loader"

42
packages/ui/sst-env.d.ts vendored Normal file
View File

@@ -0,0 +1,42 @@
/* This file is auto-generated by SST. Do not edit. */
/* tslint:disable */
/* eslint-disable */
/* deno-fmt-ignore-file */
import "sst"
export {}
declare module "sst" {
export interface Resource {
"Api": {
"type": "sst.cloudflare.Worker"
"url": string
}
"Auth": {
"type": "sst.cloudflare.Worker"
"url": string
}
"AuthFingerprintKey": {
"type": "random.index/randomString.RandomString"
"value": string
}
"CloudflareAuthKV": {
"type": "sst.cloudflare.Kv"
}
"InstantAdminToken": {
"type": "sst.sst.Secret"
"value": string
}
"InstantAppId": {
"type": "sst.sst.Secret"
"value": string
}
"LoopsApiKey": {
"type": "sst.sst.Secret"
"value": string
}
"Urls": {
"api": string
"auth": string
"type": "sst.sst.Linkable"
}
}
}

View File

@@ -1,10 +1,26 @@
{
"extends": "@nestri/typescript-config/base.json",
"compilerOptions": {
"allowJs": true,
"target": "ES2017",
"rootDir": "./",
"module": "ES2022",
"lib": ["es2022", "DOM", "WebWorker", "DOM.Iterable"],
"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik",
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"moduleResolution": "Bundler",
"esModuleInterop": true,
"skipLibCheck": true,
"incremental": true,
"isolatedModules": true,
"outDir": "tmp",
"rootDir": ".",
"allowImportingTsExtensions": true
"noEmit": true,
"paths": {
"@/*": ["./src/*"]
}
},
"files": [".eslintrc.cjs"],
"include": ["src", "./*.d.ts"]
}
"files": ["./.eslintrc.cjs"],
"include": ["src", "./*.d.ts", "./*.config.ts","./*.config.js"]
}

View File

@@ -1,9 +0,0 @@
{
"extends": "@nestri/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist",
"allowImportingTsExtensions": true
},
"include": ["src", "./*.config.js","./.eslintrc.js"],
"exclude": ["node_modules", "dist"]
}