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
organizationsTop-level tenant containing users, networks, and billing info
usersUser accounts with authentication (password or OIDC) and permissions
user_network_accessJunction table granting users access to specific networks
invitesPending invitations to join an organization

Network Infrastructure

TablePurpose
networksLogical network container for all discovered entities
hostsDiscovered devices (servers, containers, IoT devices)
subnetsNetwork segments (VLANs, Docker bridges, VPNs)
interfacesNetwork interfaces with IP and MAC addresses
portsOpen TCP/UDP ports on hosts
servicesIdentified services running on hosts
bindingsLinks services to interfaces and ports

Discovery & Daemons

TablePurpose
daemonsRegistered daemon instances with capabilities and status
discoveryDiscovery session records (scheduled and manual)
api_keysDaemon API keys for authentication

Visualization

TablePurpose
groupsLogical service groupings for topology diagrams
group_bindingsLinks bindings to groups with ordering
topologiesSaved topology configurations with layout data
sharesPublic/protected sharing of topology views

Metadata

TablePurpose
tagsOrganization-wide tags for categorization
entity_tagsPolymorphic junction table applying tags to any entity
user_api_keysUser API keys for programmatic access
user_api_key_network_accessNetwork access grants for user API keys

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