React-based single-page application for the Titanic Survivor Prediction system.
# From the project root directory
docker compose -f 'compose/compose.dev.yaml' up -d --build
# Access the application
open http://localhost:8080No setup needed! The service starts with hot reload enabled.
- React 19 with TypeScript
- Tailwind CSS for responsive styling
- Mobile-first design approach
- JWT Authentication with persistent sessions
- Reusable Component Library
- Hot Module Replacement in development
- Nginx reverse proxy for API routing
/- Landing page with marketing content/calculator- Survival prediction calculator/admin- Model management console (requires login)/dashboard- User dashboard with prediction history/signin&/signup- Authentication pages
frontend/
βββ src/
β βββ components/ # UI components
β β βββ common/ # Reusable components
β β β βββ Alert.tsx
β β β βββ Button.tsx
β β β βββ Card.tsx
β β β βββ forms/
β β βββ calculator/ # Prediction UI
β β βββ admin/ # Admin console
β β βββ models/ # Model management
β βββ pages/ # Page components
β βββ services/ # API integration
β βββ hooks/ # Custom React hooks
β βββ App.tsx # Root component
βββ public/ # Static assets
βββ nginx.conf # Production config
βββ nginx.dev.conf # Development config
The application includes a comprehensive set of reusable components:
import { Alert, Card, Section, PageHeader } from 'components/common';
// Success alert
<Alert variant="success" title="Success!">
Your prediction has been saved.
</Alert>
// Content card
<Card className="p-6">
<h2>Passenger Details</h2>
{/* content */}
</Card>import { Input, Select, Checkbox, Button } from 'components/common/forms';
// Text input with validation
<Input
id="age"
label="Age"
type="number"
value={age}
onChange={setAge}
min={0}
max={100}
required
/>
// Action button
<Button variant="primary" onClick={handleSubmit}>
Predict Survival
</Button>- Display: Alert, Card, Section, PageHeader, EmptyState, LoadingState
- Forms: Input, Select, Checkbox, Button, DropDown
- Navigation: Navbar, NavbarHamburger (mobile)
- Utility: Layout, ConnectionStatus
cd app/frontend
# Install dependencies (if not already done)
npm install
# Run tests
npm test
# Check linting
npm run lint
# Check code formatting
npx prettier --check src
# Auto-fix formatting
npm run format- Component snapshots in
__tests__/ - Integration tests for user flows
- Unit tests for services and utilities
- Code changes reflect instantly
- State preserved during updates
- CSS updates without refresh
- Development: Proxies
/api.*to backend service - Production: Nginx handles routing
- No CORS issues in development
- Responsive breakpoints: 640px, 768px, 1024px
- Touch-friendly interactions
- Optimized for phone and tablet
The production build is automatically created when using:
docker compose -f compose/compose.prod-local.yaml upThis creates an optimized build with:
- Minified JavaScript and CSS
- Tree-shaken dependencies
- Optimized images
- Gzip compression via Nginx
- Chrome >= 119
- Firefox >= 122
- Safari >= 16.1
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Android)
The app uses Tailwind CSS with custom theme:
/* Color palette defined in global.css */
--primary: 210 40% 30%
--secondary: 210 40% 90%
--accent: 210 40% 50%
--background: 245 40% 98%
--foreground: 220 15% 20%Blank page or components not loading:
# Clear Docker volumes and rebuild
docker compose down -v
docker compose up --buildChanges not reflecting:
# Restart the development application
docker compose -f 'compose\compose.dev.yaml' down
docker compose -f 'compose\compose.dev.yaml' up -d --buildAPI errors in console:
# Check backend logs for errors
docker compose logs -f backend