The FTM Master Database is an enterprise-grade, highly normalized, production-ready football relational database architecture. Built specifically for the Football Transfer Market (FTM) platform, it serves as the centralized backend data foundation designed to handle millions of players, clubs, competitions, matches, historical transfers, intelligence rumours, statistics, and market valuations..
IMPORTANT ARCHITECTURAL NOTICE
This project is a NEW, SEPARATE DATABASE PROJECT. It functions as the standalone backend database foundation. It does NOT modify or run frontend website code, but is designed to cleanly connect to the FTM website via an API layer.
REAL FOOTBALL DATA SOURCES
↓
DATA INGESTION (/scripts/import)
↓
NORMALIZATION (/scripts/normalization)
↓
VALIDATION ENGINE (/scripts/validation)
↓
FTM MASTER DATABASE (PostgreSQL / Supabase Schema & Views)
↓
FTM API LAYER (RESTful / GraphQL)
↓
FTM WEBSITE (Frontend Application)
The database schema implements 25 complete relational entities:
- PLAYERS: Profile, positions, physical attributes, current club, national team, verified status.
- PLAYER STATISTICS: Granular season/competition stats for outfield players & goalkeepers (supports NULL for unprovided fields).
- PLAYER HISTORY: Historical career club tenures and transfer reasons.
- CLUBS: Official name, short name, country, league, stadium, capacity, manager, status.
- CLUB SQUADS: Seasonal club squad roster listings.
- CLUB STATISTICS: League standings, points, goals for/against, clean sheets per season.
- LEAGUES: Domestic and international league pyramids.
- COMPETITIONS: League, cup, super cup, and continental tournaments.
- SEASONS: Competition annual seasons with start/end bounds.
- MATCHES: Fixtures, results, venues, referees, attendances.
- MATCH EVENTS: Real-time event log (goals, assists, cards, substitutions, penalties, VAR).
- TRANSFERS: Complete historical transfer ledger (permanent, loan, free, return).
- TRANSFER WINDOWS: Country-specific transfer window opening/closing bounds.
- TRANSFER FEES: Granular breakdown (base fee, guaranteed fee, performance add-ons, sell-on %).
- RUMOURS: Transfer intelligence reports (headline, summary, status timeline, reported fee).
- RUMOUR UPDATES: Sequential progression history for active transfer rumours.
- SOURCES: Data quality & source provenance tracking (
source_url,publication_date,verified_at). - MARKET VALUES: Current player market valuation snapshot.
- MARKET VALUE HISTORY: Time-series historical market values for charting.
- CONTRACTS: Active & historical contracts (salary, currency, period, release clauses).
- NATIONAL TEAMS: Senior and youth international squads.
- PLAYER NATIONAL TEAM HISTORY: Caps, goals, call-up dates, debuts.
- INJURIES: Medical history, injury types, severity, return dates.
- PLAYER AWARDS: Individual player honors (e.g. Ballon d'Or, Golden Boot).
- CLUB TROPHIES: Club silverware and trophies won.
ftm-master-database/
├── database/
│ ├── schema/
│ │ ├── 01_types_and_enums.sql # Custom ENUMs & custom types
│ │ ├── 02_core_tables.sql # Countries, Clubs, Players, Squads, Sources
│ │ ├── 03_statistics_tables.sql # Player & Club stats, Injuries, Awards, Trophies
│ │ ├── 04_transfer_rumour_tables.sql # Transfers, Windows, Fees, Rumours, Timeline
│ │ ├── 05_market_contract_tables.sql # Market Values, History, Contracts
│ │ ├── 06_match_tables.sql # Matches & Match Events
│ │ ├── 07_indexes.sql # B-Tree & Trigram search performance indexes
│ │ ├── 08_triggers.sql # Automated updated_at & market value triggers
│ │ └── schema.sql # Unified production DDL script
│ ├── migrations/
│ │ └── 001_initial_schema.sql # Initial database migration
│ ├── seeds/
│ │ ├── sample_seed_data.sql # SQL seed data [SAMPLE DATA ONLY]
│ │ └── sample_data.json # JSON seed payload [SAMPLE DATA ONLY]
│ └── views/
│ └── 01_api_views.sql # Production SQL views optimized for REST API
├── data/ # Ingestion landing directories
│ ├── players/
│ ├── clubs/
│ ├── leagues/
│ ├── competitions/
│ ├── seasons/
│ ├── matches/
│ ├── transfers/
│ ├── rumours/
│ ├── market/
│ ├── contracts/
│ └── sources/
├── scripts/
│ ├── import/
│ │ └── ingest_provider_data.js # Provider API ingestion module
│ ├── export/
│ │ └── export_data.js # JSON export utility
│ ├── validation/
│ │ ├── validate_database.js # 10-Point automated validation suite
│ │ └── schema_rules.js # Data formatting & compliance rules
│ └── normalization/
│ └── normalize_football_data.js # Data transformer & normalizer pipeline
├── docs/
│ ├── architecture.md # Data flow & architecture specification
│ ├── relationships.md # Complete Entity-Relationship matrix
│ ├── data-dictionary.md # Full data dictionary for all 25 tables
│ ├── api.md # REST API specification & response schemas
│ └── contributing.md # Sourcing integrity & contribution rules
├── package.json
└── README.md
- PostgreSQL 14+ (or Supabase instance)
- Node.js 18+
Execute the production DDL script in your PostgreSQL or Supabase SQL Editor:
psql -h localhost -U postgres -d ftm_master -f database/schema/schema.sql
psql -h localhost -U postgres -d ftm_master -f database/views/01_api_views.sqlCreate a .env file in the root directory:
# Database Credentials
DB_HOST=localhost
DB_PORT=5432
DB_NAME=ftm_master
DB_USER=postgres
DB_PASSWORD=your_secure_password
# Data Provider API Keys (When Sourced)
FOOTBALL_PROVIDER_API_KEY=your_licensed_api_key
FOOTBALL_PROVIDER_BASE_URL=https://api.sportradar.com/v1
# API & Security
FTM_API_SECRET=your_jwt_secret_key
NODE_ENV=productionRun the automated 10-point integrity validation suite:
npm run validate- Duplicate IDs: Scans for internal UUID and provider external ID collisions.
- Missing Required Fields: Enforces mandatory fields (names, DOBs, positions).
- Invalid Dates: Validates strict ISO-8601 formatting (
YYYY-MM-DD). - Invalid Currency Codes: Enforces ISO 4217 currency compliance (
EUR,GBP,USD). - Broken Relationships: Audits foreign key integrity across tables.
- Duplicate Transfers: Detects identical player transfer signatures.
- Invalid Player/Club References: Verifies existence of referenced entities.
- Malformed URLs: Validates source URL syntax.
- Impossible Negative Statistics: Guarantees non-negative bounds for appearances, goals, saves, etc.
- Invalid Season Formats: Enforces standard
YYYY/YYYYorYYYYformats.
- Place raw feed files from licensed data providers (e.g. Opta, Wyscout, Sportradar, Transfermarkt) into
/data/{entity}/. - Run normalization and ingestion:
npm run ingest
npm run normalize
npm run validateThe future FTM website connects to this database via API endpoints backed by SQL views:
| API Endpoint | Underlying Database View | Description |
|---|---|---|
GET /api/v1/players |
v_players_api |
List & search players |
GET /api/v1/players/{id} |
v_players_api |
Detailed player profile |
GET /api/v1/players/{id}/stats |
v_player_stats_api |
Player career statistics |
GET /api/v1/players/{id}/transfers |
v_transfers_api |
Player transfer history |
GET /api/v1/players/{id}/rumours |
v_rumours_api |
Player transfer rumours |
GET /api/v1/clubs |
v_clubs_api |
Club directory |
GET /api/v1/clubs/{id} |
v_clubs_api |
Club profile |
GET /api/v1/transfers |
v_transfers_api |
Global transfers feed |
GET /api/v1/rumours |
v_rumours_api |
Global rumour intelligence feed |
- Data Rules: Never fabricate real-world football data, transfer fees, or rumour reports. Store unconfirmed values as
NULL. - Licensing: For production deployment with live football stats and transfers, ensure integration with a licensed provider API (Opta, Wyscout, Sportradar, API-Football).