A comprehensive real-time resource monitoring system for Mars Base operations, built with React, TypeScript, and modern web technologies.
- Real-time Dashboard: Monitor critical resources (oxygen, water, food, spare parts) in real-time
- Resource Analytics: Visualize consumption trends with interactive charts
- Alert System: Get notified when resources reach critical or warning levels
- Resupply Management: Create and track resupply requests with priority levels
- Inventory Management: Complete overview of all base resources with filtering and search
- Mars-themed UI: Dark theme with Mars-inspired color palette
- Framework: React 19 with Vite
- Language: TypeScript
- UI Components: ShadcnUI
- Styling: Tailwind CSS v4
- State Management: React Hooks (custom)
- Routing: React Router v6
- Charts: Recharts
- Icons: Lucide React
- Date Handling: date-fns
- Notifications: Sonner (ShadcnUI)
src/
├── components/
│ ├── ui/ # ShadcnUI components
│ ├── layout/ # Layout components (Header, Sidebar, MainLayout)
│ ├── dashboard/ # Dashboard-specific components
│ └── common/ # Shared components
├── pages/ # Page components (Dashboard, Inventory, etc.)
├── hooks/ # Custom React hooks
├── types/ # TypeScript type definitions
├── mocks/ # Mock data services
├── utils/ # Utility functions and constants
└── lib/ # Shared libraries
- Node.js 18+ or higher
- pnpm (recommended) or npm
- Clone the repository:
git clone <repository-url>
cd mars-frontend- Install dependencies:
pnpm install- Start the development server:
pnpm run dev- Open http://localhost:5173 in your browser
pnpm run buildpnpm run preview- Components: Organized by feature and type
- Hooks: Business logic separated into reusable hooks
- Types: Centralized type definitions
- Mocks: Isolated mock data for easy backend integration
- Single Responsibility: Each component has a single, well-defined purpose
- Open/Closed: Components are extensible through props
- Dependency Inversion: Components depend on abstractions (hooks) not implementations
- Reusable utility functions in
utils/ - Common components in
components/common/ - Centralized type definitions in
types/
- Real-time resource monitoring
- Alert panel with acknowledgment system
- Quick actions for emergency resupply
- Searchable and filterable resource table
- Status indicators and trend information
- Last updated timestamps
- Historical resource level charts
- Consumption rate tracking
- Resource comparison visualizations
- Configurable time ranges (24h, 7d, 30d, 90d)
- Create new resupply requests
- Track request status (pending, approved, in transit, delivered)
- Priority-based request management
The application currently uses mock data located in src/mocks/. To integrate with a real backend:
- Create API service files in
src/services/ - Replace mock data calls in hooks with API calls
- Update the hooks to handle loading and error states appropriately
Example structure for backend integration:
// src/services/api.ts
import axios from 'axios';
const api = axios.create({
baseURL: import.meta.env.VITE_API_URL,
});
export const resourcesApi = {
getAll: () => api.get('/resources'),
getById: (id: string) => api.get(`/resources/${id}`),
// ... more endpoints
};Create a .env file in the root directory:
VITE_API_URL=http://localhost:3000/api
VITE_SOCKET_URL=http://localhost:3000The application uses a Mars-inspired dark theme:
- Primary (Mars Red):
#C1440E - Accent (Mars Orange):
#E86A33 - Background: Dark tones for space simulation
- Status Colors:
- Critical: Red
- Warning: Yellow
- Success: Green
- Info: Blue
When adding new features:
- Follow the existing folder structure
- Create TypeScript types in
src/types/ - Add mock data in
src/mocks/if needed - Create reusable components in appropriate folders
- Use custom hooks for business logic
- Follow the DRY principle
Copyright PERFICIENT - All rights reserved
Built for Mars Base Operations - PERFICIENT Mission Control