Sandbox Organizations & Repos
Relevant source files
The following files were used as context for generating this wiki page:
- app/sandboxes/orgs/page.tsx
- components/SandboxOrgs/SandboxOrgsPage.tsx
- components/SandboxOrgs/SandboxOrgsTableContainer.tsx
- components/SandboxOrgs/SandboxOrgsTable.tsx
- components/SandboxOrgs/sandboxOrgsColumns.tsx
- components/SandboxOrgs/AccountReposList.tsx
- hooks/useAdminSandboxOrgs.ts
- lib/recoup/fetchAdminSandboxOrgs.ts
- types/sandbox.ts
The Sandbox Organizations & Repos module is a specialized administrative interface designed to track and monitor Git commit activity within "org" sub-modules across all sandboxes in the Recoup platform. Its primary purpose is to provide a consolidated view of repository activity, ordered by engagement, to help administrators identify the most active organization-related codebases.
Sources: components/SandboxOrgs/SandboxOrgsPage.tsx:13-15, components/SandboxOrgs/SandboxOrgsTableContainer.tsx:28-30
System Architecture
The module follows a standard React/Next.js client-side data fetching pattern. It utilizes TanStack Query for state management and Privy for secure authentication. The data flow starts with a page-level component that renders a container, which handles the asynchronous state (loading, error, data) before passing the results to a specialized table component.
Data Flow Diagram
The following diagram illustrates the sequence of operations from the initial page load to the rendering of the organization repository table.
Core Components
SandboxOrgsTableContainer
This component acts as the orchestrator for data fetching. It invokes the useAdminSandboxOrgs hook and performs a critical filtering step: it only includes repositories whose names begin with the prefix org-. If no repositories match this criteria or if the API returns an empty set, it displays a placeholder message.
Sources: components/SandboxOrgs/SandboxOrgsTableContainer.tsx:28-32
SandboxOrgsTable
A data table implementation powered by @tanstack/react-table. It is configured with a default sorting state that prioritizes repositories with the highest total_commits.
| Feature | Implementation |
|---|---|
| Default Sort | total_commits (Descending) |
| Library | TanStack Table v8 |
| Styling | shadcn/ui Table components |
Sources: components/SandboxOrgs/SandboxOrgsTable.tsx:28-40
Data Models
The system relies on the OrgRepoRow structure to represent the statistics of an organization repository.
OrgRepoRow Entity Relationship
The following diagram shows the relationship between an organization repository and the specific account repositories linked to it.
Sources: types/sandbox.ts:20-30
Field Definitions
| Field | Type | Description |
|---|---|---|
repo_name | string | The unique identifier for the repository. |
total_commits | number | Aggregated count of commits across all instances. |
latest_commit_messages | string[] | A collection of the most recent commit strings. |
latest_committed_at | string | ISO timestamp of the most recent activity. |
account_repos | AccountRepo[] | List of specific accounts utilizing this repository. |
Sources: types/sandbox.ts:20-28
Implementation Details
API Integration
The system communicates with a specific administrative endpoint. Authentication is handled via a Bearer token passed in the request headers.
- Endpoint:
GET /api/admins/sandboxes/orgs - Authentication: Privy Access Token
- Error Handling: Throws an error containing the API message or the HTTP status code if the response is not successful.
Sources: lib/recoup/fetchAdminSandboxOrgs.ts:16-28
Column Definitions and Sorting
The table uses specialized cell renderers to handle complex data types:
- Repo Name: Rendered via
RepoNameCell. - Recent Commits: Uses
CommitMessagesListto display a collection of messages. - Account Repos: Uses a custom sorting function that compares the length of the
account_reposarray. - Latest Commit: Uses a
datetimesorting function and formats strings into local date/time formats.
Sources: components/SandboxOrgs/sandboxOrgsColumns.tsx:10-58
Summary
The Sandbox Organizations & Repos system provides high-level visibility into organization-specific repository activity. By filtering for org- prefixed repositories and providing deep-dive views into commit messages and associated account links, it serves as a critical monitoring tool for tracking engagement and development velocity across the Recoup sandbox environment.