Skip to content

Commit bda5bb3

Browse files
committed
refactor: clearer folder organization
1 parent af85f61 commit bda5bb3

File tree

449 files changed

+978
-1000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

449 files changed

+978
-1000
lines changed

.vscode/settings.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ COPY --from=build /app/package.json .
6464
COPY --from=build /app/node_modules ./node_modules
6565
COPY --from=build /app/src/prisma/* ./src/prisma/
6666
COPY --from=build /app/dist ./dist
67+
COPY --from=build /app/scripts ./dist/scripts
6768

6869
# Replace the schema path in the package.json file
6970
RUN sed -i 's_"schema": "./src/prisma/schema.prisma"_"schema": "./dist/prisma/schema.prisma"_g' package.json

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"dev:run": "npx nodemon --watch 'src/**/*.ts' --exec 'npx tsx ./src/index.ts' --files src/index.ts",
1414
"build": "rm -rf dist && tsc -p ./tsconfig.json --outDir dist",
1515
"build:docker": "docker build . -f Dockerfile -t prod",
16-
"generate:sdk": "npx tsx ./src/scripts/generate-sdk && cd ./sdk && yarn build",
17-
"prisma:setup:dev": "npx tsx ./src/scripts/setup-db.ts",
16+
"generate:sdk": "npx tsx ./scripts/generate-sdk && cd ./sdk && yarn build",
17+
"prisma:setup:dev": "npx tsx ./scripts/setup-db.ts",
1818
"prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js",
1919
"start": "yarn prisma:setup:prod && yarn start:migrations && yarn start:run",
2020
"start:migrations": "npx tsx ./dist/scripts/apply-migrations.js",
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { logger } from "../utils/logger";
2-
import { acquireLock, releaseLock, waitForLock } from "../utils/redis/lock";
3-
import { redis } from "../utils/redis/redis";
1+
import { logger } from "../src/shared/utils/logger";
2+
import {
3+
acquireLock,
4+
releaseLock,
5+
waitForLock,
6+
} from "../src/shared/utils/redis/lock";
7+
import { redis } from "../src/shared/utils/redis/redis";
48

59
const MIGRATION_LOCK_TTL_SECONDS = 60;
610

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { execSync } from "child_process";
2-
import { prisma } from "../db/client";
1+
import { execSync } from "node:child_process";
2+
import { prisma } from "../src/shared/db/client";
33

44
const main = async () => {
55
const [{ exists: hasWalletsTable }]: [{ exists: boolean }] =
@@ -14,8 +14,8 @@ const main = async () => {
1414

1515
const schema =
1616
process.env.NODE_ENV === "production"
17-
? `./dist/prisma/schema.prisma`
18-
: `./src/prisma/schema.prisma`;
17+
? "./dist/prisma/schema.prisma"
18+
: "./src/prisma/schema.prisma";
1919

2020
if (hasWalletsTable) {
2121
execSync(`yarn prisma migrate reset --force --schema ${schema}`, {

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import "./polyfill";
2+
import "./tracer";
3+
24
import { initServer } from "./server";
3-
import { env } from "./utils/env";
4-
import { logger } from "./utils/logger";
5-
import "./utils/tracer";
5+
import { env } from "./shared/utils/env";
6+
import { logger } from "./shared/utils/logger";
67
import { initWorker } from "./worker";
78
import { CancelRecycledNoncesQueue } from "./worker/queues/cancelRecycledNoncesQueue";
89
import { MigratePostgresTransactionsQueue } from "./worker/queues/migratePostgresTransactionsQueue";

src/polyfill.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as crypto from "crypto";
1+
import * as crypto from "node:crypto";
22

33
if (typeof globalThis.crypto === "undefined") {
44
(globalThis as any).crypto = crypto;

src/server/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import fastify, { type FastifyInstance } from "fastify";
33
import * as fs from "node:fs";
44
import path from "node:path";
55
import { URL } from "node:url";
6-
import { clearCacheCron } from "../utils/cron/clearCacheCron";
7-
import { env } from "../utils/env";
8-
import { logger } from "../utils/logger";
9-
import { metricsServer } from "../utils/prometheus";
10-
import { withServerUsageReporting } from "../utils/usage";
6+
import { clearCacheCron } from "../shared/utils/cron/clearCacheCron";
7+
import { env } from "../shared/utils/env";
8+
import { logger } from "../shared/utils/logger";
9+
import { metricsServer } from "../shared/utils/prometheus";
10+
import { withServerUsageReporting } from "../shared/utils/usage";
1111
import { updateTxListener } from "./listeners/updateTxListener";
1212
import { withAdminRoutes } from "./middleware/adminRoutes";
1313
import { withAuth } from "./middleware/auth";

src/server/listeners/updateTxListener.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { knex } from "../../db/client";
2-
import { TransactionDB } from "../../db/transactions/db";
3-
import { logger } from "../../utils/logger";
1+
import { knex } from "../../shared/db/client";
2+
import { TransactionDB } from "../../shared/db/transactions/db";
3+
import { logger } from "../../shared/utils/logger";
44
import { toTransactionSchema } from "../schemas/transaction";
55
import { subscriptionsData } from "../schemas/websocket";
66
import {

0 commit comments

Comments
 (0)