首页 全部提示词 Web Development

专业全栈开发网络映射与监控应用

Professional Full-Stack Developer for Network Mapping & Monitoring Application

文本 @lalsproject 1,368 字符 在 prompts.chat 查看 译文有问题?

中文译文

担任专业全栈开发者。你的任务是开发一个与 Mikrotik Netwatch API 相连的网络映射与监控 Web 应用。

你的目标包括:

  • 构建基于角色的多用户系统,用于管理设备并监控其状态(UP/DOWN)。
  • 在交互式地图上映射设备,并管理用户用于设备订阅的余额。

分步说明:

  1. 项目结构搭建

    • 定义表:users、roles、devices、device_types、ports、connections、logs、routers 和 user_balances。
    • 提供带有外键关系的规范化 schema 设计。
  2. 身份验证与授权

    • 实现带登录和会话管理的多用户系统。
    • 角色:Admin 和 User。
    • Admin 可以管理用户、角色和路由器。
    • 用户只能根据其余额管理设备。
  3. 用户与余额管理

    • 用户的 CRUD 操作(仅限 Admin)。
    • 每个用户都有一个余额。
    • 订阅模式:每台设备每月 Rp.250。
    • 根据设备添加日期每月自动扣除余额。
    • 如果余额不足,阻止添加设备。
  4. 设备类型管理(CRUD)

    • 设备可以是“可管理”或“不可管理”。
    • 如果可管理,为每个端口分配 IP 地址。
  5. 设备管理(CRUD)

    • 添加设备时指定端口数量和名称。
    • 如果设备可管理,为每个端口分配 IP 地址。
    • 通过点击地图(坐标)添加设备 → 弹出表单出现。
  6. 连接管理

    • 通过选择源端口和目标端口连接设备。
    • 为连接分配 IP 地址。
    • 将连接移动到其他可用端口。
    • 移除连接。
  7. 与 Mikrotik Netwatch API 集成

    • 根据分配的 IP 监控设备。
    • 获取 UP/DOWN 状态。
    • 记录设备状态变化。
  8. 监控仪表板

    • 以多种视图样式在地图上显示设备。
    • 使用不同的图标颜色表示 UP/DOWN 状态。
    • 显示设备状态变化历史日志。
  9. 远程设备访问

    • 为每台设备添加“Remote”按钮。
    • 点击按钮会自动在 Mikrotik 中创建端口转发规则(指定 src-port,随机 dst-port)。
    • 添加/移除端口转发规则。
  10. 多路由器实现

  • 每个用户可以有多个 Mikrotik 路由器作为 Netwatch 服务器。
  • 按用户保存路由器分配。
  1. 交互式地图
  • 可视化所有设备和连接。
  • 支持多种地图显示样式。
  1. 日志记录与审计追踪
  • 保存每台设备的 UP/DOWN 历史。
  • 保存用户操作历史(添加/移除设备、连接、端口转发)。
  1. 安全与最佳实践
  • 验证所有 API 请求。
  • 保护应用免受 SQL Injection、XSS、CSRF 攻击。
  • 为 Mikrotik API 使用安全身份验证。

English original

Act as a professional full-stack developer. You are tasked with developing a web application for Mapping & Monitoring Networks connected to the Mikrotik Netwatch API.

Your objectives include:

  • Building a role-based multi-user system to manage devices and monitor their status (UP/DOWN).
  • Mapping devices on an interactive map and managing user balances for device subscriptions.

Step-by-step instructions:

  1. Project Structure Setup

    • Define tables: users, roles, devices, device_types, ports, connections, logs, routers, and user_balances.
    • Provide a normalized schema design with foreign key relationships.
  2. Authentication & Authorization

    • Implement a multi-user system with login & session management.
    • Roles: Admin and User.
    • Admin can manage users, roles, and routers.
    • Users can only manage devices according to their balance.
  3. User & Balance Management

    • CRUD operations for users (Admin only).
    • Each user has a balance.
    • Subscription model: Rp.250 per device/month.
    • Automatically deduct balance monthly based on device addition date.
    • Prevent device addition if balance is insufficient.
  4. Device Type Management (CRUD)

    • Devices can be "manageable" or "unmanageable".
    • If manageable, assign IP addresses per port.
  5. Device Management (CRUD)

    • Add devices with port count and name.
    • Assign IP addresses to each port if the device is manageable.
    • Add devices by clicking on a map (coordinates) → pop-up form appears.
  6. Connection Management

    • Connect devices by selecting source & destination ports.
    • Assign IP addresses to connections.
    • Move connections to other available ports.
    • Remove connections.
  7. Integration with Mikrotik Netwatch API

    • Monitor devices based on assigned IPs.
    • Retrieve UP/DOWN status.
    • Log device status changes.
  8. Monitoring Dashboard

    • Display devices on a map with various view styles.
    • Use different icon colors for UP/DOWN status.
    • Show device status change history logs.
  9. Remote Device Access

    • Add a "Remote" button for each device.
    • Clicking the button automatically creates a port forwarding rule in Mikrotik (src-port specified, dst-port random).
    • Add/remove port forwarding rules.
  10. Multi Router Implementation

  • Each user can have more than one Mikrotik router as a Netwatch server.
  • Save router assignments per user.
  1. Interactive Map
  • Visualize all devices and connections.
  • Support various map display styles.
  1. Logging & Audit Trail
  • Save UP/DOWN history for each device.
  • Save user action history (add/remove device, connection, port forwarding).
  1. Security & Best Practices
  • Validate all API requests.
  • Protect the application from SQL Injection, XSS, CSRF.
  • Use secure authentication for Mikrotik API.