Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update koa boilerplate as scaffolding #135

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions boilerplate/backend/koa/appInfo.ts

This file was deleted.

28 changes: 20 additions & 8 deletions boilerplate/backend/koa/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
return "";
}

export function getWebsiteDomain() {
return "";
}

export const SuperTokensConfig: TypeInput = {
appInfo,
supertokens: {
connectionURI: "https://try.supertokens.io",
// this is the location of the SuperTokens core.
connectionURI: "",
},
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "",
apiDomain: "",
websiteDomain: "",
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [],
};

export const recipeList = [];
22 changes: 19 additions & 3 deletions boilerplate/backend/koa/config/all_auth.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import { appInfo } from "./appInfo";
import ThirdParty from "supertokens-node/recipe/thirdparty";
import Passwordless from "supertokens-node/recipe/passwordless";
import { TypeInput } from "supertokens-node/types";
import UserRoles from "supertokens-node/recipe/userroles";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
Expand Down
21 changes: 19 additions & 2 deletions boilerplate/backend/koa/config/emailpassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,30 @@ import Session from "supertokens-node/recipe/session";
import { TypeInput } from "supertokens-node/types";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
recipeList: [EmailPassword.init(), Session.init(), Dashboard.init(), UserRoles.init()],
};
21 changes: 18 additions & 3 deletions boilerplate/backend/koa/config/multifactorauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,32 @@ import MultiFactorAuth from "supertokens-node/recipe/multifactorauth";
import AccountLinking from "supertokens-node/recipe/accountlinking";
import EmailVerification from "supertokens-node/recipe/emailverification";
import TOTP from "supertokens-node/recipe/totp";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
Expand Down
21 changes: 18 additions & 3 deletions boilerplate/backend/koa/config/multitenancy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@ import Passwordless from "supertokens-node/recipe/passwordless";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";
import ThirdParty from "supertokens-node/recipe/thirdparty";
import EmailPassword from "supertokens-node/recipe/emailpassword";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
Expand Down
21 changes: 18 additions & 3 deletions boilerplate/backend/koa/config/passwordless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,32 @@ import Passwordless from "supertokens-node/recipe/passwordless";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
Expand Down
21 changes: 18 additions & 3 deletions boilerplate/backend/koa/config/thirdparty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,32 @@ import ThirdParty from "supertokens-node/recipe/thirdparty";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
Expand Down
27 changes: 21 additions & 6 deletions boilerplate/backend/koa/config/thirdpartyemailpassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,37 @@ import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
EmailPasswordNode.init(),
ThirdPartyNode.init({
EmailPassword.init(),
ThirdParty.init({
signInAndUpFeature: {
providers: [
// We have provided you with development keys which you can use for testing.
Expand Down Expand Up @@ -76,7 +91,7 @@ export const SuperTokensConfig: TypeInput = {
],
},
}),
SessionNode.init(),
Session.init(),
Dashboard.init(),
UserRoles.init(),
],
Expand Down
21 changes: 18 additions & 3 deletions boilerplate/backend/koa/config/thirdpartypasswordless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,32 @@ import Passwordless from "supertokens-node/recipe/passwordless";
import Session from "supertokens-node/recipe/session";
import Dashboard from "supertokens-node/recipe/dashboard";
import UserRoles from "supertokens-node/recipe/userroles";
import { appInfo } from "./appInfo";
import { TypeInput } from "supertokens-node/types";
import SuperTokens from "supertokens-node";

export function getApiDomain() {
const apiPort = process.env.VITE_APP_API_PORT || 3001;
const apiUrl = process.env.VITE_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}

export function getWebsiteDomain() {
const websitePort = process.env.VITE_APP_WEBSITE_PORT || 3000;
const websiteUrl = process.env.VITE_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}

export const SuperTokensConfig: TypeInput = {
framework: "koa",
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: "https://try.supertokens.com",
},
appInfo,
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "SuperTokens Koa demo app",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
// recipeList contains all the modules that you want to
// use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
recipeList: [
Expand Down
11 changes: 11 additions & 0 deletions boilerplate/backend/koa/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading