Skip to content

Schema & Types

Defined in core/types.nu, the star schema is the unified format for all repository data regardless of source. Call star-schema to inspect it at runtime.

FieldTypeNullableDefaultDescription
idintNoUnique identifier (GitHub repo ID)
ownerstringNoRepository owner login
namestringNoRepository name
full_namestringNoFull name (owner/name)
descriptionstringYesRepository description
urlstringNoHTML URL to repository
homepagestringYesProject homepage URL
languagestringYesPrimary programming language
topicslist<string>No[]Repository topics/tags
starsintNo0Stargazer count
forksintNo0Fork count
issuesintNo0Open issue count
pusheddatetimeYesLast push timestamp
createddatetimeYesCreation timestamp
updateddatetimeYesLast update timestamp
archivedboolNofalseWhether repo is archived
forkboolNofalseWhether repo is a fork
licensestringYesLicense name (e.g., “MIT”)
readme_excerptstringYesExcerpt from README
sourcestringNo"github"Data source identifier
synced_atdatetimeNoWhen this record was last synced
starred_atdatetimeYesWhen the user starred this repo

Required fields: id, owner, name, full_name, url, source, synced_at

Schema differences: types.nu vs. GitHub adapter

Section titled “Schema differences: types.nu vs. GitHub adapter”

The canonical schema in core/types.nu uses friendly field names (stars, forks, pushed), while the GitHub adapter preserves GitHub’s API field names (stargazers_count, forks_count, pushed_at). The database stores the GitHub field names because that’s what into sqlite receives from the adapter.

types.nu (canonical)Database (from adapter)
starsstargazers_count
forksforks_count
issuesopen_issues_count
pushedpushed_at
createdcreated_at
updatedupdated_at
urlhtml_url

The sort-data function in mod.nu maps friendly names to actual column names:

Terminal window
let sort_field = match $sort_by {
"stars" => "stargazers_count"
"forks" => "forks_count"
"pushed" => "pushed_at"
...
}

Use validate-star to check a record against the schema:

Terminal window
let result = validate-star $record
# => {valid: true, errors: [], warnings: []}

The validator checks:

  • All required fields are present
  • id is an integer
  • owner, name, full_name, url are strings
  • source is one of: github, firefox, chrome, awesome, manual
  • Numeric fields (stars, forks, issues) are integers
  • Boolean fields (archived, fork) are booleans
  • topics is a list or JSON string
  • url starts with http

For Polars DataFrame/LazyFrame conversion, polars-schema defines the column-to-dtype mapping:

Terminal window
polars-schema
# => {id: "i64", owner: "str", name: "str", ..., starred_at: "datetime[us]"}
FunctionDescription
star-schemaReturns the full schema definition
polars-schemaReturns Polars dtype mappings
default-columnsDefault display columns
minimal-columnsCompact display columns
all-columnsAll available columns
excluded-languagesDefault language exclusion list
valid-sourcesValid source identifiers
parse-topicsParse topics from JSON string or list
get-owner-loginExtract owner login from various formats
validate-starValidate a record against the schema
normalize-github-starTransform GitHub API response to schema
empty-starCreate a record with all default values