chore: isolate frontend and backend via npm workspaces and @mmapp/contracts

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-05-12 10:59:05 +07:00
co-authored by Cursor
parent b9a75b6831
commit dfbaa859ad
26 changed files with 2917 additions and 3633 deletions
-3008
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"build": "npm run build -w @mmapp/contracts && tsc",
"test:alert-engine": "tsx src/services/alert-engine/groups.test.ts && tsx src/services/alert-engine/evaluate-rule.test.ts && tsx src/services/alert-engine/confirm-stability.test.ts",
"start": "node dist/index.js",
"db:generate": "drizzle-kit generate",
@@ -13,6 +13,7 @@
"db:studio": "drizzle-kit studio"
},
"dependencies": {
"@mmapp/contracts": "0.1.0",
"@fastify/cors": "^11.2.0",
"@fastify/type-provider-zod": "^1.0.0",
"better-sqlite3": "^12.9.0",
@@ -1,7 +1,7 @@
import { and, desc, eq, gte, lte } from "drizzle-orm"
import { db } from "../../../db/index.js"
import { events } from "../../../db/schema.js"
import type { EventItem, EventLevel, EventSourceModule } from "../../../../../packages/contracts/dist/events.js"
import type { EventItem, EventLevel, EventSourceModule } from "@mmapp/contracts/events"
export type EventInsertInput = {
id: string
@@ -5,7 +5,7 @@ import {
type AppendEventBody,
type EventItem,
type ListEventsQuery,
} from "../../../../../packages/contracts/dist/events.js"
} from "@mmapp/contracts/events"
import { insertEventsBatch, listEvents, type EventInsertInput } from "../repository/events-repository.js"
function normalizeEventInput(input: AppendEventBody): EventInsertInput {
+1 -1
View File
@@ -16,7 +16,7 @@ import {
putRulesSchema,
putTelegramSchema,
testTelegramSchema,
} from "../../../packages/contracts/dist/alerts.js"
} from "@mmapp/contracts/alerts"
const alertsRoutes: FastifyPluginAsyncZod = async (app) => {
app.get("/alerts", async (_req, reply) => {
+1 -1
View File
@@ -1,5 +1,5 @@
import type { FastifyPluginAsyncZod } from "@fastify/type-provider-zod"
import { appendEventsSchema, listEventsQuerySchema } from "../../../packages/contracts/dist/events.js"
import { appendEventsSchema, listEventsQuerySchema } from "@mmapp/contracts/events"
import { appendEvents, readEvents } from "../modules/events/service/events-service.js"
const eventsRoutes: FastifyPluginAsyncZod = async (app) => {
+1 -1
View File
@@ -10,7 +10,7 @@ import {
type ServerCreate as ContractServerCreate,
type ServerUpdate as ContractServerUpdate,
type WanUplink as ContractWanUplinkRead,
} from "../../../packages/contracts/dist/servers.js"
} from "@mmapp/contracts/servers"
// ── RouterOS raw response types ────────────────────────────────────────────────
+1 -1
View File
@@ -5,7 +5,7 @@
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"outDir": "dist",
"rootDir": "..",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,