Overview
Who To Bother uses Valibot for runtime schema validation and type inference. All company data files must conform to the schema defined insrc/data/companies/schema.ts.
The schema ensures data integrity with strict validation rules for company information, contact details, and social media handles.
Schema Architecture
Single Source of Truth
Company Schema
The top-level schema representing a complete company entry.JSON Schema reference for IDE autocomplete support
Unique company identifier. Must be lowercase with only letters, numbers, and hyphens.Validation: Regex
/^[a-z0-9-]+$/Error: “Company ID must be lowercase with only letters, numbers, and hyphens”Display name of the company.Validation: Minimum 1 characterError: “Company name is required”
Brief description of the company and its products/services.Validation: Minimum 1 characterError: “Company description is required”
Type of logo used for display. References logo files in the project.Validation: Minimum 1 characterError: “Logo type is required”
Optional logo URL or path reference
Company website URL.Validation: Must be a valid URLError: “Must be a valid URL”
Documentation website URL.Validation: Must be a valid URLError: “Must be a valid URL”
GitHub organization or repository URL.Validation: Must be a valid URLError: “Must be a valid URL”
Discord community invite URL.Validation: Must be a valid URLError: “Must be a valid URL”
Array of contact categories. Must contain at least one category.Validation: Minimum 1 categoryError: “At least one category is required”
Category Schema
Represents a category of contacts grouped by product, team, or functional area.Category name (e.g., “Frameworks & OSS”, “AI”, “Support”).Validation: Minimum 1 characterError: “Category name is required”
Array of contacts within this category. Must contain at least one contact.Validation: Minimum 1 contactError: “At least one contact is required per category”
Contact Schema
Represents an individual contact or role with associated social handles.Product name, role, or area of responsibility (e.g., “Next.js”, “Community Manager”).Validation: Minimum 1 characterError: “Product name is required”
Array of X (Twitter) handles. Must start with
@ and contain only letters, numbers, and underscores.Validation:- Regex
/^@[a-zA-Z0-9_]+$/per handle - Minimum 1 handle required
- “Handle must start with @ and contain only letters, numbers, and underscores”
- “At least one handle is required”
Optional contact email address.Validation: Must be a valid email formatError: “Must be a valid email address”
Optional Discord profile or server URL.Validation: Must be a valid URLError: “Must be a valid URL”
TypeScript Types
The schema automatically generates TypeScript types using Valibot’sInferOutput utility:
Type Definitions
Valibot Schema Source
Example: Valid Company JSON
Validation
Build-Time Validation
All company JSON files are validated before deployment:src/scripts/validate-companies.ts) checks all JSON files in src/data/companies/ against the Valibot schema.
Common Validation Errors
Message: “Handle must start with @ and contain only letters, numbers, and underscores”Fix: Ensure all X handles start with
@ and only contain alphanumeric characters and underscores.Message: “Must be a valid URL”Fix: Ensure URLs include the protocol (https://) and are properly formatted.
Message: “At least one handle is required” or “At least one contact is required per category”Fix: Ensure arrays are not empty.
JSON Schema Generation
Generate a JSON schema file for IDE autocomplete support:src/data/companies/schema.json from the Valibot schema, enabling IntelliSense in editors when editing company JSON files.
Related
- Adding Companies - Learn how to add new companies
- Tech Stack - Overview of technologies used
- Project Structure - Codebase organization