startx 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +0 -13
- package/.prettierrc.js +52 -52
- package/.vscode/launch.json +32 -0
- package/.vscode/settings.json +9 -3
- package/apps/core-server/.env.example +18 -24
- package/apps/core-server/Dockerfile +35 -61
- package/apps/core-server/eslint.config.ts +7 -0
- package/apps/core-server/package.json +41 -52
- package/apps/core-server/src/config/custom-type.ts +2 -40
- package/apps/core-server/src/events/index.ts +37 -37
- package/apps/core-server/src/index.ts +4 -13
- package/apps/core-server/src/middlewares/auth-middleware.ts +24 -7
- package/apps/core-server/src/middlewares/cors-middleware.ts +7 -6
- package/apps/core-server/src/middlewares/error-middleware.ts +7 -4
- package/apps/core-server/src/middlewares/logger-middleware.ts +81 -21
- package/apps/core-server/src/middlewares/notfound-middleware.ts +6 -14
- package/apps/core-server/src/middlewares/serve-static.ts +30 -24
- package/apps/core-server/src/routes/files/router.ts +9 -7
- package/apps/core-server/src/routes/server.ts +30 -36
- package/apps/core-server/tsdown.config.ts +4 -3
- package/biome.json +58 -60
- package/configs/eslint-config/package.json +16 -19
- package/configs/eslint-config/src/configs/base.ts +185 -225
- package/configs/eslint-config/src/configs/extend.ts +3 -0
- package/configs/eslint-config/src/configs/frontend.ts +81 -56
- package/configs/eslint-config/src/configs/node.ts +6 -6
- package/configs/eslint-config/src/plugin.ts +1 -0
- package/configs/eslint-config/src/rules/index.ts +8 -12
- package/configs/eslint-config/src/rules/no-json-parse-json-stringify.test.ts +30 -17
- package/configs/eslint-config/src/rules/no-json-parse-json-stringify.ts +52 -49
- package/configs/eslint-config/src/rules/no-uncaught-json-parse.ts +43 -45
- package/configs/tsdown-config/package.json +10 -3
- package/configs/typescript-config/package.json +10 -1
- package/configs/typescript-config/tsconfig.common.json +3 -3
- package/configs/vitest-config/dist/base.mjs +1 -0
- package/configs/vitest-config/dist/frontend.mjs +1 -0
- package/configs/vitest-config/dist/node.mjs +1 -0
- package/configs/vitest-config/package.json +12 -0
- package/configs/vitest-config/src/base.ts +17 -29
- package/configs/vitest-config/src/index.ts +1 -0
- package/package.json +21 -13
- package/packages/@repo/constants/eslint.config.ts +4 -0
- package/packages/@repo/constants/package.json +16 -0
- package/packages/@repo/constants/src/index.ts +8 -8
- package/packages/@repo/db/eslint.config.ts +4 -0
- package/packages/@repo/db/package.json +16 -8
- package/packages/@repo/db/src/index.ts +26 -20
- package/packages/@repo/db/src/schema/common.ts +45 -49
- package/packages/@repo/env/eslint.config.ts +4 -0
- package/packages/@repo/env/package.json +39 -0
- package/packages/@repo/env/src/default-env.ts +12 -0
- package/packages/@repo/env/src/define-env.ts +70 -0
- package/packages/@repo/env/src/index.ts +2 -0
- package/packages/@repo/env/src/utils.ts +52 -0
- package/packages/@repo/env/tsconfig.json +7 -0
- package/packages/@repo/lib/eslint.config.ts +4 -0
- package/packages/@repo/lib/package.json +34 -34
- package/packages/@repo/lib/src/bucket-module/file-storage.ts +50 -49
- package/packages/@repo/lib/src/bucket-module/index.ts +3 -0
- package/packages/@repo/lib/src/bucket-module/s3-storage.ts +120 -114
- package/packages/@repo/lib/src/bucket-module/utils.ts +10 -11
- package/packages/@repo/lib/src/{cookie-module.ts → cookie-module/cookie-module.ts} +48 -42
- package/packages/@repo/lib/src/cookie-module/index.ts +1 -0
- package/packages/@repo/lib/src/extra/index.ts +1 -0
- package/packages/@repo/lib/src/extra/pagination-module.ts +35 -0
- package/packages/@repo/lib/src/{token-module.ts → extra/token-module.ts} +12 -5
- package/packages/@repo/lib/src/file-system-module/index.ts +170 -0
- package/packages/@repo/lib/src/{hashing-module.ts → hashing-module/index.ts} +9 -9
- package/packages/@repo/lib/src/index.ts +0 -26
- package/packages/@repo/lib/src/mail-module/index.ts +2 -0
- package/packages/@repo/lib/src/mail-module/mock.ts +8 -8
- package/packages/@repo/lib/src/mail-module/nodemailer.ts +17 -7
- package/packages/@repo/lib/src/notification-module/index.ts +1 -172
- package/packages/@repo/lib/src/notification-module/push-notification.ts +97 -90
- package/packages/@repo/lib/src/{oauth2-client.ts → oauth2-module/index.ts} +107 -109
- package/packages/@repo/lib/src/otp-module/index.ts +91 -0
- package/packages/@repo/lib/src/session-module/index.ts +113 -0
- package/packages/@repo/lib/src/utils.ts +43 -42
- package/packages/@repo/lib/src/validation-module/index.ts +242 -0
- package/packages/@repo/logger/eslint.config.ts +4 -0
- package/packages/@repo/logger/package.json +40 -0
- package/packages/@repo/logger/src/index.ts +2 -0
- package/packages/@repo/logger/src/logger.ts +72 -0
- package/packages/@repo/{lib/src/logger-module → logger/src}/memory-profiler.ts +64 -65
- package/packages/@repo/logger/tsconfig.json +7 -0
- package/packages/@repo/mail/eslint.config.ts +4 -0
- package/packages/@repo/mail/package.json +10 -3
- package/packages/@repo/mail/src/emails/admin/OtpEmail.tsx +169 -168
- package/packages/@repo/mail/src/index.ts +1 -2
- package/packages/@repo/mail/tsconfig.json +3 -3
- package/packages/@repo/redis/dist/index.d.mts +3 -0
- package/packages/@repo/redis/dist/index.mjs +5 -0
- package/packages/@repo/redis/dist/lib/redis-client.d.mts +7 -0
- package/packages/@repo/redis/dist/lib/redis-client.mjs +25 -0
- package/packages/@repo/redis/dist/lib/redis-client.mjs.map +1 -0
- package/packages/@repo/redis/dist/lib/redis-module.d.mts +5 -0
- package/packages/@repo/redis/dist/lib/redis-module.mjs +6 -0
- package/packages/@repo/redis/dist/lib/redis-module.mjs.map +1 -0
- package/packages/@repo/redis/eslint.config.ts +4 -0
- package/packages/@repo/redis/package.json +13 -10
- package/packages/@repo/redis/src/index.ts +2 -2
- package/packages/@repo/redis/src/lib/redis-client.ts +36 -23
- package/packages/@repo/redis/src/lib/redis-module.ts +69 -3
- package/packages/cli/dist/index.mjs +203 -0
- package/packages/cli/eslint.config.ts +4 -0
- package/packages/cli/package.json +44 -0
- package/packages/cli/tsconfig.json +12 -0
- package/packages/cli/tsdown.config.ts +17 -0
- package/packages/ui/components.json +0 -1
- package/packages/ui/eslint.config.ts +4 -0
- package/packages/ui/package.json +16 -3
- package/packages/ui/postcss.config.mjs +9 -9
- package/packages/ui/src/components/lib/utils.ts +53 -53
- package/packages/ui/src/components/ui/alert-dialog.tsx +118 -116
- package/packages/ui/src/components/ui/avatar.tsx +52 -53
- package/packages/ui/src/components/ui/badge.tsx +45 -46
- package/packages/ui/src/components/ui/breadcrumb.tsx +108 -109
- package/packages/ui/src/components/ui/card.tsx +91 -92
- package/packages/ui/src/components/ui/carousel.tsx +243 -243
- package/packages/ui/src/components/ui/checkbox.tsx +32 -32
- package/packages/ui/src/components/ui/command.tsx +144 -155
- package/packages/ui/src/components/ui/dialog.tsx +124 -127
- package/packages/ui/src/components/ui/form.tsx +166 -165
- package/packages/ui/src/components/ui/input-otp.tsx +74 -76
- package/packages/ui/src/components/ui/input.tsx +19 -21
- package/packages/ui/src/components/ui/multiple-select.tsx +4 -4
- package/packages/ui/src/{components/lucide.tsx → lucide.ts} +3 -3
- package/packages/ui/tailwind.config.ts +94 -94
- package/packages/ui/tsconfig.json +7 -1
- package/pnpm-workspace.yaml +41 -1
- package/turbo.json +20 -27
- package/apps/core-server/eslint.config.mjs +0 -47
- package/configs/eslint-config/src/rules/no-dynamic-import-template.ts +0 -32
- package/configs/eslint-config/src/rules/no-plain-errors.ts +0 -50
- package/configs/eslint-config/tsdown.config.ts +0 -11
- package/packages/@repo/constants/eslint.config.mjs +0 -21
- package/packages/@repo/db/eslint.config.mjs +0 -21
- package/packages/@repo/lib/eslint.config.mjs +0 -49
- package/packages/@repo/lib/src/command-module.ts +0 -77
- package/packages/@repo/lib/src/constants.ts +0 -3
- package/packages/@repo/lib/src/custom-type.ts +0 -54
- package/packages/@repo/lib/src/env.ts +0 -13
- package/packages/@repo/lib/src/file-system/index.ts +0 -90
- package/packages/@repo/lib/src/logger-module/log-config.ts +0 -16
- package/packages/@repo/lib/src/logger-module/logger.ts +0 -78
- package/packages/@repo/lib/src/mail-module/api.ts +0 -0
- package/packages/@repo/lib/src/otp-module.ts +0 -98
- package/packages/@repo/lib/src/pagination-module.ts +0 -49
- package/packages/@repo/lib/src/user-session.ts +0 -117
- package/packages/@repo/lib/src/validation-module.ts +0 -187
- package/packages/@repo/mail/tsconfig.build.json +0 -14
- package/packages/@repo/mail/tsdown.config.ts +0 -9
- package/packages/@repo/redis/eslint.config.mjs +0 -8
- package/packages/ui/eslint.config.mjs +0 -18
package/.prettierignore
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
coverage
|
|
2
2
|
dist
|
|
3
3
|
pnpm-lock.yaml
|
|
4
|
-
packages/frontend/editor-ui/index.html
|
|
5
|
-
packages/nodes-base/nodes/**/test
|
|
6
|
-
packages/cli/templates/form-trigger.handlebars
|
|
7
|
-
packages/cli/templates/form-trigger-completion.handlebars
|
|
8
|
-
packages/cli/templates/form-trigger-409.handlebars
|
|
9
|
-
packages/cli/templates/form-trigger-404.handlebars
|
|
10
|
-
cypress/fixtures
|
|
11
4
|
CHANGELOG.md
|
|
12
|
-
.github/pull_request_template.md
|
|
13
5
|
# Ignored for now
|
|
14
6
|
**/*.md
|
|
15
7
|
# Handled by biome
|
|
@@ -17,8 +9,3 @@ CHANGELOG.md
|
|
|
17
9
|
**/*.js
|
|
18
10
|
**/*.tsx
|
|
19
11
|
**/*.jsx
|
|
20
|
-
|
|
21
|
-
# Auto-generated
|
|
22
|
-
**/components.d.ts
|
|
23
|
-
|
|
24
|
-
justfile
|
package/.prettierrc.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
/**
|
|
3
|
-
* https://prettier.io/docs/en/options.html#semicolons
|
|
4
|
-
*/
|
|
5
|
-
semi: true,
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* https://prettier.io/docs/en/options.html#trailing-commas
|
|
9
|
-
*/
|
|
10
|
-
trailingComma: "all",
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* https://prettier.io/docs/en/options.html#bracket-spacing
|
|
14
|
-
*/
|
|
15
|
-
bracketSpacing: true,
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* https://prettier.io/docs/en/options.html#tabs
|
|
19
|
-
*/
|
|
20
|
-
useTabs: true,
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* https://prettier.io/docs/en/options.html#tab-width
|
|
24
|
-
*/
|
|
25
|
-
tabWidth: 2,
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* https://prettier.io/docs/en/options.html#arrow-function-parentheses
|
|
29
|
-
*/
|
|
30
|
-
arrowParens: "always",
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* https://prettier.io/docs/en/options.html#quotes
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
doubleQuote: true,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* https://prettier.io/docs/en/options.html#quote-props
|
|
40
|
-
*/
|
|
41
|
-
quoteProps: "as-needed",
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* https://prettier.io/docs/en/options.html#end-of-line
|
|
45
|
-
*/
|
|
46
|
-
endOfLine: "lf",
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* https://prettier.io/docs/en/options.html#print-width
|
|
50
|
-
*/
|
|
51
|
-
printWidth: 100,
|
|
52
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* https://prettier.io/docs/en/options.html#semicolons
|
|
4
|
+
*/
|
|
5
|
+
semi: true,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* https://prettier.io/docs/en/options.html#trailing-commas
|
|
9
|
+
*/
|
|
10
|
+
trailingComma: "all",
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* https://prettier.io/docs/en/options.html#bracket-spacing
|
|
14
|
+
*/
|
|
15
|
+
bracketSpacing: true,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* https://prettier.io/docs/en/options.html#tabs
|
|
19
|
+
*/
|
|
20
|
+
useTabs: true,
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* https://prettier.io/docs/en/options.html#tab-width
|
|
24
|
+
*/
|
|
25
|
+
tabWidth: 2,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* https://prettier.io/docs/en/options.html#arrow-function-parentheses
|
|
29
|
+
*/
|
|
30
|
+
arrowParens: "always",
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* https://prettier.io/docs/en/options.html#quotes
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
doubleQuote: true,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* https://prettier.io/docs/en/options.html#quote-props
|
|
40
|
+
*/
|
|
41
|
+
quoteProps: "as-needed",
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* https://prettier.io/docs/en/options.html#end-of-line
|
|
45
|
+
*/
|
|
46
|
+
endOfLine: "lf",
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* https://prettier.io/docs/en/options.html#print-width
|
|
50
|
+
*/
|
|
51
|
+
printWidth: 100,
|
|
52
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Debug Core Server",
|
|
6
|
+
"type": "node",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"runtimeExecutable": "pnpm",
|
|
9
|
+
"runtimeArgs": ["run", "dev:debug"],
|
|
10
|
+
"cwd": "${workspaceFolder}/apps/core-server",
|
|
11
|
+
"attachSimplePort": 9229,
|
|
12
|
+
"console": "integratedTerminal"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Debug Another Server",
|
|
16
|
+
"type": "node",
|
|
17
|
+
"request": "launch",
|
|
18
|
+
"runtimeExecutable": "pnpm",
|
|
19
|
+
"runtimeArgs": ["run", "dev:debug"],
|
|
20
|
+
"cwd": "${workspaceFolder}/apps/another-server",
|
|
21
|
+
"attachSimplePort": 9230,
|
|
22
|
+
"console": "integratedTerminal"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"compounds": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Debug ALL Servers",
|
|
28
|
+
"configurations": ["Debug Core Server", "Debug Another Server"],
|
|
29
|
+
"stopAll": true
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
package/.vscode/settings.json
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
# .{yourdomain}
|
|
2
|
-
COOKIE_DOMAIN = localhost
|
|
3
|
-
ACCESS_TOKEN_SECRET =
|
|
4
|
-
REFRESH_TOKEN_SECRET =
|
|
5
|
-
|
|
6
|
-
NODE_ENV = development
|
|
7
|
-
PORT = 3000
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
SMTP_HOST =
|
|
20
|
-
SMTP_USER =
|
|
21
|
-
SMTP_PASSWORD =
|
|
22
|
-
SMTP_PORT =
|
|
23
|
-
# for admin panel
|
|
24
|
-
CLIENT_URL= http://app.app.localhost
|
|
1
|
+
# .{yourdomain}
|
|
2
|
+
COOKIE_DOMAIN = localhost
|
|
3
|
+
ACCESS_TOKEN_SECRET = your_access_token_secret
|
|
4
|
+
REFRESH_TOKEN_SECRET = your_refresh_token_secret
|
|
5
|
+
|
|
6
|
+
NODE_ENV = development
|
|
7
|
+
PORT = 3000
|
|
8
|
+
SERVER_URL = http://api.app.localhost
|
|
9
|
+
DATABASE_URL =
|
|
10
|
+
# mail
|
|
11
|
+
SENDER_MAIL =
|
|
12
|
+
# smtp
|
|
13
|
+
SMTP_HOST =
|
|
14
|
+
SMTP_USER =
|
|
15
|
+
SMTP_PASSWORD =
|
|
16
|
+
SMTP_PORT =
|
|
17
|
+
# for admin panel
|
|
18
|
+
CLIENT_URL= http://app.app.localhost
|
|
@@ -1,61 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
COPY package.json
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
WORKDIR /app
|
|
37
|
-
|
|
38
|
-
# Copy necessary files from builder stage
|
|
39
|
-
COPY --from=builder /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
|
|
40
|
-
COPY --from=builder /app/apps/core-server/dist /app/apps/core-server/dist
|
|
41
|
-
COPY --from=builder /app/apps/admin-panel/dist /app/apps/core-server/dist/frontend
|
|
42
|
-
COPY --from=builder /app/apps/core-server/package.json ./apps/core-server/package.json
|
|
43
|
-
COPY --from=builder /app/packages/typescript-config ./packages/typescript-config
|
|
44
|
-
COPY --from=builder /app/packages/eslint-config ./packages/eslint-config
|
|
45
|
-
COPY --from=builder /app/packages/db ./packages/db
|
|
46
|
-
COPY --from=builder /app/packages/redis ./packages/redis
|
|
47
|
-
COPY --from=builder /app/packages/mail ./packages/mail
|
|
48
|
-
COPY --from=builder /app/packages/lib ./packages/lib
|
|
49
|
-
COPY --from=builder /app/packages/common ./packages/common
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
# Install production dependencies
|
|
53
|
-
RUN pnpm install --prod --frozen-lockfile
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# Expose the port that the app will run on
|
|
57
|
-
EXPOSE 3000
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# Start the application
|
|
61
|
-
CMD ["node","--conditions=production", "/app/apps/core-server/dist/index.js"]
|
|
1
|
+
FROM node:24-alpine AS base
|
|
2
|
+
RUN apk add --no-cache git \
|
|
3
|
+
&& corepack enable \
|
|
4
|
+
&& corepack prepare pnpm@latest --activate
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
FROM base AS builder
|
|
8
|
+
|
|
9
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
10
|
+
|
|
11
|
+
COPY --parents apps/*/package.json ./
|
|
12
|
+
COPY --parents packages/*/package.json ./
|
|
13
|
+
COPY --parents configs/*/package.json ./
|
|
14
|
+
|
|
15
|
+
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
|
|
16
|
+
pnpm install --frozen-lockfile
|
|
17
|
+
|
|
18
|
+
COPY apps/core-server/ ./apps/core-server/
|
|
19
|
+
COPY packages ./packages
|
|
20
|
+
COPY configs ./configs
|
|
21
|
+
COPY turbo.json ./
|
|
22
|
+
|
|
23
|
+
# Build the required packages
|
|
24
|
+
RUN pnpm build:web
|
|
25
|
+
|
|
26
|
+
# --- Final production image ---
|
|
27
|
+
FROM node:24-alpine
|
|
28
|
+
|
|
29
|
+
WORKDIR /app
|
|
30
|
+
|
|
31
|
+
# Copy built server dist
|
|
32
|
+
COPY --from=builder /app/apps/core-server/dist ./
|
|
33
|
+
EXPOSE 3000
|
|
34
|
+
|
|
35
|
+
CMD ["node", "./index.mjs"]
|
|
@@ -1,73 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-server",
|
|
3
|
+
"description": "",
|
|
3
4
|
"version": "1.0.0",
|
|
4
5
|
"type": "module",
|
|
6
|
+
|
|
5
7
|
"scripts": {
|
|
6
|
-
"
|
|
8
|
+
"dev": "tsx watch src/index.ts",
|
|
9
|
+
"dev:debug": "tsx watch --inspect src/index.ts",
|
|
10
|
+
"bun:dev": "bun --watch src/index.ts",
|
|
11
|
+
"start": "node dist/index.mjs",
|
|
7
12
|
"lint": "eslint .",
|
|
8
13
|
"build": "tsdown --config-loader unrun",
|
|
9
14
|
"clean": "rimraf dist",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"command": "tsx src/commands/index.ts",
|
|
13
|
-
"schedule": "tsx src/commands/schedular.ts",
|
|
14
|
-
"test": "mocha -r tsx src/test/setup.ts -r tsx src/**/*.test*.ts",
|
|
15
|
+
"deep:clean": "rimraf node_modules dist .turbo",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
15
17
|
"lint:fix": "eslint . src/**/*.ts --fix",
|
|
16
|
-
"format": "
|
|
18
|
+
"format": "biome format --write .",
|
|
19
|
+
"format:check": "biome ci .",
|
|
20
|
+
"test": "vitest run"
|
|
17
21
|
},
|
|
18
|
-
"keywords": [],
|
|
19
|
-
"author": "",
|
|
20
|
-
"license": "ISC",
|
|
21
|
-
"description": "",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/client-s3": "^3.693.0",
|
|
24
23
|
"@repo/constants": "workspace:^",
|
|
25
24
|
"@repo/db": "workspace:^",
|
|
26
|
-
"@repo/
|
|
25
|
+
"@repo/mail": "workspace:^",
|
|
27
26
|
"@repo/lib": "workspace:^",
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"express": "^4.21.1",
|
|
39
|
-
"express-fileupload": "^1.5.1",
|
|
40
|
-
"express-list-endpoints": "^7.1.0",
|
|
41
|
-
"google-auth-library": "^9.15.1",
|
|
42
|
-
"jsonwebtoken": "^9.0.2",
|
|
43
|
-
"morgan": "^1.10.0",
|
|
44
|
-
"nanoid": "^5.0.9",
|
|
45
|
-
"node-cron": "^3.0.3",
|
|
46
|
-
"nodemailer": "^6.9.16",
|
|
47
|
-
"sharp": "^0.33.5",
|
|
48
|
-
"stripe": "^17.6.0",
|
|
49
|
-
"winston": "^3.16.0"
|
|
27
|
+
"@repo/redis": "workspace:^",
|
|
28
|
+
"@repo/env": "workspace:^",
|
|
29
|
+
"@repo/logger": "workspace:^",
|
|
30
|
+
"cookie-parser": "catalog:",
|
|
31
|
+
"cors": "catalog:",
|
|
32
|
+
"country-state-city": "catalog:",
|
|
33
|
+
"express": "catalog:",
|
|
34
|
+
"express-fileupload": "catalog:",
|
|
35
|
+
"express-list-endpoints": "catalog:",
|
|
36
|
+
"morgan": "catalog:"
|
|
50
37
|
},
|
|
51
38
|
"devDependencies": {
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"@types/
|
|
55
|
-
"@types/express": "
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/express-list-endpoints": "^6.0.3",
|
|
58
|
-
"@types/jsonwebtoken": "^9.0.7",
|
|
59
|
-
"@types/mocha": "^10.0.9",
|
|
60
|
-
"@types/morgan": "^1.9.9",
|
|
61
|
-
"@types/node-cron": "^3.0.11",
|
|
62
|
-
"@types/nodemailer": "^6.4.16",
|
|
63
|
-
"@types/supertest": "^6.0.2",
|
|
39
|
+
"@types/cookie-parser": "catalog:",
|
|
40
|
+
"@types/cors": "catalog:",
|
|
41
|
+
"@types/express": "catalog:",
|
|
42
|
+
"@types/express-fileupload": "catalog:",
|
|
43
|
+
"@types/morgan": "catalog:",
|
|
64
44
|
"eslint-config": "workspace:*",
|
|
65
|
-
"globals": "^15.11.0",
|
|
66
|
-
"mocha": "^10.8.2",
|
|
67
|
-
"supertest": "^7.0.0",
|
|
68
|
-
"tsc-alias": "^1.8.10",
|
|
69
|
-
"tsx": "^4.19.2",
|
|
70
45
|
"tsdown-config": "workspace:*",
|
|
71
46
|
"typescript-config": "workspace:*"
|
|
47
|
+
},
|
|
48
|
+
"startx": {
|
|
49
|
+
"tags": [
|
|
50
|
+
"node",
|
|
51
|
+
"backend"
|
|
52
|
+
],
|
|
53
|
+
"requiredDeps": [
|
|
54
|
+
"@repo/env",
|
|
55
|
+
"@repo/logger"
|
|
56
|
+
],
|
|
57
|
+
"requiredDevDeps": [
|
|
58
|
+
"typescript-config",
|
|
59
|
+
"tsdown-config"
|
|
60
|
+
]
|
|
72
61
|
}
|
|
73
62
|
}
|
|
@@ -1,44 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SessionUser } from "@repo/lib";
|
|
1
|
+
import type { SessionUser } from "@repo/lib/session-module";
|
|
3
2
|
|
|
4
3
|
declare global {
|
|
5
|
-
|
|
6
|
-
export interface ProcessEnv {
|
|
7
|
-
// from .env
|
|
8
|
-
COOKIE_DOMAIN: string;
|
|
9
|
-
NODE_ENV: "development" | "staging" | "production" | "test";
|
|
10
|
-
DATABASE_URL: string;
|
|
11
|
-
DATABASE_AUTH_TOKEN: string;
|
|
12
|
-
ACCESS_TOKEN_SECRET: string;
|
|
13
|
-
REFRESH_TOKEN_SECRET: string;
|
|
14
|
-
OAUTH_STATE_TOKEN_SECRET: string;
|
|
15
|
-
SUPPORT_MAIL: string;
|
|
16
|
-
AWS_ACCESS_KEY_ID: string;
|
|
17
|
-
AWS_SECRET_ACCESS_KEY: string;
|
|
18
|
-
AWS_REGION: string;
|
|
19
|
-
AWS_BUCKET: string;
|
|
20
|
-
GOOGLE_CLIENT_ID: string;
|
|
21
|
-
GOOGLE_CLIENT_SECRET: string;
|
|
22
|
-
GOOGLE_REDIRECT_URI: string;
|
|
23
|
-
|
|
24
|
-
CLIENT_URL: string;
|
|
25
|
-
SERVER_URL: string;
|
|
26
|
-
REDIS_URI: string;
|
|
27
|
-
REDIS_PORT: string;
|
|
28
|
-
REDIS_USERNAME: string;
|
|
29
|
-
REDIS_PASSWORD: string;
|
|
30
|
-
FIREBASE_PROJECT_ID: string;
|
|
31
|
-
STRIPE_WEBHOOK_SECRET: string;
|
|
32
|
-
STRIPE_SECRET_KEY: string;
|
|
33
|
-
|
|
34
|
-
SMTP_HOST: string;
|
|
35
|
-
SMTP_PORT: string;
|
|
36
|
-
SMTP_USER: string;
|
|
37
|
-
SMTP_PASSWORD: string;
|
|
38
|
-
SENDER_MAIL: string;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
42
5
|
namespace Express {
|
|
43
6
|
export interface Request {
|
|
44
7
|
user: SessionUser;
|
|
@@ -49,6 +12,5 @@ declare global {
|
|
|
49
12
|
declare module "http" {
|
|
50
13
|
interface IncomingMessage {
|
|
51
14
|
user: SessionUser;
|
|
52
|
-
body: any;
|
|
53
15
|
}
|
|
54
16
|
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
type ServerEvent = {
|
|
2
|
-
server: Array<() => void>;
|
|
3
|
-
db: Array<() => void>;
|
|
4
|
-
redis: Array<() => void>;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export class ServerEvents {
|
|
8
|
-
static events: ServerEvent = {
|
|
9
|
-
server: [],
|
|
10
|
-
db: [],
|
|
11
|
-
redis: [],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
static onServerReady(fn: () => void) {
|
|
15
|
-
ServerEvents.events.server.push(fn);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static emitServerReady() {
|
|
19
|
-
ServerEvents.events.server.forEach(fn => fn());
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static onDBReady(fn: () => void) {
|
|
23
|
-
ServerEvents.events.db.push(fn);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static emitDBReady() {
|
|
27
|
-
ServerEvents.events.db.forEach(fn => fn());
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static onRedisReady(fn: () => void) {
|
|
31
|
-
ServerEvents.events.redis.push(fn);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static emitRedisReady() {
|
|
35
|
-
ServerEvents.events.redis.forEach(fn => fn());
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
type ServerEvent = {
|
|
2
|
+
server: Array<() => void>;
|
|
3
|
+
db: Array<() => void>;
|
|
4
|
+
redis: Array<() => void>;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export class ServerEvents {
|
|
8
|
+
static events: ServerEvent = {
|
|
9
|
+
server: [],
|
|
10
|
+
db: [],
|
|
11
|
+
redis: [],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
static onServerReady(fn: () => void) {
|
|
15
|
+
ServerEvents.events.server.push(fn);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static emitServerReady() {
|
|
19
|
+
ServerEvents.events.server.forEach(fn => fn());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static onDBReady(fn: () => void) {
|
|
23
|
+
ServerEvents.events.db.push(fn);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static emitDBReady() {
|
|
27
|
+
ServerEvents.events.db.forEach(fn => fn());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static onRedisReady(fn: () => void) {
|
|
31
|
+
ServerEvents.events.redis.push(fn);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static emitRedisReady() {
|
|
35
|
+
ServerEvents.events.redis.forEach(fn => fn());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { logger } from "@repo/lib";
|
|
4
|
-
import * as sharp from "sharp"
|
|
1
|
+
import { ENV } from "@repo/env";
|
|
2
|
+
import { logger } from "@repo/logger";
|
|
5
3
|
|
|
6
4
|
import { ServerEvents } from "./events/index.js";
|
|
7
5
|
import { app } from "./routes/server.js";
|
|
8
|
-
// PushNotificationManager.initialize({
|
|
9
|
-
// type: "env",
|
|
10
|
-
// });
|
|
11
|
-
console.log(sharp)
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
console.log(ping)
|
|
15
|
-
console.log(await AdminEmailTemplate.getOtpEmail({otp:"1234"}))
|
|
16
|
-
app.listen(process.env.PORT ?? 3000, () => {
|
|
17
|
-
logger.info(`Server started on port ${process.env.PORT ?? 3000}`);
|
|
7
|
+
app.listen(ENV.PORT, () => {
|
|
18
8
|
ServerEvents.emitServerReady();
|
|
9
|
+
logger.info(`Server started on port ${ENV.PORT}`);
|
|
19
10
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserSession } from "@repo/lib/session-module";
|
|
2
2
|
import type { NextFunction, Request, Response } from "express";
|
|
3
|
+
|
|
4
|
+
type ExpressHandler = (req: Request, res: Response, next: NextFunction) => unknown;
|
|
5
|
+
|
|
3
6
|
export class AuthMiddlewares {
|
|
4
7
|
static async validateActiveSession(req: Request, res: Response, next: NextFunction) {
|
|
5
8
|
try {
|
|
@@ -22,13 +25,25 @@ export class AuthMiddlewares {
|
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
|
|
26
28
|
export function validateSession() {
|
|
27
|
-
return
|
|
29
|
+
return function <T extends ExpressHandler>(
|
|
30
|
+
_target: unknown,
|
|
31
|
+
_propertyKey: string,
|
|
32
|
+
descriptor: TypedPropertyDescriptor<T>
|
|
33
|
+
): void {
|
|
28
34
|
const originalMethod = descriptor.value;
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
if (!originalMethod) return;
|
|
37
|
+
|
|
38
|
+
descriptor.value = async function (
|
|
39
|
+
this: unknown,
|
|
40
|
+
req: Request,
|
|
41
|
+
res: Response,
|
|
42
|
+
next: NextFunction
|
|
43
|
+
) {
|
|
30
44
|
try {
|
|
31
|
-
const accessToken = req.headers
|
|
45
|
+
const accessToken = req.headers.authorization?.split(" ")[1];
|
|
46
|
+
|
|
32
47
|
if (!accessToken) {
|
|
33
48
|
res.status(401).json({ message: "access token missing" });
|
|
34
49
|
return;
|
|
@@ -40,11 +55,13 @@ export function validateSession() {
|
|
|
40
55
|
res.status(401).json({ message: "invalid access token" });
|
|
41
56
|
return;
|
|
42
57
|
}
|
|
58
|
+
|
|
43
59
|
req.user = payload;
|
|
44
|
-
|
|
60
|
+
|
|
61
|
+
return originalMethod.call(this, req, res, next);
|
|
45
62
|
} catch (error) {
|
|
46
63
|
next(error);
|
|
47
64
|
}
|
|
48
|
-
};
|
|
65
|
+
} as T;
|
|
49
66
|
};
|
|
50
67
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ENV } from "@repo/env";
|
|
2
|
+
import cors from "cors";
|
|
3
|
+
|
|
4
|
+
export const corsMiddleware = cors({
|
|
5
|
+
origin: [ENV.CLIENT_URL, ENV.CORS_URL],
|
|
6
|
+
credentials: true,
|
|
7
|
+
});
|