FS Garage Score Card (BE) Overview
PocketBase schema and migrations for the project-level Score Card feature, built by Thanush Babu. This is a different module from FS Garage Utilisation (BE), which lives in the same repo but was built by a different contributor.
What is this?
The backend data model for FS Garage's per-project Score Card: metric categories, individual metrics, and time-series metric entries, plus the PocketBase access rules and schema docs that go with them.
| Field | Value |
|---|---|
| Category | Core / Project Tracking |
| GitHub | fs-garage-base |
| Org | TeamFleetStudio |
| Built by | Thanush Babu (this module only - repo also contains the Utilisation module) |
Runtime setup, env vars, and deploy steps live in the repository. Use this Fleet Docs page for knowledge-transfer context.
Key Features
metric_categoriescollection (pbc_366275764):project(relation),name,description,display_type(kpi_card/funnel/bar_list, set on top-level categories),color,restricted(bool),sort_order, and a self-referencingparentrelation for one level of subcategory nesting (added in a follow-up migration after the initial create, to avoid a circular self-reference at creation time).metricscollection (pbc_3017397517):category(relation),label,description,unit(count/percent/currency),aggregation(sum/latest/average),frequency(daily/weekly/monthly/quarterly/annually- exposed to the frontend asdefault_granularity), one target field per cadence (target_daily,target_weekly,target_monthly,target_quarterly,target_annually) plus a one-offtarget_customwithtarget_custom_start/target_custom_enddates,is_headline_kpi,is_active(archive flag),restricted,sort_order, and amomentumJSON cache field.metric_entriescollection (pbc_724030684):metric(relation),period_start/period_end(dates),value(number),note,entered_by(relation to users). A later migration adds a DB-levelperiod_start <= period_endconstraint on top of the app-level integrity check.- Scorecard write rules:
metric_categories/metrics/metric_entriesall started with a wide-opencreateRule/deleteRule(any authenticated user); a follow-up migration tightened create/delete to the project'sowner, or a globalceo/c-suite/project-leadrole - matching thelistRule/viewRule/updateRulepattern already used elsewhere. - Business-unit project type:
projects.typealready supportedclient/product; a migration added a third value,business-unit, for the Score listing's project-type filter/badge. - Schema documentation:
docs/scorecard-schema.md,docs/scorecard-flow-feasibility.md,docs/scorecard-dev-sync.md,docs/scorecard-fsa-academy-seed-data.md- originally written to reconcile the frontend's expected schema against what existed in migrations at the time; the collections above have since been fully captured as migrations, closing that gap.
For the exact formulas the frontend runs against this data (roll-up, delta, target auto-suggestion, etc.), see FS Garage Score Card - Metrics and Calculations.
Tech Snapshot
| Layer | Choice |
|---|---|
| Runtime | PocketBase binary |
| DB | SQLite (pb_data/) |
| Schema | pb_migrations/*.js (source of truth) |
| Scope | Scorecard-only collections (metrics, metric_categories, metric_entries) + projects field additions |
| Default branch | development |
Related Repo
Frontend: base-fs-garage-fe - see FS Garage Score Card (FE).
Same-repo, different module: FS Garage Utilisation (BE).
Quick Start
git clone https://github.com/TeamFleetStudio/fs-garage-base.git
cd fs-garage-base
Then follow Getting Started.
Next Steps
- Getting Started - Install and run locally
- Architecture - System shape and data flow
- API Reference - Collections and access rules