frontend added and socket io
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { dirname, join } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import { toNodeHandler } from "better-auth/node";
|
import { toNodeHandler } from "better-auth/node";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
@@ -20,14 +22,33 @@ const createApp = async () => {
|
|||||||
baseUrl = "/lst";
|
baseUrl = "/lst";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
// well leave this active so we can monitor it to validate
|
// well leave this active so we can monitor it to validate
|
||||||
app.use(morgan("tiny"));
|
app.use(morgan("tiny"));
|
||||||
app.set("trust proxy", true);
|
app.set("trust proxy", true);
|
||||||
app.all(`${baseUrl}api/auth/*splat`, toNodeHandler(auth));
|
|
||||||
app.use(express.json());
|
|
||||||
app.use(lstCors());
|
app.use(lstCors());
|
||||||
|
app.all(`${baseUrl}/api/auth/*splat`, toNodeHandler(auth));
|
||||||
|
app.use(express.json());
|
||||||
setupRoutes(baseUrl, app);
|
setupRoutes(baseUrl, app);
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
baseUrl + "/app",
|
||||||
|
express.static(join(__dirname, "../frontend/dist")),
|
||||||
|
);
|
||||||
|
|
||||||
|
app.get(baseUrl + "/app/*splat", (_, res) => {
|
||||||
|
res.sendFile(join(__dirname, "../frontend/dist/index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.all("*foo", (_, res) => {
|
||||||
|
res.status(400).json({
|
||||||
|
message:
|
||||||
|
"You have encountered a route that dose not exist, please check the url and try again",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
log.info("Lst app created");
|
log.info("Lst app created");
|
||||||
return { app, baseUrl };
|
return { app, baseUrl };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -96,6 +96,18 @@ r.post("/", async (req, res) => {
|
|||||||
asResponse: true,
|
asResponse: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (login.status === 401) {
|
||||||
|
return apiReturn(res, {
|
||||||
|
success: false,
|
||||||
|
level: "error", //connect.success ? "info" : "error",
|
||||||
|
module: "routes",
|
||||||
|
subModule: "auth",
|
||||||
|
message: `Incorrect username or password please try again`,
|
||||||
|
data: [],
|
||||||
|
status: 401, //connect.success ? 200 : 400,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
login.headers.forEach((value: string, key: string) => {
|
login.headers.forEach((value: string, key: string) => {
|
||||||
if (key.toLowerCase() === "set-cookie") {
|
if (key.toLowerCase() === "set-cookie") {
|
||||||
res.append("set-cookie", value);
|
res.append("set-cookie", value);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { APIError } from "better-auth";
|
import { APIError } from "better-auth";
|
||||||
import { count, sql } from "drizzle-orm";
|
import { count, eq, sql } from "drizzle-orm";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
import { db } from "../db/db.controller.js";
|
import { db } from "../db/db.controller.js";
|
||||||
@@ -58,7 +58,10 @@ r.post("/", async (req, res) => {
|
|||||||
// if we have no users yet lets make this new one the admin
|
// if we have no users yet lets make this new one the admin
|
||||||
if (userCount === 0) {
|
if (userCount === 0) {
|
||||||
// make this user an admin
|
// make this user an admin
|
||||||
await db.update(user).set({ role: "admin", updatedAt: sql`NOW()` });
|
await db
|
||||||
|
.update(user)
|
||||||
|
.set({ role: "admin", updatedAt: sql`NOW()` })
|
||||||
|
.where(eq(user.id, newUser.user.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
apiReturn(res, {
|
apiReturn(res, {
|
||||||
|
|||||||
@@ -28,14 +28,17 @@ const dbStream = new Writable({
|
|||||||
const levelName = pinoLogLevels[obj.level] || "unknown";
|
const levelName = pinoLogLevels[obj.level] || "unknown";
|
||||||
|
|
||||||
const res = await tryCatch(
|
const res = await tryCatch(
|
||||||
db.insert(logs).values({
|
db
|
||||||
|
.insert(logs)
|
||||||
|
.values({
|
||||||
level: levelName,
|
level: levelName,
|
||||||
module: obj?.module?.toLowerCase(),
|
module: obj?.module?.toLowerCase(),
|
||||||
subModule: obj?.subModule?.toLowerCase(),
|
subModule: obj?.subModule?.toLowerCase(),
|
||||||
hostname: obj?.hostname?.toLowerCase(),
|
hostname: obj?.hostname?.toLowerCase(),
|
||||||
message: obj.msg,
|
message: obj.msg,
|
||||||
stack: obj?.stack,
|
stack: obj?.stack,
|
||||||
}),
|
})
|
||||||
|
.returning(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
@@ -43,9 +46,9 @@ const dbStream = new Writable({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj.room) {
|
if (obj.room) {
|
||||||
emitToRoom(obj.room, obj);
|
emitToRoom(obj.room, res.data ? res.data[0] : obj);
|
||||||
}
|
}
|
||||||
emitToRoom("logs", obj);
|
emitToRoom("logs", res.data ? res.data[0] : obj);
|
||||||
callback();
|
callback();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("DB log insert error:", err);
|
console.error("DB log insert error:", err);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { systemSettings } from "backend/server.js";
|
|
||||||
import { io, type Socket } from "socket.io-client";
|
import { io, type Socket } from "socket.io-client";
|
||||||
import { createLogger } from "../logger/logger.controller.js";
|
import { createLogger } from "../logger/logger.controller.js";
|
||||||
|
import { systemSettings } from "../server.js";
|
||||||
import { getToken, odToken } from "./opendock.utils.js";
|
import { getToken, odToken } from "./opendock.utils.js";
|
||||||
|
|
||||||
const log = createLogger({ module: "opendock", subModule: "releaseMonitor" });
|
const log = createLogger({ module: "opendock", subModule: "releaseMonitor" });
|
||||||
|
|||||||
@@ -17,13 +17,4 @@ export const setupRoutes = (baseUrl: string, app: Express) => {
|
|||||||
setupAuthRoutes(baseUrl, app);
|
setupAuthRoutes(baseUrl, app);
|
||||||
setupUtilsRoutes(baseUrl, app);
|
setupUtilsRoutes(baseUrl, app);
|
||||||
setupOpendockRoutes(baseUrl, app);
|
setupOpendockRoutes(baseUrl, app);
|
||||||
|
|
||||||
// routes that get activated if the module is set to activated.
|
|
||||||
|
|
||||||
app.all("*foo", (_, res) => {
|
|
||||||
res.status(400).json({
|
|
||||||
message:
|
|
||||||
"You have encountered a route that dose not exist, please check the url and try again",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { RoomId } from "./types.socket.js";
|
import type { RoomId } from "./types.socket.js";
|
||||||
|
|
||||||
export const MAX_HISTORY = 20;
|
export const MAX_HISTORY = 50;
|
||||||
export const FLUSH_INTERVAL = 100; // 50ms change higher if needed
|
export const FLUSH_INTERVAL = 100; // 50ms change higher if needed
|
||||||
|
|
||||||
export const roomHistory = new Map<RoomId, unknown[]>();
|
export const roomHistory = new Map<RoomId, unknown[]>();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { logs } from "backend/db/schema/logs.schema.js";
|
|
||||||
import { desc } from "drizzle-orm";
|
|
||||||
import { db } from "../db/db.controller.js";
|
import { db } from "../db/db.controller.js";
|
||||||
|
import { logs } from "../db/schema/logs.schema.js";
|
||||||
import type { RoomId } from "./types.socket.js";
|
import type { RoomId } from "./types.socket.js";
|
||||||
|
|
||||||
type RoomDefinition<T = unknown> = {
|
type RoomDefinition<T = unknown> = {
|
||||||
@@ -14,10 +13,10 @@ export const roomDefinition: Record<RoomId, RoomDefinition> = {
|
|||||||
const rows = await db
|
const rows = await db
|
||||||
.select()
|
.select()
|
||||||
.from(logs)
|
.from(logs)
|
||||||
.orderBy(desc(logs.createdAt))
|
.orderBy(logs.createdAt)
|
||||||
.limit(limit);
|
.limit(limit);
|
||||||
|
|
||||||
return rows.reverse();
|
return rows; //.reverse();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to seed logs:", e);
|
console.error("Failed to seed logs:", e);
|
||||||
return [];
|
return [];
|
||||||
@@ -27,6 +26,7 @@ export const roomDefinition: Record<RoomId, RoomDefinition> = {
|
|||||||
|
|
||||||
labels: {
|
labels: {
|
||||||
seed: async (limit) => {
|
seed: async (limit) => {
|
||||||
|
console.info(limit);
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { Server as HttpServer } from "node:http";
|
|||||||
import { instrument } from "@socket.io/admin-ui";
|
import { instrument } from "@socket.io/admin-ui";
|
||||||
import { Server } from "socket.io";
|
import { Server } from "socket.io";
|
||||||
import { createLogger } from "../logger/logger.controller.js";
|
import { createLogger } from "../logger/logger.controller.js";
|
||||||
|
import { allowedOrigins } from "../utils/cors.utils.js";
|
||||||
import { registerEmitter } from "./roomEmitter.socket.js";
|
import { registerEmitter } from "./roomEmitter.socket.js";
|
||||||
import { createRoomEmitter, preseedRoom } from "./roomService.socket.js";
|
import { createRoomEmitter, preseedRoom } from "./roomService.socket.js";
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ export const setupSocketIORoutes = (baseUrl: string, server: HttpServer) => {
|
|||||||
const io = new Server(server, {
|
const io = new Server(server, {
|
||||||
path: `${baseUrl}/api/socket.io`,
|
path: `${baseUrl}/api/socket.io`,
|
||||||
cors: {
|
cors: {
|
||||||
origin: ["http://localhost:3000", "https://admin.socket.io"],
|
origin: allowedOrigins,
|
||||||
credentials: true,
|
credentials: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -38,7 +39,7 @@ export const setupSocketIORoutes = (baseUrl: string, server: HttpServer) => {
|
|||||||
|
|
||||||
// get room seeded
|
// get room seeded
|
||||||
const history = await preseedRoom(rn);
|
const history = await preseedRoom(rn);
|
||||||
|
log.info({}, `User joined ${rn}: ${s.id}`);
|
||||||
// send the intial data
|
// send the intial data
|
||||||
s.emit("room-update", {
|
s.emit("room-update", {
|
||||||
roomId: rn,
|
roomId: rn,
|
||||||
@@ -46,6 +47,11 @@ export const setupSocketIORoutes = (baseUrl: string, server: HttpServer) => {
|
|||||||
initial: true,
|
initial: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
s.on("leave-room", (room) => {
|
||||||
|
s.leave(room);
|
||||||
|
log.info({}, `${s.id} left room: ${room}`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
io.on("disconnect", (s) => {
|
io.on("disconnect", (s) => {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { betterAuth } from "better-auth";
|
|||||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||||
import {
|
import {
|
||||||
admin,
|
admin,
|
||||||
apiKey,
|
// apiKey,
|
||||||
createAuthMiddleware,
|
// createAuthMiddleware,
|
||||||
//customSession,
|
//customSession,
|
||||||
jwt,
|
jwt,
|
||||||
lastLoginMethod,
|
lastLoginMethod,
|
||||||
@@ -31,6 +31,7 @@ export const auth = betterAuth({
|
|||||||
provider: "pg",
|
provider: "pg",
|
||||||
schema,
|
schema,
|
||||||
}),
|
}),
|
||||||
|
trustedOrigins: allowedOrigins,
|
||||||
// user: {
|
// user: {
|
||||||
// additionalFields: {
|
// additionalFields: {
|
||||||
// role: {
|
// role: {
|
||||||
@@ -42,7 +43,7 @@ export const auth = betterAuth({
|
|||||||
// },
|
// },
|
||||||
plugins: [
|
plugins: [
|
||||||
jwt({ jwt: { expirationTime: "1h" } }),
|
jwt({ jwt: { expirationTime: "1h" } }),
|
||||||
apiKey(),
|
//apiKey(),
|
||||||
admin(),
|
admin(),
|
||||||
lastLoginMethod(),
|
lastLoginMethod(),
|
||||||
username({
|
username({
|
||||||
@@ -70,7 +71,6 @@ export const auth = betterAuth({
|
|||||||
// };
|
// };
|
||||||
// }),
|
// }),
|
||||||
],
|
],
|
||||||
trustedOrigins: allowedOrigins,
|
|
||||||
|
|
||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -118,16 +118,16 @@ export const auth = betterAuth({
|
|||||||
secure: false,
|
secure: false,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
},
|
},
|
||||||
hooks: {
|
// hooks: {
|
||||||
after: createAuthMiddleware(async (ctx) => {
|
// after: createAuthMiddleware(async (ctx) => {
|
||||||
if (ctx.path.startsWith("/login")) {
|
// if (ctx.path.startsWith("/login")) {
|
||||||
const newSession = ctx.context.newSession;
|
// const newSession = ctx.context.newSession;
|
||||||
if (newSession) {
|
// if (newSession) {
|
||||||
// something here later
|
// // something here later
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}),
|
// }),
|
||||||
},
|
// },
|
||||||
events: {
|
events: {
|
||||||
// async onSignInSuccess({ user }: { user: User }) {
|
// async onSignInSuccess({ user }: { user: User }) {
|
||||||
// await db
|
// await db
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ export const allowedOrigins = [
|
|||||||
"https://admin.socket.io",
|
"https://admin.socket.io",
|
||||||
"https://electron-socket-io-playground.vercel.app",
|
"https://electron-socket-io-playground.vercel.app",
|
||||||
`${process.env.URL}`,
|
`${process.env.URL}`,
|
||||||
|
`http://${process.env.PROD_SERVER}:3000`,
|
||||||
|
`http://${process.env.PROD_SERVER}:3100`, // temp
|
||||||
|
`http://usmcd1olp082:3000`,
|
||||||
];
|
];
|
||||||
export const lstCors = () => {
|
export const lstCors = () => {
|
||||||
return cors({
|
return cors({
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"includes": ["**", "!!**/dist","!!**/frontend", "!!**/lst_docs"]
|
"includes": ["**", "!!**/dist", "!!**/lst_docs"]
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
@@ -5,14 +5,18 @@ meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: {{url}}/api/authentication/login
|
url: {{url}}/api/auth/sign-in/email
|
||||||
body: json
|
body: json
|
||||||
auth: inherit
|
auth: inherit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
headers {
|
||||||
|
Origin: http://localhost:3000
|
||||||
|
}
|
||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"username": "matthes01",
|
"email": "blake.matthes@alpla.com",
|
||||||
"password": "nova0511"
|
"password": "nova0511"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
brunoApi/auth/getSession.bru
Normal file
16
brunoApi/auth/getSession.bru
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: getSession
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/api/auth/get-session
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ patch {
|
|||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"value" : "0",
|
"value" : "0",
|
||||||
"active": "true"
|
"active": "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const dbURL = `postgres://${process.env.DATABASE_USER}:${process.env.DATABASE_PA
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
dialect: "postgresql",
|
dialect: "postgresql",
|
||||||
schema: "./dist/backend/db/schema",
|
schema: "./dist/db/schema",
|
||||||
out: "./migrations",
|
out: "./migrations",
|
||||||
dbCredentials: { url: dbURL },
|
dbCredentials: { url: dbURL },
|
||||||
});
|
});
|
||||||
|
|||||||
24
frontend/.gitignore
vendored
Normal file
24
frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
69
frontend/README.md
Normal file
69
frontend/README.md
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# React + TypeScript + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
||||||
|
## Expanding the ESLint configuration
|
||||||
|
|
||||||
|
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||||
|
|
||||||
|
```js
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
// Other configs...
|
||||||
|
|
||||||
|
// Remove tseslint.configs.recommended and replace with this
|
||||||
|
tseslint.configs.recommendedTypeChecked,
|
||||||
|
// Alternatively, use this for stricter rules
|
||||||
|
tseslint.configs.strictTypeChecked,
|
||||||
|
// Optionally, add this for stylistic rules
|
||||||
|
tseslint.configs.stylisticTypeChecked,
|
||||||
|
|
||||||
|
// Other configs...
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
// other options...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// eslint.config.js
|
||||||
|
import reactX from 'eslint-plugin-react-x'
|
||||||
|
import reactDom from 'eslint-plugin-react-dom'
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
// Other configs...
|
||||||
|
// Enable lint rules for React
|
||||||
|
reactX.configs['recommended-typescript'],
|
||||||
|
// Enable lint rules for React DOM
|
||||||
|
reactDom.configs.recommended,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
// other options...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
```
|
||||||
25
frontend/components.json
Normal file
25
frontend/components.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://ui.shadcn.com/schema.json",
|
||||||
|
"style": "radix-nova",
|
||||||
|
"rsc": false,
|
||||||
|
"tsx": true,
|
||||||
|
"tailwind": {
|
||||||
|
"config": "",
|
||||||
|
"css": "src/index.css",
|
||||||
|
"baseColor": "zinc",
|
||||||
|
"cssVariables": true,
|
||||||
|
"prefix": ""
|
||||||
|
},
|
||||||
|
"iconLibrary": "lucide",
|
||||||
|
"rtl": false,
|
||||||
|
"aliases": {
|
||||||
|
"components": "@/components",
|
||||||
|
"utils": "@/lib/utils",
|
||||||
|
"ui": "@/components/ui",
|
||||||
|
"lib": "@/lib",
|
||||||
|
"hooks": "@/hooks"
|
||||||
|
},
|
||||||
|
"menuColor": "default",
|
||||||
|
"menuAccent": "subtle",
|
||||||
|
"registries": {}
|
||||||
|
}
|
||||||
23
frontend/eslint.config.js
Normal file
23
frontend/eslint.config.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
js.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
reactHooks.configs['recommended-latest'],
|
||||||
|
reactRefresh.configs.vite,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
13
frontend/index.html
Normal file
13
frontend/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Vite + React + TS</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
10511
frontend/package-lock.json
generated
Normal file
10511
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
frontend/package.json
Normal file
46
frontend/package.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "tsc -b && vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@fontsource-variable/inter": "^5.2.8",
|
||||||
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
|
"@tanstack/react-query": "^5.90.21",
|
||||||
|
"@tanstack/react-router": "^1.166.7",
|
||||||
|
"@tanstack/react-router-devtools": "^1.166.7",
|
||||||
|
"axios": "^1.13.6",
|
||||||
|
"better-auth": "^1.5.5",
|
||||||
|
"class-variance-authority": "^0.7.1",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"lucide-react": "^0.577.0",
|
||||||
|
"radix-ui": "^1.4.3",
|
||||||
|
"react": "^19.1.1",
|
||||||
|
"react-dom": "^19.1.1",
|
||||||
|
"shadcn": "^4.0.8",
|
||||||
|
"socket.io-client": "^4.8.3",
|
||||||
|
"tailwind-merge": "^3.5.0",
|
||||||
|
"tailwindcss": "^4.2.1",
|
||||||
|
"tw-animate-css": "^1.4.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.36.0",
|
||||||
|
"@tanstack/router-plugin": "^1.166.7",
|
||||||
|
"@types/react": "^19.1.13",
|
||||||
|
"@types/react-dom": "^19.1.9",
|
||||||
|
"@vitejs/plugin-react-swc": "^4.1.0",
|
||||||
|
"eslint": "^9.36.0",
|
||||||
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.20",
|
||||||
|
"globals": "^16.4.0",
|
||||||
|
"typescript": "~5.8.3",
|
||||||
|
"typescript-eslint": "^8.44.0",
|
||||||
|
"vite": "^7.1.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
frontend/public/vite.svg
Normal file
1
frontend/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
BIN
frontend/src/assets/hero.png
Normal file
BIN
frontend/src/assets/hero.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
1
frontend/src/assets/react.svg
Normal file
1
frontend/src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.0 KiB |
1
frontend/src/assets/vite.svg
Normal file
1
frontend/src/assets/vite.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.5 KiB |
67
frontend/src/components/ui/button.tsx
Normal file
67
frontend/src/components/ui/button.tsx
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const buttonVariants = cva(
|
||||||
|
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
||||||
|
outline:
|
||||||
|
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
||||||
|
ghost:
|
||||||
|
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
||||||
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
default:
|
||||||
|
"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||||
|
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||||
|
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
||||||
|
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
||||||
|
icon: "size-8",
|
||||||
|
"icon-xs":
|
||||||
|
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
||||||
|
"icon-sm":
|
||||||
|
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
||||||
|
"icon-lg": "size-9",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Button({
|
||||||
|
className,
|
||||||
|
variant = "default",
|
||||||
|
size = "default",
|
||||||
|
asChild = false,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"button"> &
|
||||||
|
VariantProps<typeof buttonVariants> & {
|
||||||
|
asChild?: boolean
|
||||||
|
}) {
|
||||||
|
const Comp = asChild ? Slot.Root : "button"
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
data-slot="button"
|
||||||
|
data-variant={variant}
|
||||||
|
data-size={size}
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Button, buttonVariants }
|
||||||
129
frontend/src/index.css
Normal file
129
frontend/src/index.css
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
@import "tw-animate-css";
|
||||||
|
@import "shadcn/tailwind.css";
|
||||||
|
@import "@fontsource-variable/inter";
|
||||||
|
|
||||||
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--background: oklch(1 0 0);
|
||||||
|
--foreground: oklch(0.141 0.005 285.823);
|
||||||
|
--card: oklch(1 0 0);
|
||||||
|
--card-foreground: oklch(0.141 0.005 285.823);
|
||||||
|
--popover: oklch(1 0 0);
|
||||||
|
--popover-foreground: oklch(0.141 0.005 285.823);
|
||||||
|
--primary: oklch(0.488 0.243 264.376);
|
||||||
|
--primary-foreground: oklch(0.97 0.014 254.604);
|
||||||
|
--secondary: oklch(0.967 0.001 286.375);
|
||||||
|
--secondary-foreground: oklch(0.21 0.006 285.885);
|
||||||
|
--muted: oklch(0.967 0.001 286.375);
|
||||||
|
--muted-foreground: oklch(0.552 0.016 285.938);
|
||||||
|
--accent: oklch(0.967 0.001 286.375);
|
||||||
|
--accent-foreground: oklch(0.21 0.006 285.885);
|
||||||
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
|
--border: oklch(0.92 0.004 286.32);
|
||||||
|
--input: oklch(0.92 0.004 286.32);
|
||||||
|
--ring: oklch(0.705 0.015 286.067);
|
||||||
|
--chart-1: oklch(0.809 0.105 251.813);
|
||||||
|
--chart-2: oklch(0.623 0.214 259.815);
|
||||||
|
--chart-3: oklch(0.546 0.245 262.881);
|
||||||
|
--chart-4: oklch(0.488 0.243 264.376);
|
||||||
|
--chart-5: oklch(0.424 0.199 265.638);
|
||||||
|
--radius: 0.625rem;
|
||||||
|
--sidebar: oklch(0.985 0 0);
|
||||||
|
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
||||||
|
--sidebar-primary: oklch(0.546 0.245 262.881);
|
||||||
|
--sidebar-primary-foreground: oklch(0.97 0.014 254.604);
|
||||||
|
--sidebar-accent: oklch(0.967 0.001 286.375);
|
||||||
|
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
||||||
|
--sidebar-border: oklch(0.92 0.004 286.32);
|
||||||
|
--sidebar-ring: oklch(0.705 0.015 286.067);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--background: oklch(0.141 0.005 285.823);
|
||||||
|
--foreground: oklch(0.985 0 0);
|
||||||
|
--card: oklch(0.21 0.006 285.885);
|
||||||
|
--card-foreground: oklch(0.985 0 0);
|
||||||
|
--popover: oklch(0.21 0.006 285.885);
|
||||||
|
--popover-foreground: oklch(0.985 0 0);
|
||||||
|
--primary: oklch(0.424 0.199 265.638);
|
||||||
|
--primary-foreground: oklch(0.97 0.014 254.604);
|
||||||
|
--secondary: oklch(0.274 0.006 286.033);
|
||||||
|
--secondary-foreground: oklch(0.985 0 0);
|
||||||
|
--muted: oklch(0.274 0.006 286.033);
|
||||||
|
--muted-foreground: oklch(0.705 0.015 286.067);
|
||||||
|
--accent: oklch(0.274 0.006 286.033);
|
||||||
|
--accent-foreground: oklch(0.985 0 0);
|
||||||
|
--destructive: oklch(0.704 0.191 22.216);
|
||||||
|
--border: oklch(1 0 0 / 10%);
|
||||||
|
--input: oklch(1 0 0 / 15%);
|
||||||
|
--ring: oklch(0.552 0.016 285.938);
|
||||||
|
--chart-1: oklch(0.809 0.105 251.813);
|
||||||
|
--chart-2: oklch(0.623 0.214 259.815);
|
||||||
|
--chart-3: oklch(0.546 0.245 262.881);
|
||||||
|
--chart-4: oklch(0.488 0.243 264.376);
|
||||||
|
--chart-5: oklch(0.424 0.199 265.638);
|
||||||
|
--sidebar: oklch(0.21 0.006 285.885);
|
||||||
|
--sidebar-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-primary: oklch(0.623 0.214 259.815);
|
||||||
|
--sidebar-primary-foreground: oklch(0.97 0.014 254.604);
|
||||||
|
--sidebar-accent: oklch(0.274 0.006 286.033);
|
||||||
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-border: oklch(1 0 0 / 10%);
|
||||||
|
--sidebar-ring: oklch(0.552 0.016 285.938);
|
||||||
|
}
|
||||||
|
|
||||||
|
@theme inline {
|
||||||
|
--font-sans: 'Inter Variable', sans-serif;
|
||||||
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||||
|
--color-sidebar-accent: var(--sidebar-accent);
|
||||||
|
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||||
|
--color-sidebar-primary: var(--sidebar-primary);
|
||||||
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||||
|
--color-sidebar: var(--sidebar);
|
||||||
|
--color-chart-5: var(--chart-5);
|
||||||
|
--color-chart-4: var(--chart-4);
|
||||||
|
--color-chart-3: var(--chart-3);
|
||||||
|
--color-chart-2: var(--chart-2);
|
||||||
|
--color-chart-1: var(--chart-1);
|
||||||
|
--color-ring: var(--ring);
|
||||||
|
--color-input: var(--input);
|
||||||
|
--color-border: var(--border);
|
||||||
|
--color-destructive: var(--destructive);
|
||||||
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
|
--color-accent: var(--accent);
|
||||||
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
|
--color-muted: var(--muted);
|
||||||
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
|
--color-secondary: var(--secondary);
|
||||||
|
--color-primary-foreground: var(--primary-foreground);
|
||||||
|
--color-primary: var(--primary);
|
||||||
|
--color-popover-foreground: var(--popover-foreground);
|
||||||
|
--color-popover: var(--popover);
|
||||||
|
--color-card-foreground: var(--card-foreground);
|
||||||
|
--color-card: var(--card);
|
||||||
|
--color-foreground: var(--foreground);
|
||||||
|
--color-background: var(--background);
|
||||||
|
--radius-sm: calc(var(--radius) * 0.6);
|
||||||
|
--radius-md: calc(var(--radius) * 0.8);
|
||||||
|
--radius-lg: var(--radius);
|
||||||
|
--radius-xl: calc(var(--radius) * 1.4);
|
||||||
|
--radius-2xl: calc(var(--radius) * 1.8);
|
||||||
|
--radius-3xl: calc(var(--radius) * 2.2);
|
||||||
|
--radius-4xl: calc(var(--radius) * 2.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border outline-ring/50;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
}
|
||||||
|
html {
|
||||||
|
@apply font-sans;
|
||||||
|
}
|
||||||
|
}
|
||||||
6
frontend/src/lib/auth-client.ts
Normal file
6
frontend/src/lib/auth-client.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { createAuthClient } from "better-auth/react"
|
||||||
|
export const authClient = createAuthClient({
|
||||||
|
baseURL: "http://localhost:3000/lst/api/auth" // The base URL of your auth server
|
||||||
|
})
|
||||||
|
|
||||||
|
export const { useSession, signUp, signIn, signOut } = authClient
|
||||||
12
frontend/src/lib/socket.io.ts
Normal file
12
frontend/src/lib/socket.io.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { io } from "socket.io-client";
|
||||||
|
|
||||||
|
// Connect to your Socket.io server
|
||||||
|
const socket = io(`${window.location.host}`, {
|
||||||
|
path: "/lst/api/socket.io",
|
||||||
|
// autoConnect: false, // connect manually
|
||||||
|
// reconnection: true,
|
||||||
|
// reconnectionAttempts: 5,
|
||||||
|
// reconnectionDelay: 1000,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default socket;
|
||||||
6
frontend/src/lib/utils.ts
Normal file
6
frontend/src/lib/utils.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { clsx, type ClassValue } from "clsx"
|
||||||
|
import { twMerge } from "tailwind-merge"
|
||||||
|
|
||||||
|
export function cn(...inputs: ClassValue[]) {
|
||||||
|
return twMerge(clsx(inputs))
|
||||||
|
}
|
||||||
49
frontend/src/main.tsx
Normal file
49
frontend/src/main.tsx
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
import { StrictMode } from "react";
|
||||||
|
import ReactDOM from "react-dom/client";
|
||||||
|
import "./index.css";
|
||||||
|
import { createRouter, RouterProvider } from "@tanstack/react-router";
|
||||||
|
import socket from "./lib/socket.io";
|
||||||
|
// Import the generated route tree
|
||||||
|
import { routeTree } from "./routeTree.gen";
|
||||||
|
|
||||||
|
socket.connect();
|
||||||
|
const queryClient = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
staleTime: 1000 * 60 * 5,
|
||||||
|
retry: 0,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create a new router instance
|
||||||
|
const router = createRouter({
|
||||||
|
routeTree,
|
||||||
|
basepath: "/lst/app",
|
||||||
|
defaultPendingMinMs: 500,
|
||||||
|
context: {
|
||||||
|
queryClient,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register the router instance for type safety
|
||||||
|
declare module "@tanstack/react-router" {
|
||||||
|
interface Register {
|
||||||
|
router: typeof router;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the app
|
||||||
|
const rootElement = document.getElementById("root")!;
|
||||||
|
if (!rootElement.innerHTML) {
|
||||||
|
const root = ReactDOM.createRoot(rootElement);
|
||||||
|
root.render(
|
||||||
|
<StrictMode>
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<RouterProvider router={router} />
|
||||||
|
</QueryClientProvider>
|
||||||
|
</StrictMode>,
|
||||||
|
);
|
||||||
|
}
|
||||||
77
frontend/src/routeTree.gen.ts
Normal file
77
frontend/src/routeTree.gen.ts
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
|
||||||
|
// This file was automatically generated by TanStack Router.
|
||||||
|
// You should NOT make any changes in this file as it will be overwritten.
|
||||||
|
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||||
|
|
||||||
|
import { Route as rootRouteImport } from './routes/__root'
|
||||||
|
import { Route as AboutRouteImport } from './routes/about'
|
||||||
|
import { Route as IndexRouteImport } from './routes/index'
|
||||||
|
|
||||||
|
const AboutRoute = AboutRouteImport.update({
|
||||||
|
id: '/about',
|
||||||
|
path: '/about',
|
||||||
|
getParentRoute: () => rootRouteImport,
|
||||||
|
} as any)
|
||||||
|
const IndexRoute = IndexRouteImport.update({
|
||||||
|
id: '/',
|
||||||
|
path: '/',
|
||||||
|
getParentRoute: () => rootRouteImport,
|
||||||
|
} as any)
|
||||||
|
|
||||||
|
export interface FileRoutesByFullPath {
|
||||||
|
'/': typeof IndexRoute
|
||||||
|
'/about': typeof AboutRoute
|
||||||
|
}
|
||||||
|
export interface FileRoutesByTo {
|
||||||
|
'/': typeof IndexRoute
|
||||||
|
'/about': typeof AboutRoute
|
||||||
|
}
|
||||||
|
export interface FileRoutesById {
|
||||||
|
__root__: typeof rootRouteImport
|
||||||
|
'/': typeof IndexRoute
|
||||||
|
'/about': typeof AboutRoute
|
||||||
|
}
|
||||||
|
export interface FileRouteTypes {
|
||||||
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
|
fullPaths: '/' | '/about'
|
||||||
|
fileRoutesByTo: FileRoutesByTo
|
||||||
|
to: '/' | '/about'
|
||||||
|
id: '__root__' | '/' | '/about'
|
||||||
|
fileRoutesById: FileRoutesById
|
||||||
|
}
|
||||||
|
export interface RootRouteChildren {
|
||||||
|
IndexRoute: typeof IndexRoute
|
||||||
|
AboutRoute: typeof AboutRoute
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@tanstack/react-router' {
|
||||||
|
interface FileRoutesByPath {
|
||||||
|
'/about': {
|
||||||
|
id: '/about'
|
||||||
|
path: '/about'
|
||||||
|
fullPath: '/about'
|
||||||
|
preLoaderRoute: typeof AboutRouteImport
|
||||||
|
parentRoute: typeof rootRouteImport
|
||||||
|
}
|
||||||
|
'/': {
|
||||||
|
id: '/'
|
||||||
|
path: '/'
|
||||||
|
fullPath: '/'
|
||||||
|
preLoaderRoute: typeof IndexRouteImport
|
||||||
|
parentRoute: typeof rootRouteImport
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootRouteChildren: RootRouteChildren = {
|
||||||
|
IndexRoute: IndexRoute,
|
||||||
|
AboutRoute: AboutRoute,
|
||||||
|
}
|
||||||
|
export const routeTree = rootRouteImport
|
||||||
|
._addFileChildren(rootRouteChildren)
|
||||||
|
._addFileTypes<FileRouteTypes>()
|
||||||
20
frontend/src/routes/__root.tsx
Normal file
20
frontend/src/routes/__root.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { createRootRoute, Link, Outlet } from '@tanstack/react-router'
|
||||||
|
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
|
||||||
|
|
||||||
|
const RootLayout = () => (
|
||||||
|
<>
|
||||||
|
<div className="p-2 flex gap-2">
|
||||||
|
<Link to="/" className="[&.active]:font-bold">
|
||||||
|
Home
|
||||||
|
</Link>{' '}
|
||||||
|
<Link to="/about" className="[&.active]:font-bold">
|
||||||
|
About
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<Outlet />
|
||||||
|
<TanStackRouterDevtools />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const Route = createRootRoute({ component: RootLayout })
|
||||||
9
frontend/src/routes/about.tsx
Normal file
9
frontend/src/routes/about.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { createFileRoute } from '@tanstack/react-router'
|
||||||
|
|
||||||
|
export const Route = createFileRoute('/about')({
|
||||||
|
component: About,
|
||||||
|
})
|
||||||
|
|
||||||
|
function About() {
|
||||||
|
return <div className="p-2">Hello from About!</div>
|
||||||
|
}
|
||||||
165
frontend/src/routes/index.tsx
Normal file
165
frontend/src/routes/index.tsx
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import socket from "@/lib/socket.io";
|
||||||
|
import { Button } from "../components/ui/button";
|
||||||
|
import { authClient, useSession } from "../lib/auth-client";
|
||||||
|
|
||||||
|
export const Route = createFileRoute("/")({
|
||||||
|
component: Index,
|
||||||
|
});
|
||||||
|
|
||||||
|
interface LogEntry {
|
||||||
|
level: number;
|
||||||
|
createdAt: Date;
|
||||||
|
pid: number;
|
||||||
|
hostname: string;
|
||||||
|
module: string;
|
||||||
|
message?: string;
|
||||||
|
[key: string]: any; // catch any extra fields
|
||||||
|
}
|
||||||
|
|
||||||
|
function Index() {
|
||||||
|
const { data: session, isPending } = useSession();
|
||||||
|
const [logs, setLogs] = useState<LogEntry[]>([]);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Connect if not already connected
|
||||||
|
if (!socket.connected) {
|
||||||
|
socket.connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on("connect", () => {
|
||||||
|
socket.emit("join-room", "logs");
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.emit("join-room", "logs");
|
||||||
|
socket.on(
|
||||||
|
"room-update",
|
||||||
|
(data: { payloads: LogEntry[]; roomId: string }) => {
|
||||||
|
setLogs((prev) => [...data.payloads, ...prev]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
// socket.on("logs", (data) => {
|
||||||
|
// console.log(data);
|
||||||
|
// setLogs((prev) => [...data.payloads, ...prev]);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// Cleanup listeners on unmount
|
||||||
|
return () => {
|
||||||
|
socket.emit("leave-room", "logs");
|
||||||
|
socket.off("room-update");
|
||||||
|
socket.off("logs");
|
||||||
|
};
|
||||||
|
}, []); // empty array = runs once on mount
|
||||||
|
|
||||||
|
const removeLog = (i: LogEntry) => {
|
||||||
|
setLogs(logs.filter((l) => l.id !== i.id));
|
||||||
|
};
|
||||||
|
|
||||||
|
const login = async () => {
|
||||||
|
try {
|
||||||
|
await authClient.signIn.email({
|
||||||
|
email: "blake.matthes@alpla.com",
|
||||||
|
password: "nova0511",
|
||||||
|
});
|
||||||
|
} catch (error: any) {
|
||||||
|
console.error(error.response);
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(session)
|
||||||
|
router.invalidate();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isPending) return <div>Loading...</div>;
|
||||||
|
// if (!session) return <button>Sign In</button>
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p-2">
|
||||||
|
<h3 className="w-2xl text-3xl">Welcome Home!</h3>
|
||||||
|
{!session ? (
|
||||||
|
<Button onClick={login}>Sign In</Button>
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
<span>welcome {session.user?.name}</span>
|
||||||
|
<Button onClick={() => authClient.signOut()}>Signout</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Log Table */}
|
||||||
|
<div className="rounded border overflow-auto max-h-[600px]">
|
||||||
|
<table className="w-full text-sm">
|
||||||
|
<thead className="bg-muted sticky top-0">
|
||||||
|
<tr>
|
||||||
|
<th className="text-left px-3 py-2">Time</th>
|
||||||
|
<th className="text-left px-3 py-2">Level</th>
|
||||||
|
<th className="text-left px-3 py-2">Module</th>
|
||||||
|
<th className="text-left px-3 py-2">Host</th>
|
||||||
|
<th className="text-left px-3 py-2">PID</th>
|
||||||
|
<th className="text-left px-3 py-2">Message</th>
|
||||||
|
<th className="text-left px-3 py-2">logId</th>
|
||||||
|
<th className="text-left px-3 py-2">remove</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{logs.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
colSpan={6}
|
||||||
|
className="text-center py-6 text-muted-foreground"
|
||||||
|
>
|
||||||
|
No logs yet — join the room to start receiving
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
logs.map((log, i) => (
|
||||||
|
<tr
|
||||||
|
key={`${log.id}-${i}`}
|
||||||
|
className="border-t hover:bg-muted/50"
|
||||||
|
>
|
||||||
|
<td className="px-3 py-2 whitespace-nowrap">
|
||||||
|
{new Date(log.createdAt).toLocaleTimeString()}
|
||||||
|
</td>
|
||||||
|
<td className="px-3 py-2">
|
||||||
|
<LevelBadge level={log.level} />
|
||||||
|
</td>
|
||||||
|
<td className="px-3 py-2">{log.module}</td>
|
||||||
|
<td className="px-3 py-2">{log.hostname}</td>
|
||||||
|
<td className="px-3 py-2">{log.pid}</td>
|
||||||
|
<td className="px-3 py-2 max-w-sm truncate">{log.message}</td>
|
||||||
|
<td className="px-3 py-2">{log.id}</td>
|
||||||
|
<td className="px-3 py-2">
|
||||||
|
<Button onClick={() => removeLog(log)}>Delete</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LevelBadge({ level }: { level: number }) {
|
||||||
|
const config: Record<number, { label: string; className: string }> = {
|
||||||
|
10: { label: "TRACE", className: "bg-gray-100 text-gray-600" },
|
||||||
|
20: { label: "DEBUG", className: "bg-blue-100 text-blue-700" },
|
||||||
|
30: { label: "INFO", className: "bg-green-100 text-green-700" },
|
||||||
|
40: { label: "WARN", className: "bg-yellow-100 text-yellow-700" },
|
||||||
|
50: { label: "ERROR", className: "bg-red-100 text-red-700" },
|
||||||
|
60: { label: "FATAL", className: "bg-purple-100 text-purple-700" },
|
||||||
|
};
|
||||||
|
|
||||||
|
const { label, className } = config[level] ?? {
|
||||||
|
label: String(level),
|
||||||
|
className: "bg-gray-100",
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span className={`px-2 py-0.5 rounded text-xs font-medium ${className}`}>
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
1
frontend/src/vite-env.d.ts
vendored
Normal file
1
frontend/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
31
frontend/tsconfig.app.json
Normal file
31
frontend/tsconfig.app.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
7
frontend/tsconfig.json
Normal file
7
frontend/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
],
|
||||||
|
}
|
||||||
25
frontend/tsconfig.node.json
Normal file
25
frontend/tsconfig.node.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2023",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
47
frontend/vite.config.ts
Normal file
47
frontend/vite.config.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import path from "node:path";
|
||||||
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
||||||
|
import react from "@vitejs/plugin-react-swc";
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
tailwindcss(),
|
||||||
|
tanstackRouter({
|
||||||
|
target: "react",
|
||||||
|
autoCodeSplitting: true,
|
||||||
|
}),
|
||||||
|
react(),
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": path.resolve(__dirname, "./src"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
base: "/lst/app",
|
||||||
|
build: {
|
||||||
|
//outDir: "../backend/frontend",
|
||||||
|
//assetsDir: "assets",
|
||||||
|
emptyOutDir: true,
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 5500,
|
||||||
|
host: true,
|
||||||
|
allowedHosts: true,
|
||||||
|
proxy: {
|
||||||
|
"/lst/api": {
|
||||||
|
target: `http://localhost:${Number(process.env.VITE_PORT || 3000)}`,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
"/lst/ws": {
|
||||||
|
target: `ws://localhost:${Number(process.env.VITE_PORT || 3000)}`, // Your Go WebSocket endpoint
|
||||||
|
ws: true,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
rewrite: (path) => path.replace(/^\/ws/, ""),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
5933
package-lock.json
generated
5933
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
29
package.json
29
package.json
@@ -5,26 +5,25 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "dotenvx run -f .env -- vitest",
|
"test": "dotenvx run -f .env -- vitest",
|
||||||
"dev": "dotenvx run -f .env -- npm run dev:app",
|
"dev": "concurrently -n \"server,frontend\" -c \"#007755, #1F73D1\" \"npm run dev:app\" \"npm run dev:frontend\"",
|
||||||
"dev:app": "tsx watch backend/server.ts",
|
"dev:app": "dotenvx run -f .env -- tsx watch backend/server.ts",
|
||||||
"dev:agent": "cd agent/src && tsx watch agent.ts",
|
"dev:frontend": "cd frontend && npm run dev",
|
||||||
"dev:db:migrate": "npx drizzle-kit push",
|
"dev:db:migrate": "npx drizzle-kit push",
|
||||||
"dev:db:generate": "tsc && npx drizzle-kit generate --config=drizzle.config.ts",
|
"dev:db:generate": "tsc && npx drizzle-kit generate --config=drizzle.config.ts",
|
||||||
"build": "rimraf dist && npm run dev:db:generate && npm run dev:db:migrate && npm run build:app && npm run build:copySql",
|
"build": "rimraf dist && npm run dev:db:generate && npm run dev:db:migrate && npm run build:app && npm run build:copySql && cd frontend && npm run build",
|
||||||
"build:app": "tsc",
|
"build:app": "tsc",
|
||||||
"agent": "powershell -ExecutionPolicy Bypass -File scripts/agentController.ps1",
|
"agent": "powershell -ExecutionPolicy Bypass -File scripts/agentController.ps1",
|
||||||
"build:docker": "docker compose up --force-recreate --build -d",
|
"build:docker": "docker compose up --force-recreate --build -d",
|
||||||
"build:copySql": "xcopy backend\\prodSql\\queries dist\\backend\\prodSql\\queries\\ /E /I /Y ",
|
"build:copySql": "xcopy backend\\prodSql\\queries dist\\prodSql\\queries\\ /E /I /Y ",
|
||||||
"lint": "tsc && biome lint",
|
"lint": "tsc && biome lint",
|
||||||
"start": "set NODE_ENV=production && npm run start:server",
|
"start": "npm run start:server",
|
||||||
"start:server": "dotenvx run -f .env -- node dist/backend/server.js",
|
"start:server": "dotenvx run -f .env -- node dist/server.js",
|
||||||
"start:docker": "node dist/backend/server.js",
|
"start:docker": "node dist/server.js",
|
||||||
"commit": "cz",
|
"commit": "cz",
|
||||||
"changeset": "changeset",
|
"changeset": "changeset",
|
||||||
"version": "changeset version",
|
"version": "changeset version",
|
||||||
"release": "dotenvx run -f .env -- npm run version && git push --follow-tags && node scripts/create-release.js",
|
"release": "dotenvx run -f .env -- npm run version && git push --follow-tags && node scripts/create-release.js",
|
||||||
"specCheck": "node scripts/check-route-specs.mjs"
|
"specCheck": "node scripts/check-route-specs.mjs"
|
||||||
|
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"backend",
|
"backend",
|
||||||
@@ -44,8 +43,6 @@
|
|||||||
"@changesets/cli": "^2.29.8",
|
"@changesets/cli": "^2.29.8",
|
||||||
"@commitlint/cli": "^20.4.1",
|
"@commitlint/cli": "^20.4.1",
|
||||||
"@commitlint/config-conventional": "^20.4.1",
|
"@commitlint/config-conventional": "^20.4.1",
|
||||||
"@swc/core": "^1.15.11",
|
|
||||||
"@swc/jest": "^0.2.39",
|
|
||||||
"@types/cors": "^2.8.19",
|
"@types/cors": "^2.8.19",
|
||||||
"@types/express": "^5.0.6",
|
"@types/express": "^5.0.6",
|
||||||
"@types/morgan": "^1.9.10",
|
"@types/morgan": "^1.9.10",
|
||||||
@@ -59,25 +56,21 @@
|
|||||||
"@types/supertest": "^6.0.3",
|
"@types/supertest": "^6.0.3",
|
||||||
"@types/swagger-jsdoc": "^6.0.4",
|
"@types/swagger-jsdoc": "^6.0.4",
|
||||||
"@types/swagger-ui-express": "^4.1.8",
|
"@types/swagger-ui-express": "^4.1.8",
|
||||||
"@vercel/ncc": "^0.38.4",
|
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.1",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"npm-check-updates": "^19.3.2",
|
"npm-check-updates": "^19.3.2",
|
||||||
"openapi-types": "^12.1.3",
|
"openapi-types": "^12.1.3",
|
||||||
"supertest": "^7.2.2",
|
|
||||||
"ts-jest": "^29.4.6",
|
|
||||||
"ts-node-dev": "^2.0.0",
|
"ts-node-dev": "^2.0.0",
|
||||||
"tsx": "^4.21.0",
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3"
|
||||||
"vite-tsconfig-paths": "^6.1.1",
|
|
||||||
"vitest": "^4.0.18"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dotenvx/dotenvx": "^1.52.0",
|
"@dotenvx/dotenvx": "^1.52.0",
|
||||||
"@scalar/express-api-reference": "^0.8.41",
|
"@scalar/express-api-reference": "^0.8.41",
|
||||||
"@socket.io/admin-ui": "^0.5.1",
|
"@socket.io/admin-ui": "^0.5.1",
|
||||||
"axios": "^1.13.5",
|
"axios": "^1.13.5",
|
||||||
"better-auth": "^1.4.18",
|
"better-auth": "^1.5.5",
|
||||||
|
"concurrently": "^9.2.1",
|
||||||
"cors": "^2.8.6",
|
"cors": "^2.8.6",
|
||||||
"croner": "^10.0.1",
|
"croner": "^10.0.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
|
|||||||
@@ -10,13 +10,16 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"rootDir": ".",
|
"rootDir": "./backend",
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"exactOptionalPropertyTypes": true,
|
"exactOptionalPropertyTypes": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": "./backend",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
},
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user