devjas1
commited on
Commit
·
cede51b
1
Parent(s):
f1a9e72
(CONFIG)[Adjust deps to be lightweight]: update requirements.txt to streamline dependencies and focus on core functionality.
Browse files- drizzle.config.ts +0 -14
- models/embeddinggemma-300m.py +0 -15
- models/models/embeddinggemma-300m/README.md +1 -0
- package-lock.json +0 -0
- package.json +0 -105
- postcss.config.js +0 -6
- replit.md +0 -74
- requirements.txt +2 -43
- server/index.ts +0 -71
- server/routes.ts +0 -15
- server/storage.ts +0 -38
- server/vite.ts +0 -85
- shared/schema.ts +0 -18
- tailwind.config.ts +0 -95
- to-remove.txt +0 -1
- tsconfig.json +0 -23
- vite.config.ts +0 -37
drizzle.config.ts
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
import { defineConfig } from "drizzle-kit";
|
2 |
-
|
3 |
-
if (!process.env.DATABASE_URL) {
|
4 |
-
throw new Error("DATABASE_URL, ensure the database is provisioned");
|
5 |
-
}
|
6 |
-
|
7 |
-
export default defineConfig({
|
8 |
-
out: "./migrations",
|
9 |
-
schema: "./shared/schema.ts",
|
10 |
-
dialect: "postgresql",
|
11 |
-
dbCredentials: {
|
12 |
-
url: process.env.DATABASE_URL,
|
13 |
-
},
|
14 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/embeddinggemma-300m.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
from sentence_transformers import SentenceTransformer
|
2 |
-
|
3 |
-
model = SentenceTransformer("google/embeddinggemma-300m")
|
4 |
-
|
5 |
-
query = "Which planet is known as the Red Planet?"
|
6 |
-
docs = [
|
7 |
-
"Mars, known for its reddish appearance, is often referred to as the Red Planet.",
|
8 |
-
"Venus is similar in size to Earth.",
|
9 |
-
]
|
10 |
-
import numpy as np
|
11 |
-
|
12 |
-
q_emb = np.array(model.encode_query(query))
|
13 |
-
d_emb = np.array(model.encode_document(docs))
|
14 |
-
|
15 |
-
print(q_emb.shape, d_emb.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/models/embeddinggemma-300m/README.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# Place EmbeddingGemma-300m model files here
|
package-lock.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
package.json
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "rest-express",
|
3 |
-
"version": "1.0.0",
|
4 |
-
"type": "module",
|
5 |
-
"license": "MIT",
|
6 |
-
"scripts": {
|
7 |
-
"dev": "NODE_ENV=development tsx server/index.ts",
|
8 |
-
"build": "vite build && esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist",
|
9 |
-
"start": "NODE_ENV=production node dist/index.js",
|
10 |
-
"check": "tsc",
|
11 |
-
"db:push": "drizzle-kit push"
|
12 |
-
},
|
13 |
-
"dependencies": {
|
14 |
-
"@hookform/resolvers": "^3.10.0",
|
15 |
-
"@jridgewell/trace-mapping": "^0.3.25",
|
16 |
-
"@neondatabase/serverless": "^0.10.4",
|
17 |
-
"@radix-ui/react-accordion": "^1.2.4",
|
18 |
-
"@radix-ui/react-alert-dialog": "^1.1.7",
|
19 |
-
"@radix-ui/react-aspect-ratio": "^1.1.3",
|
20 |
-
"@radix-ui/react-avatar": "^1.1.4",
|
21 |
-
"@radix-ui/react-checkbox": "^1.1.5",
|
22 |
-
"@radix-ui/react-collapsible": "^1.1.4",
|
23 |
-
"@radix-ui/react-context-menu": "^2.2.7",
|
24 |
-
"@radix-ui/react-dialog": "^1.1.7",
|
25 |
-
"@radix-ui/react-dropdown-menu": "^2.1.7",
|
26 |
-
"@radix-ui/react-hover-card": "^1.1.7",
|
27 |
-
"@radix-ui/react-label": "^2.1.3",
|
28 |
-
"@radix-ui/react-menubar": "^1.1.7",
|
29 |
-
"@radix-ui/react-navigation-menu": "^1.2.6",
|
30 |
-
"@radix-ui/react-popover": "^1.1.7",
|
31 |
-
"@radix-ui/react-progress": "^1.1.3",
|
32 |
-
"@radix-ui/react-radio-group": "^1.2.4",
|
33 |
-
"@radix-ui/react-scroll-area": "^1.2.4",
|
34 |
-
"@radix-ui/react-select": "^2.1.7",
|
35 |
-
"@radix-ui/react-separator": "^1.1.3",
|
36 |
-
"@radix-ui/react-slider": "^1.2.4",
|
37 |
-
"@radix-ui/react-slot": "^1.2.0",
|
38 |
-
"@radix-ui/react-switch": "^1.1.4",
|
39 |
-
"@radix-ui/react-tabs": "^1.1.4",
|
40 |
-
"@radix-ui/react-toast": "^1.2.7",
|
41 |
-
"@radix-ui/react-toggle": "^1.1.3",
|
42 |
-
"@radix-ui/react-toggle-group": "^1.1.3",
|
43 |
-
"@radix-ui/react-tooltip": "^1.2.0",
|
44 |
-
"@tanstack/react-query": "^5.60.5",
|
45 |
-
"class-variance-authority": "^0.7.1",
|
46 |
-
"clsx": "^2.1.1",
|
47 |
-
"cmdk": "^1.1.1",
|
48 |
-
"connect-pg-simple": "^10.0.0",
|
49 |
-
"date-fns": "^3.6.0",
|
50 |
-
"drizzle-orm": "^0.39.1",
|
51 |
-
"drizzle-zod": "^0.7.0",
|
52 |
-
"embla-carousel-react": "^8.6.0",
|
53 |
-
"express": "^4.21.2",
|
54 |
-
"express-session": "^1.18.1",
|
55 |
-
"framer-motion": "^11.13.1",
|
56 |
-
"input-otp": "^1.4.2",
|
57 |
-
"lucide-react": "^0.453.0",
|
58 |
-
"memorystore": "^1.6.7",
|
59 |
-
"next-themes": "^0.4.6",
|
60 |
-
"passport": "^0.7.0",
|
61 |
-
"passport-local": "^1.0.0",
|
62 |
-
"react": "^18.3.1",
|
63 |
-
"react-day-picker": "^8.10.1",
|
64 |
-
"react-dom": "^18.3.1",
|
65 |
-
"react-hook-form": "^7.55.0",
|
66 |
-
"react-icons": "^5.4.0",
|
67 |
-
"react-resizable-panels": "^2.1.7",
|
68 |
-
"recharts": "^2.15.2",
|
69 |
-
"tailwind-merge": "^2.6.0",
|
70 |
-
"tailwindcss-animate": "^1.0.7",
|
71 |
-
"tw-animate-css": "^1.2.5",
|
72 |
-
"vaul": "^1.1.2",
|
73 |
-
"wouter": "^3.3.5",
|
74 |
-
"ws": "^8.18.0",
|
75 |
-
"zod": "^3.24.2",
|
76 |
-
"zod-validation-error": "^3.4.0"
|
77 |
-
},
|
78 |
-
"devDependencies": {
|
79 |
-
"@replit/vite-plugin-cartographer": "^0.3.0",
|
80 |
-
"@replit/vite-plugin-runtime-error-modal": "^0.0.3",
|
81 |
-
"@tailwindcss/typography": "^0.5.15",
|
82 |
-
"@tailwindcss/vite": "^4.1.3",
|
83 |
-
"@types/connect-pg-simple": "^7.0.3",
|
84 |
-
"@types/express": "4.17.21",
|
85 |
-
"@types/express-session": "^1.18.0",
|
86 |
-
"@types/node": "20.16.11",
|
87 |
-
"@types/passport": "^1.0.16",
|
88 |
-
"@types/passport-local": "^1.0.38",
|
89 |
-
"@types/react": "^18.3.11",
|
90 |
-
"@types/react-dom": "^18.3.1",
|
91 |
-
"@types/ws": "^8.5.13",
|
92 |
-
"@vitejs/plugin-react": "^4.3.2",
|
93 |
-
"autoprefixer": "^10.4.20",
|
94 |
-
"drizzle-kit": "^0.30.4",
|
95 |
-
"esbuild": "^0.25.0",
|
96 |
-
"postcss": "^8.4.47",
|
97 |
-
"tailwindcss": "^3.4.17",
|
98 |
-
"tsx": "^4.19.1",
|
99 |
-
"typescript": "5.6.3",
|
100 |
-
"vite": "^5.4.19"
|
101 |
-
},
|
102 |
-
"optionalDependencies": {
|
103 |
-
"bufferutil": "^4.0.8"
|
104 |
-
}
|
105 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
postcss.config.js
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
export default {
|
2 |
-
plugins: {
|
3 |
-
tailwindcss: {},
|
4 |
-
autoprefixer: {},
|
5 |
-
},
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
replit.md
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
# Overview
|
2 |
-
|
3 |
-
This is a full-stack web application built with React and Express that appears to be designed as a dashboard interface for a machine learning CLI tool called "Gemma-Phi2-CLI". The application provides a user interface for managing an intelligent document assistant that combines EmbeddingGemma-300m for text embeddings, FAISS for vector storage, and Phi-2 for text generation. The project uses a modern tech stack with TypeScript, Vite for frontend bundling, Drizzle ORM for database operations, and a comprehensive UI component library based on Radix UI and shadcn/ui.
|
4 |
-
|
5 |
-
# User Preferences
|
6 |
-
|
7 |
-
Preferred communication style: Simple, everyday language.
|
8 |
-
|
9 |
-
# System Architecture
|
10 |
-
|
11 |
-
## Frontend Architecture
|
12 |
-
The frontend is built as a Single Page Application (SPA) using React with TypeScript. The application uses Vite as the build tool and development server, providing fast hot module replacement and optimized production builds. The UI is constructed using a comprehensive component library based on Radix UI primitives and styled with Tailwind CSS, following the shadcn/ui design system. State management is handled through React Query (TanStack Query) for server state and React's built-in state management for local component state.
|
13 |
-
|
14 |
-
The application follows a modular component structure with clearly separated concerns:
|
15 |
-
- Pages for top-level route components
|
16 |
-
- Reusable UI components in a dedicated components directory
|
17 |
-
- Custom hooks for shared logic
|
18 |
-
- Centralized styling with CSS variables for theming
|
19 |
-
|
20 |
-
## Backend Architecture
|
21 |
-
The backend uses Express.js with TypeScript in ESM module format. The server implements a RESTful API architecture with middleware for request logging, JSON parsing, and error handling. The application uses a modular route structure that can be extended with API endpoints prefixed with `/api`. The server integrates with Vite in development mode for seamless full-stack development experience.
|
22 |
-
|
23 |
-
The storage layer is abstracted through an interface-based approach, currently implementing an in-memory storage solution but designed to be easily swapped for persistent storage solutions. The storage interface provides basic CRUD operations for user management.
|
24 |
-
|
25 |
-
## Database Design
|
26 |
-
The application uses Drizzle ORM with PostgreSQL as the database. The schema is defined using Drizzle's TypeScript-first approach with type-safe database operations. The current schema includes a users table with fields for ID (UUID), username, and password. The database configuration supports migrations and uses environment variables for connection strings.
|
27 |
-
|
28 |
-
## Authentication and Session Management
|
29 |
-
The application includes basic user management structures but does not implement full authentication in the current state. The foundation is laid for session-based authentication with the inclusion of connect-pg-simple for PostgreSQL session storage.
|
30 |
-
|
31 |
-
## Development and Build Process
|
32 |
-
The project uses a monorepo structure with shared types and schemas between frontend and backend. TypeScript configuration is set up for strict type checking across the entire codebase. The build process creates optimized bundles for both client and server code, with the server being bundled using esbuild for production deployment.
|
33 |
-
|
34 |
-
The development workflow includes:
|
35 |
-
- Hot module replacement for frontend development
|
36 |
-
- Automatic server restart for backend changes
|
37 |
-
- Type checking across the entire codebase
|
38 |
-
- Database migration support through Drizzle Kit
|
39 |
-
|
40 |
-
# External Dependencies
|
41 |
-
|
42 |
-
## UI and Styling
|
43 |
-
- **Radix UI**: Comprehensive set of unstyled, accessible UI primitives for building the component library
|
44 |
-
- **Tailwind CSS**: Utility-first CSS framework for styling with custom design tokens
|
45 |
-
- **Lucide React**: Icon library providing consistent iconography throughout the application
|
46 |
-
- **Class Variance Authority**: Utility for creating variant-based component APIs
|
47 |
-
|
48 |
-
## Data Management
|
49 |
-
- **TanStack React Query**: Server state management with caching, synchronization, and background updates
|
50 |
-
- **React Hook Form**: Form state management with validation support
|
51 |
-
- **Hookform Resolvers**: Integration between React Hook Form and validation libraries
|
52 |
-
- **Zod**: TypeScript-first schema validation library
|
53 |
-
|
54 |
-
## Database and ORM
|
55 |
-
- **Drizzle ORM**: TypeScript-first ORM with type-safe database operations
|
56 |
-
- **Drizzle Zod**: Integration between Drizzle ORM and Zod for schema validation
|
57 |
-
- **@neondatabase/serverless**: PostgreSQL database driver optimized for serverless environments
|
58 |
-
- **connect-pg-simple**: PostgreSQL session store for Express sessions
|
59 |
-
|
60 |
-
## Development Tools
|
61 |
-
- **Vite**: Fast build tool and development server with hot module replacement
|
62 |
-
- **esbuild**: Fast JavaScript bundler for server-side code
|
63 |
-
- **tsx**: TypeScript execution environment for development
|
64 |
-
- **@replit/vite-plugin-runtime-error-modal**: Replit-specific development enhancement
|
65 |
-
- **@replit/vite-plugin-cartographer**: Development tooling for Replit environment
|
66 |
-
|
67 |
-
## Routing and Navigation
|
68 |
-
- **Wouter**: Lightweight client-side routing library for React
|
69 |
-
|
70 |
-
## Additional Libraries
|
71 |
-
- **date-fns**: Modern JavaScript date utility library
|
72 |
-
- **clsx**: Utility for constructing className strings conditionally
|
73 |
-
- **embla-carousel-react**: Carousel component for React applications
|
74 |
-
- **cmdk**: Command palette component for React
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -1,51 +1,10 @@
|
|
1 |
|
2 |
# Core ML and NLP dependencies
|
3 |
-
torch>=2.0.0
|
4 |
-
transformers>=4.35.0
|
5 |
sentence-transformers>=2.2.2
|
6 |
-
accelerate>=0.24.0
|
7 |
-
tokenizers>=0.15.0
|
8 |
-
|
9 |
# Vector storage and search
|
10 |
faiss-cpu>=1.7.4
|
11 |
-
chromadb>=0.4.15
|
12 |
-
|
13 |
# CLI framework and utilities
|
|
|
14 |
typer>=0.9.0
|
15 |
-
click>=8.1.0
|
16 |
-
rich>=13.6.0
|
17 |
-
pydantic>=2.5.0
|
18 |
-
|
19 |
-
# Configuration and data handling
|
20 |
-
pyyaml>=6.0.1
|
21 |
-
toml>=0.10.2
|
22 |
-
python-dotenv>=1.0.0
|
23 |
-
|
24 |
-
# Git integration for diff analysis
|
25 |
-
gitpython>=3.1.40
|
26 |
-
pygments>=2.16.0
|
27 |
-
|
28 |
-
# File processing and I/O
|
29 |
-
pathlib2>=2.3.7
|
30 |
-
tqdm>=4.66.0
|
31 |
-
pandas>=2.1.0
|
32 |
-
|
33 |
-
# Quantization and optimization (for Phi-2)
|
34 |
-
bitsandbytes>=0.41.0
|
35 |
-
optimum>=1.14.0
|
36 |
-
|
37 |
-
# HTTP server (for optional API mode)
|
38 |
-
fastapi>=0.104.0
|
39 |
-
uvicorn>=0.24.0
|
40 |
-
httpx>=0.25.0
|
41 |
-
|
42 |
-
# Testing framework
|
43 |
-
pytest>=7.4.0
|
44 |
-
pytest-asyncio>=0.21.0
|
45 |
-
pytest-cov>=4.1.0
|
46 |
-
|
47 |
# Development tools
|
48 |
-
|
49 |
-
isort>=5.12.0
|
50 |
-
flake8>=6.1.0
|
51 |
-
mypy>=1.6.0
|
|
|
1 |
|
2 |
# Core ML and NLP dependencies
|
|
|
|
|
3 |
sentence-transformers>=2.2.2
|
|
|
|
|
|
|
4 |
# Vector storage and search
|
5 |
faiss-cpu>=1.7.4
|
|
|
|
|
6 |
# CLI framework and utilities
|
7 |
+
llama-cpp-python>=0.2.23
|
8 |
typer>=0.9.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Development tools
|
10 |
+
PyYaml>=6.0
|
|
|
|
|
|
server/index.ts
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
import express, { type Request, Response, NextFunction } from "express";
|
2 |
-
import { registerRoutes } from "./routes";
|
3 |
-
import { setupVite, serveStatic, log } from "./vite";
|
4 |
-
|
5 |
-
const app = express();
|
6 |
-
app.use(express.json());
|
7 |
-
app.use(express.urlencoded({ extended: false }));
|
8 |
-
|
9 |
-
app.use((req, res, next) => {
|
10 |
-
const start = Date.now();
|
11 |
-
const path = req.path;
|
12 |
-
let capturedJsonResponse: Record<string, any> | undefined = undefined;
|
13 |
-
|
14 |
-
const originalResJson = res.json;
|
15 |
-
res.json = function (bodyJson, ...args) {
|
16 |
-
capturedJsonResponse = bodyJson;
|
17 |
-
return originalResJson.apply(res, [bodyJson, ...args]);
|
18 |
-
};
|
19 |
-
|
20 |
-
res.on("finish", () => {
|
21 |
-
const duration = Date.now() - start;
|
22 |
-
if (path.startsWith("/api")) {
|
23 |
-
let logLine = `${req.method} ${path} ${res.statusCode} in ${duration}ms`;
|
24 |
-
if (capturedJsonResponse) {
|
25 |
-
logLine += ` :: ${JSON.stringify(capturedJsonResponse)}`;
|
26 |
-
}
|
27 |
-
|
28 |
-
if (logLine.length > 80) {
|
29 |
-
logLine = logLine.slice(0, 79) + "…";
|
30 |
-
}
|
31 |
-
|
32 |
-
log(logLine);
|
33 |
-
}
|
34 |
-
});
|
35 |
-
|
36 |
-
next();
|
37 |
-
});
|
38 |
-
|
39 |
-
(async () => {
|
40 |
-
const server = await registerRoutes(app);
|
41 |
-
|
42 |
-
app.use((err: any, _req: Request, res: Response, _next: NextFunction) => {
|
43 |
-
const status = err.status || err.statusCode || 500;
|
44 |
-
const message = err.message || "Internal Server Error";
|
45 |
-
|
46 |
-
res.status(status).json({ message });
|
47 |
-
throw err;
|
48 |
-
});
|
49 |
-
|
50 |
-
// importantly only setup vite in development and after
|
51 |
-
// setting up all the other routes so the catch-all route
|
52 |
-
// doesn't interfere with the other routes
|
53 |
-
if (app.get("env") === "development") {
|
54 |
-
await setupVite(app, server);
|
55 |
-
} else {
|
56 |
-
serveStatic(app);
|
57 |
-
}
|
58 |
-
|
59 |
-
// ALWAYS serve the app on the port specified in the environment variable PORT
|
60 |
-
// Other ports are firewalled. Default to 5000 if not specified.
|
61 |
-
// this serves both the API and the client.
|
62 |
-
// It is the only port that is not firewalled.
|
63 |
-
const port = parseInt(process.env.PORT || '5000', 10);
|
64 |
-
server.listen({
|
65 |
-
port,
|
66 |
-
host: "0.0.0.0",
|
67 |
-
reusePort: true,
|
68 |
-
}, () => {
|
69 |
-
log(`serving on port ${port}`);
|
70 |
-
});
|
71 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server/routes.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
import type { Express } from "express";
|
2 |
-
import { createServer, type Server } from "http";
|
3 |
-
import { storage } from "./storage";
|
4 |
-
|
5 |
-
export async function registerRoutes(app: Express): Promise<Server> {
|
6 |
-
// put application routes here
|
7 |
-
// prefix all routes with /api
|
8 |
-
|
9 |
-
// use storage to perform CRUD operations on the storage interface
|
10 |
-
// e.g. storage.insertUser(user) or storage.getUserByUsername(username)
|
11 |
-
|
12 |
-
const httpServer = createServer(app);
|
13 |
-
|
14 |
-
return httpServer;
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server/storage.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
import { type User, type InsertUser } from "@shared/schema";
|
2 |
-
import { randomUUID } from "crypto";
|
3 |
-
|
4 |
-
// modify the interface with any CRUD methods
|
5 |
-
// you might need
|
6 |
-
|
7 |
-
export interface IStorage {
|
8 |
-
getUser(id: string): Promise<User | undefined>;
|
9 |
-
getUserByUsername(username: string): Promise<User | undefined>;
|
10 |
-
createUser(user: InsertUser): Promise<User>;
|
11 |
-
}
|
12 |
-
|
13 |
-
export class MemStorage implements IStorage {
|
14 |
-
private users: Map<string, User>;
|
15 |
-
|
16 |
-
constructor() {
|
17 |
-
this.users = new Map();
|
18 |
-
}
|
19 |
-
|
20 |
-
async getUser(id: string): Promise<User | undefined> {
|
21 |
-
return this.users.get(id);
|
22 |
-
}
|
23 |
-
|
24 |
-
async getUserByUsername(username: string): Promise<User | undefined> {
|
25 |
-
return Array.from(this.users.values()).find(
|
26 |
-
(user) => user.username === username,
|
27 |
-
);
|
28 |
-
}
|
29 |
-
|
30 |
-
async createUser(insertUser: InsertUser): Promise<User> {
|
31 |
-
const id = randomUUID();
|
32 |
-
const user: User = { ...insertUser, id };
|
33 |
-
this.users.set(id, user);
|
34 |
-
return user;
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
export const storage = new MemStorage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server/vite.ts
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
import express, { type Express } from "express";
|
2 |
-
import fs from "fs";
|
3 |
-
import path from "path";
|
4 |
-
import { createServer as createViteServer, createLogger } from "vite";
|
5 |
-
import { type Server } from "http";
|
6 |
-
import viteConfig from "../vite.config";
|
7 |
-
import { nanoid } from "nanoid";
|
8 |
-
|
9 |
-
const viteLogger = createLogger();
|
10 |
-
|
11 |
-
export function log(message: string, source = "express") {
|
12 |
-
const formattedTime = new Date().toLocaleTimeString("en-US", {
|
13 |
-
hour: "numeric",
|
14 |
-
minute: "2-digit",
|
15 |
-
second: "2-digit",
|
16 |
-
hour12: true,
|
17 |
-
});
|
18 |
-
|
19 |
-
console.log(`${formattedTime} [${source}] ${message}`);
|
20 |
-
}
|
21 |
-
|
22 |
-
export async function setupVite(app: Express, server: Server) {
|
23 |
-
const serverOptions = {
|
24 |
-
middlewareMode: true,
|
25 |
-
hmr: { server },
|
26 |
-
allowedHosts: true as const,
|
27 |
-
};
|
28 |
-
|
29 |
-
const vite = await createViteServer({
|
30 |
-
...viteConfig,
|
31 |
-
configFile: false,
|
32 |
-
customLogger: {
|
33 |
-
...viteLogger,
|
34 |
-
error: (msg, options) => {
|
35 |
-
viteLogger.error(msg, options);
|
36 |
-
process.exit(1);
|
37 |
-
},
|
38 |
-
},
|
39 |
-
server: serverOptions,
|
40 |
-
appType: "custom",
|
41 |
-
});
|
42 |
-
|
43 |
-
app.use(vite.middlewares);
|
44 |
-
app.use("*", async (req, res, next) => {
|
45 |
-
const url = req.originalUrl;
|
46 |
-
|
47 |
-
try {
|
48 |
-
const clientTemplate = path.resolve(
|
49 |
-
import.meta.dirname,
|
50 |
-
"..",
|
51 |
-
"client",
|
52 |
-
"index.html",
|
53 |
-
);
|
54 |
-
|
55 |
-
// always reload the index.html file from disk incase it changes
|
56 |
-
let template = await fs.promises.readFile(clientTemplate, "utf-8");
|
57 |
-
template = template.replace(
|
58 |
-
`src="/src/main.tsx"`,
|
59 |
-
`src="/src/main.tsx?v=${nanoid()}"`,
|
60 |
-
);
|
61 |
-
const page = await vite.transformIndexHtml(url, template);
|
62 |
-
res.status(200).set({ "Content-Type": "text/html" }).end(page);
|
63 |
-
} catch (e) {
|
64 |
-
vite.ssrFixStacktrace(e as Error);
|
65 |
-
next(e);
|
66 |
-
}
|
67 |
-
});
|
68 |
-
}
|
69 |
-
|
70 |
-
export function serveStatic(app: Express) {
|
71 |
-
const distPath = path.resolve(import.meta.dirname, "public");
|
72 |
-
|
73 |
-
if (!fs.existsSync(distPath)) {
|
74 |
-
throw new Error(
|
75 |
-
`Could not find the build directory: ${distPath}, make sure to build the client first`,
|
76 |
-
);
|
77 |
-
}
|
78 |
-
|
79 |
-
app.use(express.static(distPath));
|
80 |
-
|
81 |
-
// fall through to index.html if the file doesn't exist
|
82 |
-
app.use("*", (_req, res) => {
|
83 |
-
res.sendFile(path.resolve(distPath, "index.html"));
|
84 |
-
});
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shared/schema.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
import { sql } from "drizzle-orm";
|
2 |
-
import { pgTable, text, varchar } from "drizzle-orm/pg-core";
|
3 |
-
import { createInsertSchema } from "drizzle-zod";
|
4 |
-
import { z } from "zod";
|
5 |
-
|
6 |
-
export const users = pgTable("users", {
|
7 |
-
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
8 |
-
username: text("username").notNull().unique(),
|
9 |
-
password: text("password").notNull(),
|
10 |
-
});
|
11 |
-
|
12 |
-
export const insertUserSchema = createInsertSchema(users).pick({
|
13 |
-
username: true,
|
14 |
-
password: true,
|
15 |
-
});
|
16 |
-
|
17 |
-
export type InsertUser = z.infer<typeof insertUserSchema>;
|
18 |
-
export type User = typeof users.$inferSelect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tailwind.config.ts
DELETED
@@ -1,95 +0,0 @@
|
|
1 |
-
import type { Config } from "tailwindcss";
|
2 |
-
|
3 |
-
export default {
|
4 |
-
darkMode: ["class"],
|
5 |
-
content: ["./client/index.html", "./client/src/**/*.{js,jsx,ts,tsx}"],
|
6 |
-
theme: {
|
7 |
-
extend: {
|
8 |
-
borderRadius: {
|
9 |
-
lg: "var(--radius)",
|
10 |
-
md: "calc(var(--radius) - 2px)",
|
11 |
-
sm: "calc(var(--radius) - 4px)",
|
12 |
-
},
|
13 |
-
colors: {
|
14 |
-
background: "var(--background)",
|
15 |
-
foreground: "var(--foreground)",
|
16 |
-
card: {
|
17 |
-
DEFAULT: "var(--card)",
|
18 |
-
foreground: "var(--card-foreground)",
|
19 |
-
},
|
20 |
-
popover: {
|
21 |
-
DEFAULT: "var(--popover)",
|
22 |
-
foreground: "var(--popover-foreground)",
|
23 |
-
},
|
24 |
-
primary: {
|
25 |
-
DEFAULT: "var(--primary)",
|
26 |
-
foreground: "var(--primary-foreground)",
|
27 |
-
},
|
28 |
-
secondary: {
|
29 |
-
DEFAULT: "var(--secondary)",
|
30 |
-
foreground: "var(--secondary-foreground)",
|
31 |
-
},
|
32 |
-
muted: {
|
33 |
-
DEFAULT: "var(--muted)",
|
34 |
-
foreground: "var(--muted-foreground)",
|
35 |
-
},
|
36 |
-
accent: {
|
37 |
-
DEFAULT: "var(--accent)",
|
38 |
-
foreground: "var(--accent-foreground)",
|
39 |
-
},
|
40 |
-
destructive: {
|
41 |
-
DEFAULT: "var(--destructive)",
|
42 |
-
foreground: "var(--destructive-foreground)",
|
43 |
-
},
|
44 |
-
border: "var(--border)",
|
45 |
-
input: "var(--input)",
|
46 |
-
ring: "var(--ring)",
|
47 |
-
chart: {
|
48 |
-
"1": "var(--chart-1)",
|
49 |
-
"2": "var(--chart-2)",
|
50 |
-
"3": "var(--chart-3)",
|
51 |
-
"4": "var(--chart-4)",
|
52 |
-
"5": "var(--chart-5)",
|
53 |
-
},
|
54 |
-
sidebar: {
|
55 |
-
DEFAULT: "var(--sidebar-background)",
|
56 |
-
foreground: "var(--sidebar-foreground)",
|
57 |
-
primary: "var(--sidebar-primary)",
|
58 |
-
"primary-foreground": "var(--sidebar-primary-foreground)",
|
59 |
-
accent: "var(--sidebar-accent)",
|
60 |
-
"accent-foreground": "var(--sidebar-accent-foreground)",
|
61 |
-
border: "var(--sidebar-border)",
|
62 |
-
ring: "var(--sidebar-ring)",
|
63 |
-
},
|
64 |
-
},
|
65 |
-
fontFamily: {
|
66 |
-
sans: ["var(--font-sans)"],
|
67 |
-
serif: ["var(--font-serif)"],
|
68 |
-
mono: ["var(--font-mono)"],
|
69 |
-
},
|
70 |
-
keyframes: {
|
71 |
-
"accordion-down": {
|
72 |
-
from: {
|
73 |
-
height: "0",
|
74 |
-
},
|
75 |
-
to: {
|
76 |
-
height: "var(--radix-accordion-content-height)",
|
77 |
-
},
|
78 |
-
},
|
79 |
-
"accordion-up": {
|
80 |
-
from: {
|
81 |
-
height: "var(--radix-accordion-content-height)",
|
82 |
-
},
|
83 |
-
to: {
|
84 |
-
height: "0",
|
85 |
-
},
|
86 |
-
},
|
87 |
-
},
|
88 |
-
animation: {
|
89 |
-
"accordion-down": "accordion-down 0.2s ease-out",
|
90 |
-
"accordion-up": "accordion-up 0.2s ease-out",
|
91 |
-
},
|
92 |
-
},
|
93 |
-
},
|
94 |
-
plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")],
|
95 |
-
} satisfies Config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
to-remove.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
*.gguf
|
|
|
|
tsconfig.json
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"include": ["client/src/**/*", "shared/**/*", "server/**/*"],
|
3 |
-
"exclude": ["node_modules", "build", "dist", "**/*.test.ts"],
|
4 |
-
"compilerOptions": {
|
5 |
-
"incremental": true,
|
6 |
-
"tsBuildInfoFile": "./node_modules/typescript/tsbuildinfo",
|
7 |
-
"noEmit": true,
|
8 |
-
"module": "ESNext",
|
9 |
-
"strict": true,
|
10 |
-
"lib": ["esnext", "dom", "dom.iterable"],
|
11 |
-
"jsx": "preserve",
|
12 |
-
"esModuleInterop": true,
|
13 |
-
"skipLibCheck": true,
|
14 |
-
"allowImportingTsExtensions": true,
|
15 |
-
"moduleResolution": "bundler",
|
16 |
-
"baseUrl": ".",
|
17 |
-
"types": ["node", "vite/client"],
|
18 |
-
"paths": {
|
19 |
-
"@/*": ["./client/src/*"],
|
20 |
-
"@shared/*": ["./shared/*"]
|
21 |
-
}
|
22 |
-
}
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vite.config.ts
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
import { defineConfig } from "vite";
|
2 |
-
import react from "@vitejs/plugin-react";
|
3 |
-
import path from "path";
|
4 |
-
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
|
5 |
-
|
6 |
-
export default defineConfig({
|
7 |
-
plugins: [
|
8 |
-
react(),
|
9 |
-
runtimeErrorOverlay(),
|
10 |
-
...(process.env.NODE_ENV !== "production" &&
|
11 |
-
process.env.REPL_ID !== undefined
|
12 |
-
? [
|
13 |
-
await import("@replit/vite-plugin-cartographer").then((m) =>
|
14 |
-
m.cartographer(),
|
15 |
-
),
|
16 |
-
]
|
17 |
-
: []),
|
18 |
-
],
|
19 |
-
resolve: {
|
20 |
-
alias: {
|
21 |
-
"@": path.resolve(import.meta.dirname, "client", "src"),
|
22 |
-
"@shared": path.resolve(import.meta.dirname, "shared"),
|
23 |
-
"@assets": path.resolve(import.meta.dirname, "attached_assets"),
|
24 |
-
},
|
25 |
-
},
|
26 |
-
root: path.resolve(import.meta.dirname, "client"),
|
27 |
-
build: {
|
28 |
-
outDir: path.resolve(import.meta.dirname, "dist/public"),
|
29 |
-
emptyOutDir: true,
|
30 |
-
},
|
31 |
-
server: {
|
32 |
-
fs: {
|
33 |
-
strict: true,
|
34 |
-
deny: ["**/.*"],
|
35 |
-
},
|
36 |
-
},
|
37 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|