···1919- `src/App.tsx`: provider wiring only. Keep this small. It should compose app-wide providers and render `AppRoutes`.
2020- `src/routes.tsx`: the declarative route table. Repo routes are nested under `/:owner/:repo` and use `RepoLayout`.
2121- `src/layout.tsx`: global shell and topbar. Preserve the `.untangled-shell` wrapper so app pages keep the intended width and padding. There is intentionally no footer.
2222-- `src/views/home.tsx`: home page and repository jump/recent/own-repo UI.
2323-- `src/views/oauth-callback.tsx`: OAuth callback completion page.
2424-- `src/views/not-found.tsx`: not-found page.
2222+- `src/pages/home.tsx`: home page and repository jump/recent/own-repo UI.
2323+- `src/pages/oauth-callback.tsx`: OAuth callback completion page.
2424+- `src/pages/not-found.tsx`: not-found page.
2525+- `src/pages/search.tsx`: global search page.
2526- `src/pages/repo.tsx`: barrel exports for repo routes only.
2627- `src/pages/repo/shared.tsx`: repo layout/context, shared repo frame/header/tabs, repo query keys, and `useRepoQuery`.
2728- `src/pages/repo/code.tsx`: repo overview/tree page and blob/file viewer.
···3334- `src/components/common.tsx`: generic UI primitives such as `Avatar`, `LoadingState`, `StateBadge`, and form/button/card style helpers.
3435- `src/components/repo.tsx`: repo presentation components such as tabs, file rows, README/comment cards, `CodeView`, `DiffView`, branch pills, and repo skeletons.
3536- `src/lib/api.ts`: compatibility facade that re-exports domain APIs. Do not add implementation here.
3636-- `src/lib/api/core.ts`: current low-level API implementation and shared private helpers.
3737- `src/lib/api/constants.ts`: public service URLs and OAuth scope exports.
3838+- `src/lib/api/appview.ts`: appview JSON transport, fallback, and appview response types.
3939+- `src/lib/api/backlinks.ts`: Constellation backlink traversal and backlink pagination helpers.
4040+- `src/lib/api/client.ts`: shared ATProto RPC client creation and service URL normalization.
4141+- `src/lib/api/hydration.ts`: record hydration from appview/PDS records into resolved authors.
3842- `src/lib/api/identity.ts`: auth RPC, identity resolver, actor resolution, avatar resolution.
3943- `src/lib/api/repos.ts`: repo records, repo metadata, tree/blob/branch/tag/log/language APIs, compare APIs, and related response types.
4044- `src/lib/api/issues.ts`: issue list/detail/create/comment/state APIs and issue types.
···6569import { createIssue } from '../../lib/api/issues';
6670```
67716868-The facade `src/lib/api.ts` remains for compatibility with existing imports, but new implementation should go into the relevant domain module or, if it truly must share private internals, into `src/lib/api/core.ts` and be re-exported through the domain module.
7272+The facade `src/lib/api.ts` remains for compatibility with existing imports, but new implementation should go into the relevant domain module. Shared internals should stay in a narrowly scoped helper such as `src/lib/api/appview.ts`, `src/lib/api/backlinks.ts`, `src/lib/api/client.ts`, `src/lib/api/hydration.ts`, `src/lib/api/records.ts`, or `src/lib/api/stateful.ts`.
69737074Guidelines:
7175···145149- Keep `src/App.tsx` small.
146150- Keep route declarations in `src/routes.tsx`.
147151- Keep global shell/topbar work in `src/layout.tsx`.
148148-- Keep top-level non-repo pages in `src/views`.
152152+- Keep top-level non-repo pages in `src/pages`.
149153- Keep repo-route behavior in `src/pages/repo/*.tsx`.
150154- Keep repo-route pure helpers in nearby `src/pages/repo/*-helpers.ts` files.
151155- Keep generic display components in `src/components/common.tsx`.
···165169- `src/pages/repo/code.tsx`: largest repo route; split further if code/blob logic grows.
166170- `src/pages/repo/pulls.tsx`: pull routes and patch/diff UI.
167171- `src/pages/repo/issues.tsx`: issue routes.
168168-- `src/lib/api/core.ts`: compatibility implementation backend; prefer new domain modules for new API surfaces.
172172+- `src/lib/api/*`: domain modules own their public implementations; shared plumbing is split across focused helper modules.
169173170174171175<!-- headroom:rtk-instructions -->
+1-1
src/components/common.tsx
···1313import { A } from '@solidjs/router';
1414import { Match, Show, Switch, createEffect, createMemo, createSignal, type Component } from 'solid-js';
1515import { createQuery } from '@tanstack/solid-query';
1616-import { resolveAvatarUrl } from '../lib/api';
1616+import { resolveAvatarUrl } from '../lib/api/identity';
17171818export const ToggleButton: Component<{
1919 active: boolean;
+1-1
src/components/repo.tsx
···2020import { marked } from 'marked';
2121import { A } from '@solidjs/router';
2222import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';
2323-import type { TreeEntry } from '../lib/api';
2323+import type { TreeEntry } from '../lib/api/repos';
2424import { formatRelativeTime } from '../lib/repo-utils';
2525import { Avatar, SkeletonBlock, cardStyles } from './common';
2626
+1-1
src/layout.tsx
···55import { For, Show, createEffect, createSignal, onCleanup, onMount, type Component, type JSX } from 'solid-js';
6677import { Avatar, buttonStyles, inputStyles } from './components/common';
88-import { clearApiCaches, resolveActor } from './lib/api';
88+import { clearApiCaches, resolveActor } from './lib/api/identity';
99import { useAuth } from './lib/auth';
1010import { useLiveEvents, type LiveEvent } from './lib/live-events';
1111import { formatRelativeTime } from './lib/repo-utils';
···33import { A, useNavigate, useParams } from '@solidjs/router';
44import { createQuery, keepPreviousData, useQueryClient } from '@tanstack/solid-query';
55import { For, Match, Show, Switch, createEffect, createMemo, createSignal, type Component } from 'solid-js';
66-import { buildBlobDataUrl, decodeBlobText, getRepoBlob, getRepoBranches, getRepoDefaultBranch, getRepoLanguages, getRepoLog, getRepoTags, getRepoTree } from '../../lib/api';
66+import { buildBlobDataUrl, decodeBlobText, getRepoBlob, getRepoBranches, getRepoDefaultBranch, getRepoLanguages, getRepoLog, getRepoTags, getRepoTree } from '../../lib/api/repos';
77import { Avatar, ErrorState, PlaceholderAvatar, buttonStyles, cardStyles } from '../../components/common';
88import { CodeView, FileRow, MarkdownBlock, OverviewFileRow, ReadmeCard, RepoTreeSkeleton } from '../../components/repo';
99import { RepoFrame, useRepoQuery } from './shared';
+1-1
src/pages/repo/issues-helpers.ts
···11-import type { IssueComment } from '../../lib/api';
11+import type { IssueComment } from '../../lib/api/issues';
22import type { SearchParamValue } from '../../lib/repo-utils';
3344export type IssueStateFilter = 'open' | 'closed';
+4-1
src/pages/repo/issues.tsx
···44import { createQuery, useQueryClient } from '@tanstack/solid-query';
55import type { ResourceUri } from '@atcute/lexicons/syntax';
66import { For, Match, Show, Switch, createEffect, createMemo, createSignal, type Component } from 'solid-js';
77-import { createIssue, createIssueComment, getIssue, listIssuesPage, parseAtUri, resolveActor, setIssueState, type RepoContext } from '../../lib/api';
77+import { createIssue, createIssueComment, getIssue, listIssuesPage, setIssueState } from '../../lib/api/issues';
88+import { resolveActor } from '../../lib/api/identity';
99+import { parseAtUri } from '../../lib/api/records';
1010+import type { RepoContext } from '../../lib/api/repos';
811import { useAuth } from '../../lib/auth';
912import { Avatar, ErrorState, PaginationControls, StateBadge, ToggleButton, buttonStyles, cardStyles, inputStyles, textareaStyles } from '../../components/common';
1013import { AtUriPanel, MarkdownBlock, RepoListSkeleton, RepoThreadSkeleton } from '../../components/repo';
+4-1
src/pages/repo/pulls.tsx
···1717import { A, useNavigate, useParams, useSearchParams } from '@solidjs/router';
1818import { createQuery, useQueryClient } from '@tanstack/solid-query';
1919import { For, Match, Show, Switch, createEffect, createMemo, createSignal, type Component, type JSX } from 'solid-js';
2020-import { compareBranches, createPull, createPullComment, fetchPullRoundPatch, getPull, getRepoBranches, listPullsPage, parseAtUri, resolveActor, setPullStatus, type RepoContext } from '../../lib/api';
2020+import { resolveActor } from '../../lib/api/identity';
2121+import { createPull, createPullComment, fetchPullRoundPatch, getPull, listPullsPage, setPullStatus } from '../../lib/api/pulls';
2222+import { parseAtUri } from '../../lib/api/records';
2323+import { compareBranches, getRepoBranches, type RepoContext } from '../../lib/api/repos';
2124import { useAuth } from '../../lib/auth';
2225import { Avatar, ErrorState, LoadingState, PaginationControls, StateBadge, ToggleButton, buttonStyles, cardStyles, textareaStyles } from '../../components/common';
2326import { AtUriPanel, BranchPill, CommentCard, DiffView, MarkdownBlock, PullDiffSkeleton, PullDiffView, RepoListSkeleton, RepoThreadSkeleton } from '../../components/repo';
+4-1
src/pages/repo/shared.tsx
···22import { A, type RouteSectionProps, useParams } from '@solidjs/router';
33import { createQuery } from '@tanstack/solid-query';
44import { For, Match, Show, Switch, createContext, createEffect, createMemo, createSignal, onCleanup, useContext, type Component, type JSX } from 'solid-js';
55-import { createRepoStar, deleteRepoStar, getRepo, getRepoIssueCount, getRepoPullCount, getRepoStarSummary } from '../../lib/api';
55+import { getRepoIssueCount } from '../../lib/api/issues';
66+import { getRepoPullCount } from '../../lib/api/pulls';
77+import { getRepo } from '../../lib/api/repos';
88+import { createRepoStar, deleteRepoStar, getRepoStarSummary } from '../../lib/api/stars';
69import { useAuth } from '../../lib/auth';
710import { useLiveEvents } from '../../lib/live-events';
811import { Avatar, ErrorState, cardStyles } from '../../components/common';
+4-4
src/routes.tsx
···1313 RepoCodePage,
1414} from './pages/repo';
1515import { RepoLayout } from './pages/repo/shared';
1616-import { HomePage } from './views/home';
1717-import { NotFoundPage } from './views/not-found';
1818-import { OAuthCallbackPage } from './views/oauth-callback';
1919-import { SearchPage } from './views/search';
1616+import { HomePage } from './pages/home';
1717+import { NotFoundPage } from './pages/not-found';
1818+import { OAuthCallbackPage } from './pages/oauth-callback';
1919+import { SearchPage } from './pages/search';
20202121export const AppRoutes: Component = () => (
2222 <Router root={RootShell}>
+2-1
src/views/home.tsx
src/pages/home.tsx
···44import { For, Show, createMemo, createSignal, type Component } from 'solid-js';
5566import { LoadingState, buttonStyles, cardStyles, inputStyles } from '../components/common';
77-import { listRepoRecords, resolveActor } from '../lib/api';
77+import { resolveActor } from '../lib/api/identity';
88+import { listRepoRecords } from '../lib/api/repos';
89import { useAuth } from '../lib/auth';
910import { formatRelativeTime, loadRecentRepos, parseRepoJump } from '../lib/repo-utils';
1011