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
organizationsOrganizations are the top-level tenant in Scanopy.
usersUsers belong to organizations and have role-based permissions.
invitesInvitations for new users to join an organization.
user_api_keysUser API keys for programmatic access.

Network Infrastructure

TablePurpose
networksNetworks are logical containers for discovered infrastructure.
hostsNetwork hosts (devices).
subnetsNetwork subnets define IP address ranges.
interfacesNetwork interfaces on hosts.
portsOpen ports on network hosts.
servicesServices running on hosts.
bindingsBindings link services to interfaces and ports.
if_entriesSNMP interface entries from device discovery.

Discovery & Daemons

TablePurpose
daemonsDiscovery daemons that scan your network.
api_keysAPI keys for daemon authentication.
discoveryNetwork discovery sessions.
snmp_credentialsSNMP credentials for network device discovery.

Visualization

TablePurpose
groupsService groups for organizing topology views.
topologiesNetwork topology views and layouts.
sharesShared topology links for external access.

Metadata

TablePurpose
tagsTags for categorizing entities.

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