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,79 +0,0 @@
//Deploys the website to cloudflare pages under the domain nestri.io (redirects all requests to www.nestri.io to avoid duplicate content)
import { isPermanentStage } from "./stage";
export const www = new cloudflare.PagesProject("www", {
name: "nestri",
accountId: "8405b2acb6746935b975bc2cfcb5c288",
productionBranch: "main",
buildConfig: {
rootDir: "apps/www",
buildCommand: "bun run build",
destinationDir: "dist"
},
deploymentConfigs: {
production: {
compatibilityFlags: ["nodejs_compat"]
},
preview: {
compatibilityFlags: ["nodejs_compat"]
}
},
source: {
type: "github",
config: {
owner: "nestriness",
deploymentsEnabled: true,
productionBranch: "main",
repoName: "nestri",
productionDeploymentEnabled: true,
prCommentsEnabled: true,
}
}
});
//TODO: Maybe handle building Qwik ourselves? This prevents us from relying on CF too much, we are open-source anyway 🤷🏾‍♂️
//TODO: Add a local dev server for Qwik that can be linked with whatever we want
//TODO: Link the www PageRule with whatever we give to the local dev server
if (!isPermanentStage) {
new sst.x.DevCommand("www", {
dev: {
command: "bun run dev",
directory: "apps/www",
autostart: true,
},
})
}
// //This creates a resource that can be accessed by itself
// new sst.Linkable.wrap(cloudflare.PageRule, (resource) => ({
// // these properties will be available when linked
// properties: {
// arn: resource.urn
// }
// }))
// //And then you call your linkable resource like this:
// // const www = cloudflare.PageRule("www", {})
// //this creates a linkable resource that can be linked to other resources
// export const linkable2 = new sst.Linkable("ExistingResource", {
// properties: {
// arn: "arn:aws:s3:::nestri-website-artifacts-prod-nestri-io-01h70zg50qz5z"
// },
// include: [
// sst.aws.permission({
// actions: ["s3:*"],
// resources: ["arn:aws:s3:::nestri-website-artifacts-prod-nestri-io-01h70zg50qz5z"]
// }),
// sst.cloudflare.binding({
// type: "r2BucketBindings",
// properties: {
// bucketName: "nestri-website-artifacts-prod-nestri-io-01h70zg50qz5z",
// }
// })
// ]
// })
export const outputs = {
www: www.subdomain,
};