# Network Scanner Frontend A modern, React-based frontend for the Network Scanner visualization tool. ## Features - πŸ—ΊοΈ **Interactive Network Map** - Visualize network topology with react-flow - πŸ“Š **Real-time Updates** - WebSocket integration for live scan progress - πŸ–₯️ **Host Management** - Browse, search, and view detailed host information - πŸ” **Scan Control** - Start, monitor, and manage network scans - πŸ“± **Responsive Design** - Works on desktop and mobile devices - 🎨 **Modern UI** - Built with TailwindCSS and Lucide icons ## Tech Stack - **React 18** - UI framework - **TypeScript** - Type safety - **Vite** - Build tool - **React Flow** - Network diagram visualization - **React Router** - Navigation - **Axios** - HTTP client - **TailwindCSS** - Styling - **Lucide React** - Icons ## Quick Start ### Install Dependencies ```bash npm install ``` ### Development Server ```bash npm run dev ``` The application will be available at `http://localhost:3000` ### Build for Production ```bash npm run build ``` ### Preview Production Build ```bash npm run preview ``` ## Configuration Create a `.env` file in the root directory: ```env VITE_API_URL=http://localhost:8000 VITE_WS_URL=ws://localhost:8000 ``` ## Project Structure ``` frontend/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ components/ # React components β”‚ β”‚ β”œβ”€β”€ Layout.tsx # Main layout with navigation β”‚ β”‚ β”œβ”€β”€ ScanForm.tsx # Scan configuration form β”‚ β”‚ β”œβ”€β”€ NetworkMap.tsx # Network topology visualization β”‚ β”‚ β”œβ”€β”€ HostNode.tsx # Custom node for network map β”‚ β”‚ └── HostDetails.tsx # Host detail modal β”‚ β”œβ”€β”€ pages/ # Page components β”‚ β”‚ β”œβ”€β”€ Dashboard.tsx # Main dashboard β”‚ β”‚ β”œβ”€β”€ NetworkPage.tsx # Network map view β”‚ β”‚ β”œβ”€β”€ HostsPage.tsx # Hosts table view β”‚ β”‚ └── ScansPage.tsx # Scans list view β”‚ β”œβ”€β”€ hooks/ # Custom React hooks β”‚ β”‚ β”œβ”€β”€ useScans.ts # Scan data management β”‚ β”‚ β”œβ”€β”€ useHosts.ts # Host data management β”‚ β”‚ β”œβ”€β”€ useTopology.ts # Topology data management β”‚ β”‚ └── useWebSocket.ts # WebSocket connection β”‚ β”œβ”€β”€ services/ # API services β”‚ β”‚ β”œβ”€β”€ api.ts # REST API client β”‚ β”‚ └── websocket.ts # WebSocket client β”‚ β”œβ”€β”€ types/ # TypeScript types β”‚ β”‚ └── api.ts # API type definitions β”‚ β”œβ”€β”€ utils/ # Utility functions β”‚ β”‚ └── helpers.ts # Helper functions β”‚ β”œβ”€β”€ App.tsx # Main app component β”‚ β”œβ”€β”€ main.tsx # Entry point β”‚ └── index.css # Global styles β”œβ”€β”€ public/ # Static assets β”œβ”€β”€ index.html # HTML template β”œβ”€β”€ package.json # Dependencies β”œβ”€β”€ tsconfig.json # TypeScript config β”œβ”€β”€ vite.config.ts # Vite config β”œβ”€β”€ tailwind.config.js # Tailwind config └── README.md # This file ``` ## Usage ### Dashboard The dashboard provides an overview of your network: - Statistics cards showing total hosts, active hosts, services, and scans - Quick scan form to start new scans - Recent scans list with progress indicators - Common services overview ### Network Map Interactive network topology visualization: - Pan and zoom the diagram - Click nodes to view host details - Color-coded by host type (gateway, server, workstation, device) - Real-time updates as scans discover new hosts - Export diagram (PNG/SVG) ### Hosts Browse all discovered hosts: - Searchable table view - Filter by status - Click any host to view details - View services running on each host ### Scans Manage network scans: - View all scans with status and progress - Cancel running scans - View scan results and errors ## API Integration The frontend communicates with the backend API at `http://localhost:8000`: - **REST API**: `/api/*` endpoints for data operations - **WebSocket**: `/api/ws` for real-time updates ## Development ### Code Style - ESLint for linting - TypeScript for type checking - Prettier recommended for formatting ### Building ```bash npm run build ``` Output will be in the `dist/` directory. ## Browser Support - Chrome (latest) - Firefox (latest) - Safari (latest) - Edge (latest) ## License MIT ## Author DevAgent - Full-stack Development AI