ScanopyScanopy

Database Schema

Entity relationship diagram and table reference for Scanopy's PostgreSQL database.

Scanopy uses PostgreSQL to store all network discovery data. This page provides an overview of the database schema and entity relationships.

Entity Relationship Diagram

Core Tables

Organizations & Users

TablePurpose
organizationsManage organization settings.
usersUser account management.
invitesOrganization invitations.
user_api_keysUser API keys for programmatic access.

Network Infrastructure

TablePurpose
networksNetwork containers.
hostsNetwork hosts (devices).
subnetsIP subnets within networks.
ip_addressesIP addresses assigned to hosts.
portsPorts that have been scanned and found open on a host.
servicesServices running on hosts.
bindingsService bindings linking services to IP addresses and/or ports.
interfacesSNMP ifTable entries.

Discovery & Daemons

TablePurpose
daemonsDaemons are scanning agents that connect to the server to perform network discovery.
api_keysAPI keys for daemon authentication.
discoveryNetwork discovery operations.

Visualization

TablePurpose
dependenciesService dependency relationships.
topologiesNetwork topology maps showing host relationships and connections.
sharesShared network views.

Metadata

TablePurpose
tagsCustom tags for categorization.

Key Relationships

Host → Services → Bindings

The discovery pipeline creates this hierarchy:

  1. Host — A discovered device
  2. Interface — Network interface on the host (IP + MAC)
  3. Port — Open port on the host
  4. Service — Identified service (e.g., PostgreSQL, Nginx)
  5. Binding — Links a service to an interface and/or port

This structure allows a single service to be accessible on multiple interfaces (e.g., a database listening on both LAN and Docker bridge networks).

Network Isolation

All discovery data is scoped to a network:

  • Hosts, subnets, services, interfaces, ports, and bindings all have a network_id foreign key
  • Networks belong to organizations
  • Users are granted access to specific networks via user_network_access

Cascade Deletes

Most foreign keys use ON DELETE CASCADE:

  • Deleting an organization removes all its networks, users, and tags
  • Deleting a network removes all hosts, services, subnets, and discovery data
  • Deleting a host removes all its interfaces, ports, and services

Full Schema Reference

For the complete schema with all columns and types, see the detailed ER diagram below. Use the zoom controls or fullscreen mode to explore.

On this page