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
| Table | Purpose |
|---|---|
organizations | Manage organization settings. |
users | User account management. |
invites | Organization invitations. |
user_api_keys | User API keys for programmatic access. |
Network Infrastructure
| Table | Purpose |
|---|---|
networks | Network containers. |
hosts | Network hosts (devices). |
subnets | IP subnets within networks. |
ip_addresses | IP addresses assigned to hosts. |
ports | Ports that have been scanned and found open on a host. |
services | Services running on hosts. |
bindings | Service bindings linking services to IP addresses and/or ports. |
interfaces | SNMP ifTable entries. |
Discovery & Daemons
| Table | Purpose |
|---|---|
daemons | Daemons are scanning agents that connect to the server to perform network discovery. |
api_keys | API keys for daemon authentication. |
discovery | Network discovery operations. |
Visualization
| Table | Purpose |
|---|---|
dependencies | Service dependency relationships. |
topologies | Network topology maps showing host relationships and connections. |
shares | Shared network views. |
Metadata
| Table | Purpose |
|---|---|
tags | Custom tags for categorization. |
Key Relationships
Host → Services → Bindings
The discovery pipeline creates this hierarchy:
- Host — A discovered device
- Interface — Network interface on the host (IP + MAC)
- Port — Open port on the host
- Service — Identified service (e.g., PostgreSQL, Nginx)
- 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_idforeign 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.