React 18+ frontend application for visualizing and analyzing IIoT sensor data quality using TypeScript, Vite, and Tailwind CSS.
For local development, the frontend runs separately from Docker:
cd frontend
npm install
npm run devThe frontend will be available at http://localhost:5173
Build the production bundle:
cd frontend
npm install
npm run buildThe optimized build output will be in the dist/ directory.
Test the production build locally:
npm run previewdocker build -t fame-frontend ./frontenddocker run -p 5173:5173 fame-frontendThe application will be available at http://localhost:5173
For production deployment, uncomment the frontend service in docker-compose.yml:
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: fame-frontend
ports:
- "5173:5173"
environment:
- VITE_API_URL=http://backend:8000
depends_on:
- backend
networks:
- fame-network
restart: unless-stoppedThen start with:
docker-compose up -d frontendNote: Currently, the API base URL is hardcoded to http://localhost:8000 in the source code. For production deployment, consider:
- Using Vite environment variables (
VITE_API_URL) - Updating all API calls to use
import.meta.env.VITE_API_URL - Setting the environment variable in Docker Compose or deployment configuration
Example:
const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:8000'frontend/
├── src/
│ ├── components/ # Reusable React components
│ │ ├── Card.tsx
│ │ ├── Footer.tsx
│ │ └── SensorSelector.tsx
│ ├── pages/ # Page components (routes)
│ │ ├── Home.tsx
│ │ ├── DataLoading.tsx
│ │ ├── DataVisualization.tsx
│ │ ├── DataQuality.tsx
│ │ ├── MissingValues.tsx
│ │ ├── InvalidValues.tsx
│ │ └── DQAAgent.tsx
│ ├── assets/ # Static assets (images, icons)
│ ├── App.tsx # Main app component with routing
│ ├── main.tsx # Application entry point
│ └── styles.css # Global styles
├── index.html # HTML template
├── package.json # Dependencies
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript configuration
├── tailwind.config.js # Tailwind CSS configuration
└── Dockerfile # Production Docker image
npm run dev- Start development server with hot-reloadnpm run build- Build production bundlenpm run preview- Preview production build locally
- React 18+ - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- React Router - Client-side routing
- Recharts - Data visualization
- Lucide React - Icon library
The frontend communicates with the backend API at http://localhost:8000 (development) or the configured VITE_API_URL (production).
GET /tables- List machine groupsGET /data- Get aggregated insights dataGET /data/preprocessed- Get preprocessed sensor dataGET /tags- Get sensor metadata/thresholdsGET /analytics/*- Various analytics endpointsPOST /import/upload- Upload and import data filesPOST /agent/chat/stream- DQA Agent chat (streaming)
- Module not found: Run
npm installto install dependencies - Type errors: Check
tsconfig.jsonconfiguration - Build fails: Ensure Node.js version is 18+ (check with
node --version)
- Port already in use: Change port in
vite.config.tsor kill existing process - Hot-reload not working: Restart dev server
- API connection errors: Verify backend is running on port 8000
- API calls fail: Ensure
VITE_API_URLis set correctly for production - Static assets not loading: Check base path in
vite.config.ts - CORS errors: Configure CORS in backend to allow frontend origin
- The frontend uses React Router for client-side routing
- All API calls use native
fetchAPI - State management is handled with React hooks (useState, useEffect)
- Tailwind CSS classes are used for styling
- TypeScript interfaces define data structures for API responses