Prep build setup for stack

This commit is contained in:
Christbru 2025-10-18 15:26:44 -05:00
commit bd2ffee9ae
14 changed files with 668 additions and 91 deletions

39
.dockerignore Normal file
View file

@ -0,0 +1,39 @@
# Node modules
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Build outputs
dist
build
target
# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# IDE
.vscode
.idea
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# Git
.git
.gitignore
# Documentation
README.md
DEVELOPMENT.md
*.md
# Scripts
setup-check.ps1

117
DEVELOPMENT.md Normal file
View file

@ -0,0 +1,117 @@
# CodeRED-Astra Development Guide
## Project Structure
This is a hackathon-ready project with a clean separation between frontend and backend:
- **React Frontend** (`web-app/`): Modern React app with Vite and Tailwind CSS
- **Rust Engine** (`rust-engine/`): High-performance backend API server
- **Database**: MySQL 8.0 with phpMyAdmin for management
## Quick Start
### Prerequisites
- Docker & Docker Compose
- Node.js 20+ (for local development)
- Rust 1.82+ (for local development)
### Development Setup
1. **Clone and setup environment**:
```bash
cp .env.example .env
# Edit .env with your database passwords and API keys
```
2. **Start the entire stack**:
```bash
docker-compose up --build
```
3. **Access the application**:
- Frontend: http://localhost (port 80)
- Rust API: http://localhost:8000
- phpMyAdmin: http://127.0.0.1:8080
### Local Development (Recommended for Hackathon)
**Frontend Development**:
```bash
cd web-app
npm install
npm run dev # Starts on http://localhost:5173
```
**Backend Development**:
```bash
cd rust-engine
cargo run # Starts on http://localhost:8000
```
## Team Workflow
### Frontend Team (React)
- Work in `web-app/src/`
- Main entry: `src/App.jsx`
- Add new components in `src/components/`
- API calls go through `/api/*` (auto-proxied to Rust engine)
- Use Tailwind CSS for styling
- Hot reload enabled with Vite
### Backend Team (Rust)
- Work in `rust-engine/src/`
- Main server: `src/main.rs`
- Add new modules in `src/`
- API endpoints start with `/api/`
- Database connection via SQLx
- CORS enabled for frontend communication
## API Communication
The frontend communicates with the Rust engine via:
```javascript
// This automatically proxies to http://rust-engine:8000 in Docker
// or http://localhost:8000 in local development
fetch('/api/health')
.then(response => response.json())
.then(data => console.log(data));
```
## Database Schema
Edit `rust-engine/src/main.rs` to add database migrations and models as needed.
## Environment Variables
Required in `.env`:
```
MYSQL_DATABASE=astra
MYSQL_USER=astraadmin
MYSQL_PASSWORD=your_secure_password
MYSQL_ROOT_PASSWORD=your_root_password
GEMINI_API_KEY=your_gemini_key
```
## Deployment
The project is containerized and ready for deployment:
- Frontend: Static files served via Vite preview
- Backend: Optimized Rust binary
- Database: Persistent MySQL data volume
## Hackathon Tips
1. **Frontend team**: Start with the existing App.jsx and build your UI components
2. **Backend team**: Add new API endpoints in the Rust main.rs file
3. **Database**: Use phpMyAdmin at http://127.0.0.1:8080 to manage data
4. **Testing**: The app shows connection status between frontend and backend
5. **Hot reload**: Both frontend and backend support hot reload during development
## Common Issues
- **CORS errors**: Already configured, but check Rust engine CORS settings if needed
- **Database connection**: Engine gracefully handles DB offline state for initial development
- **Port conflicts**: Web runs on 80, API on 8000, phpMyAdmin on 8080
- **Build failures**: Check Node.js and Rust versions match requirements
Happy hacking! 🚀

View file

@ -1,16 +1,75 @@
# React + Vite
# CodeRED-Astra 🚀
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
A hackathon-ready project with React frontend and Rust backend engine.
Currently, two official plugins are available:
## Quick Start
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) 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
```bash
# 1. Setup environment
cp .env.example .env
# Edit .env with your credentials
## React Compiler
# 2. Start everything with Docker
docker-compose up --build
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
# 3. Access your app
# Frontend: http://localhost
# API: http://localhost:8000
# Database Admin: http://127.0.0.1:8080
```
## Expanding the ESLint configuration
## Development
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
**Frontend (React + Vite)**:
```bash
cd web-app
npm install
npm run dev # http://localhost:5173
```
**Backend (Rust)**:
```bash
cd rust-engine
cargo run # http://localhost:8000
```
## Architecture
- **Frontend**: React 18 + Vite + Tailwind CSS
- **Backend**: Rust + Warp + SQLx
- **Database**: MySQL 8.0 + phpMyAdmin
- **API**: RESTful endpoints with CORS enabled
- **Docker**: Full containerization for easy deployment
## Project Structure
```
├── web-app/ # React frontend
│ ├── src/
│ │ ├── App.jsx # Main component
│ │ └── main.jsx # Entry point
│ └── Dockerfile
├── rust-engine/ # Rust backend
│ ├── src/
│ │ └── main.rs # API server
│ └── Dockerfile
├── docker-compose.yml # Full stack orchestration
└── .env.example # Environment template
```
## Team Workflow
- **Frontend devs**: Work in `web-app/src/`, use `/api/*` for backend calls
- **Backend devs**: Work in `rust-engine/src/`, add endpoints to main.rs
- **Database**: Access phpMyAdmin at http://127.0.0.1:8080
## Features
✅ Hot reload for both frontend and backend
✅ Automatic API proxying from React to Rust
✅ Database connection with graceful fallback
✅ CORS configured for cross-origin requests
✅ Production-ready Docker containers
✅ Health monitoring and status dashboard
Ready for your hackathon! See `DEVELOPMENT.md` for detailed setup instructions.

6
rust-engine/Cargo.lock generated Normal file
View file

@ -0,0 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
# This file will be generated when you first run cargo build
# Leaving it as a placeholder for Docker caching

View file

@ -0,0 +1,17 @@
[package]
name = "rust-engine"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1.0", features = ["full"] }
warp = "0.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "mysql", "chrono"] }
chrono = { version = "0.4", features = ["serde"] }
tracing = "0.1"
tracing-subscriber = "0.3"
dotenv = "0.15"
cors = "0.6"
anyhow = "1.0"

View file

@ -1,12 +1,30 @@
# rust-engine/Dockerfile
# --- Stage 1: Builder ---
FROM rust:1.7-slim as builder
FROM rust:1.82-slim AS builder
WORKDIR /usr/src/app
COPY . .
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy Cargo files for dependency caching
COPY Cargo.toml Cargo.lock ./
# Create a dummy src/main.rs for dependency build
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release && rm src/main.rs
# Copy source code and build
COPY src ./src
RUN cargo build --release
# --- Stage 2: Final Image ---
FROM debian:buster-slim
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/src/app/target/release/rust-engine /usr/local/bin/rust-engine
EXPOSE 8000
CMD ["rust-engine"]

132
rust-engine/src/main.rs Normal file
View file

@ -0,0 +1,132 @@
use std::env;
use warp::Filter;
use sqlx::mysql::MySqlPool;
use serde::{Deserialize, Serialize};
use tracing::{info, warn};
#[derive(Debug, Serialize, Deserialize)]
struct HealthResponse {
status: String,
timestamp: String,
}
#[derive(Debug, Serialize, Deserialize)]
struct ApiResponse<T> {
success: bool,
data: Option<T>,
message: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize tracing
tracing_subscriber::init();
// Load environment variables
dotenv::dotenv().ok();
let database_url = env::var("DATABASE_URL")
.unwrap_or_else(|_| "mysql://astraadmin:password@mysql:3306/astra".to_string());
info!("Starting Rust Engine...");
info!("Connecting to database: {}", database_url);
// Connect to database
let pool = match MySqlPool::connect(&database_url).await {
Ok(pool) => {
info!("Successfully connected to database");
pool
}
Err(e) => {
warn!("Failed to connect to database: {}. Starting without DB connection.", e);
// In a hackathon setting, we might want to continue without DB for initial testing
return start_server_without_db().await;
}
};
// CORS configuration
let cors = warp::cors()
.allow_any_origin()
.allow_headers(vec!["content-type", "authorization"])
.allow_methods(vec!["GET", "POST", "PUT", "DELETE", "OPTIONS"]);
// Health check endpoint
let health = warp::path("health")
.and(warp::get())
.map(|| {
let response = HealthResponse {
status: "healthy".to_string(),
timestamp: chrono::Utc::now().to_rfc3339(),
};
warp::reply::json(&ApiResponse {
success: true,
data: Some(response),
message: None,
})
});
// API routes - you'll expand these for your hackathon needs
let api = warp::path("api")
.and(
health.or(
// Add more routes here as needed
warp::path("version")
.and(warp::get())
.map(|| {
warp::reply::json(&ApiResponse {
success: true,
data: Some("1.0.0"),
message: Some("Rust Engine API".to_string()),
})
})
)
);
let routes = api
.with(cors)
.with(warp::log("rust_engine"));
info!("Rust Engine started on http://0.0.0.0:8000");
warp::serve(routes)
.run(([0, 0, 0, 0], 8000))
.await;
Ok(())
}
async fn start_server_without_db() -> Result<(), Box<dyn std::error::Error>> {
info!("Starting server in DB-less mode for development");
let cors = warp::cors()
.allow_any_origin()
.allow_headers(vec!["content-type", "authorization"])
.allow_methods(vec!["GET", "POST", "PUT", "DELETE", "OPTIONS"]);
let health = warp::path("health")
.and(warp::get())
.map(|| {
let response = HealthResponse {
status: "healthy (no db)".to_string(),
timestamp: chrono::Utc::now().to_rfc3339(),
};
warp::reply::json(&ApiResponse {
success: true,
data: Some(response),
message: Some("Running without database connection".to_string()),
})
});
let routes = warp::path("api")
.and(health)
.with(cors)
.with(warp::log("rust_engine"));
info!("Rust Engine started on http://0.0.0.0:8000 (DB-less mode)");
warp::serve(routes)
.run(([0, 0, 0, 0], 8000))
.await;
Ok(())
}

62
setup-check.ps1 Normal file
View file

@ -0,0 +1,62 @@
#!/usr/bin/env pwsh
Write-Host "🚀 CodeRED-Astra Setup Verification" -ForegroundColor Green
Write-Host "=================================" -ForegroundColor Green
# Check if Docker is available
Write-Host "`n📦 Checking Docker..." -ForegroundColor Yellow
try {
$dockerVersion = docker --version
Write-Host "✅ Docker found: $dockerVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Docker not found. Please install Docker Desktop." -ForegroundColor Red
exit 1
}
# Check if .env exists
Write-Host "`n🔧 Checking environment setup..." -ForegroundColor Yellow
if (Test-Path ".env") {
Write-Host "✅ .env file exists" -ForegroundColor Green
} else {
Write-Host "⚠️ .env file not found. Creating from template..." -ForegroundColor Yellow
Copy-Item ".env.example" ".env"
Write-Host "✅ Created .env file. Please edit it with your credentials!" -ForegroundColor Green
}
# Check Node.js (for local development)
Write-Host "`n📱 Checking Node.js..." -ForegroundColor Yellow
try {
$nodeVersion = node --version
Write-Host "✅ Node.js found: $nodeVersion" -ForegroundColor Green
} catch {
Write-Host "⚠️ Node.js not found (needed for local frontend development)" -ForegroundColor Yellow
}
# Check Rust (for local development)
Write-Host "`n🦀 Checking Rust..." -ForegroundColor Yellow
try {
$rustVersion = rustc --version
Write-Host "✅ Rust found: $rustVersion" -ForegroundColor Green
} catch {
Write-Host "⚠️ Rust not found (needed for local backend development)" -ForegroundColor Yellow
}
Write-Host "`n🎯 Setup Summary:" -ForegroundColor Cyan
Write-Host "=================" -ForegroundColor Cyan
Write-Host "• Frontend: React + Vite + Tailwind CSS" -ForegroundColor White
Write-Host "• Backend: Rust + Warp + SQLx + MySQL" -ForegroundColor White
Write-Host "• Docker: Full stack containerization" -ForegroundColor White
Write-Host "`n🚀 Quick Start Commands:" -ForegroundColor Magenta
Write-Host "========================" -ForegroundColor Magenta
Write-Host "1. Start full stack: docker-compose up --build" -ForegroundColor White
Write-Host "2. Frontend dev: cd web-app && npm install && npm run dev" -ForegroundColor White
Write-Host "3. Backend dev: cd rust-engine && cargo run" -ForegroundColor White
Write-Host "`n📍 Access URLs:" -ForegroundColor Cyan
Write-Host "===============" -ForegroundColor Cyan
Write-Host "• Web App: http://localhost (Docker) or http://localhost:5173 (local)" -ForegroundColor White
Write-Host "• Rust API: http://localhost:8000" -ForegroundColor White
Write-Host "• phpMyAdmin: http://127.0.0.1:8080" -ForegroundColor White
Write-Host "`n✨ Your hackathon project is ready! Happy coding! ✨" -ForegroundColor Green

View file

@ -6,17 +6,17 @@ WORKDIR /app
# Copy package files first to leverage Docker's build cache
COPY package*.json ./
# Install all dependencies needed for the build
RUN npm install
# Install dependencies
RUN npm ci --only=production=false
# Copy the rest of your application code
COPY . .
# Run the build script to compile the React frontend
# Build the React application
RUN npm run build
# Expose the port your server will listen on
# Expose the port
EXPOSE 3000
# The command to start your production server
CMD ["npm", "run", "host"]
# Use preview mode for production-like serving
CMD ["npm", "run", "preview"]

View file

@ -1,40 +1,37 @@
{
"name": "codered-astra",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite",
"host": "vite host",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"clean-dist": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r",
"clean-all": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r && find . -path ./node_modules -prune -o -name 'node_modules' | xargs rm -rf "
"build": "vite build",
"preview": "vite preview",
"host": "vite --host 0.0.0.0 --port 3000",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write \"**/*.{js,jsx,md}\""
},
"license": "ISC",
"dependencies": {
"@google/genai": "^1.25.0",
"@vitejs/plugin-react": "^5.0.4",
"cors": "^2.8.5",
"dotenv": "^17.2.3",
"express": "^5.1.0",
"helmet": "^8.1.0",
"@google/generative-ai": "^0.21.0",
"axios": "^1.7.7",
"lucide-react": "^0.546.0",
"pg": "^8.16.3",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-router": "^7.9.4",
"react-router-dom": "^7.9.4",
"tailwindcss": "^4.1.14",
"vite-jsconfig-paths": "^2.0.1"
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.28.0"
},
"packageManager": ">=npm@10.9.0",
"devDependencies": {
"eslint": "^9.38.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.0",
"eslint-plugin-react-refresh": "^0.4.24",
"nodemon": "^3.1.10",
"prettier": "^3.6.2",
"vite": "^7.1.10"
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"eslint": "^9.14.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.14",
"vite": "^5.4.10",
"vite-jsconfig-paths": "^2.0.1"
}
}

View file

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View file

@ -1,34 +1,136 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import "./App.css";
import { useState, useEffect } from "react";
import { Cpu, Database, Zap, Activity } from "lucide-react";
function App() {
const [count, setCount] = useState(0);
const [engineStatus, setEngineStatus] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
checkEngineHealth();
}, []);
const checkEngineHealth = async () => {
try {
const response = await fetch('/api/health');
const data = await response.json();
setEngineStatus(data);
} catch (error) {
console.error('Engine health check failed:', error);
setEngineStatus({ success: false, message: 'Engine offline' });
} finally {
setLoading(false);
}
};
return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900 to-violet-900">
<div className="container mx-auto px-4 py-8">
{/* Header */}
<header className="text-center mb-12">
<div className="flex items-center justify-center mb-4">
<Zap className="h-12 w-12 text-yellow-400 mr-3" />
<h1 className="text-4xl font-bold text-white">
CodeRED-Astra
</h1>
</div>
<p className="text-gray-300 text-lg">
Hackathon Project - React Frontend + Rust Engine
</p>
</header>
{/* Status Cards */}
<div className="grid md:grid-cols-2 gap-6 mb-8">
{/* React App Status */}
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
<div className="flex items-center mb-4">
<Activity className="h-8 w-8 text-blue-400 mr-3" />
<h2 className="text-xl font-semibold text-white">React Frontend</h2>
</div>
<div className="text-green-400 font-medium"> Online</div>
<p className="text-gray-300 text-sm mt-2">
Vite + React development environment ready
</p>
</div>
{/* Rust Engine Status */}
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
<div className="flex items-center mb-4">
<Cpu className="h-8 w-8 text-orange-400 mr-3" />
<h2 className="text-xl font-semibold text-white">Rust Engine</h2>
</div>
<div className={`font-medium ${loading ? 'text-yellow-400' : engineStatus?.success ? 'text-green-400' : 'text-red-400'}`}>
{loading ? '⏳ Checking...' : engineStatus?.success ? '✓ Online' : '✗ Offline'}
</div>
<p className="text-gray-300 text-sm mt-2">
{loading ? 'Connecting to engine...' :
engineStatus?.success ? 'Engine responding normally' :
'Engine may still be starting up'}
</p>
</div>
</div>
{/* Engine Details */}
{engineStatus?.success && (
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20 mb-8">
<div className="flex items-center mb-4">
<Database className="h-6 w-6 text-purple-400 mr-3" />
<h3 className="text-lg font-semibold text-white">Engine Status</h3>
</div>
<div className="grid md:grid-cols-2 gap-4 text-sm">
<div>
<span className="text-gray-400">Status:</span>
<span className="text-white ml-2">{engineStatus.data?.status}</span>
</div>
<div>
<span className="text-gray-400">Last Check:</span>
<span className="text-white ml-2">
{engineStatus.data?.timestamp ? new Date(engineStatus.data.timestamp).toLocaleTimeString() : 'N/A'}
</span>
</div>
</div>
{engineStatus.message && (
<div className="mt-3 p-3 bg-yellow-500/20 border border-yellow-500/30 rounded">
<span className="text-yellow-200 text-sm">{engineStatus.message}</span>
</div>
)}
</div>
)}
{/* Quick Actions */}
<div className="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
<h3 className="text-lg font-semibold text-white mb-4">Quick Actions</h3>
<div className="flex flex-wrap gap-3">
<button
onClick={checkEngineHealth}
className="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors"
>
Refresh Status
</button>
<button
onClick={() => window.open('/api/health', '_blank')}
className="px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors"
>
Test API Direct
</button>
<button
onClick={() => alert('Add your hackathon features here!')}
className="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors"
>
Add Feature
</button>
</div>
</div>
{/* Development Notes */}
<div className="mt-8 text-center text-gray-400 text-sm">
<p>🚀 Ready for hackathon development!</p>
<p className="mt-1">
Frontend team: Work in <code className="bg-white/10 px-1 rounded">web-app/src/</code> |
Backend team: Work in <code className="bg-white/10 px-1 rounded">rust-engine/src/</code>
</p>
</div>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.jsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
</div>
);
}

View file

@ -2,28 +2,32 @@
@tailwind components;
@tailwind utilities;
.light {
--paragraph: 16, 17, 20;
--background: 229, 230, 240;
--primary: 41, 49, 97;
--secondary: 122, 137, 220;
--accent: 32, 55, 203;
background: rgba(var(--background));
}
.dark {
--paragraph: 235, 236, 239;
--background: 15, 16, 26;
--primary: 158, 166, 214;
--secondary: 35, 50, 133;
--accent: 52, 75, 223;
background: rgba(var(--background));
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
margin: 0;
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",
"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
#root {
width: 100%;
margin: 0;
}
code {
font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

View file

@ -5,4 +5,22 @@ import jsconfigPaths from "vite-jsconfig-paths";
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), jsconfigPaths()],
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
target: process.env.RUST_ENGINE_URL || 'http://localhost:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
preview: {
host: '0.0.0.0',
port: 3000
},
build: {
outDir: 'dist'
}
});