feat(web): add Render cloud setup page

This commit is contained in:
Shivam Sharma committed 2026-08-05 08:34:56 +05:30
1 parent 69fb1fc503
commit 0ccd1c0ce8
8 files changed
+301 -41

No files matched your search

+5 -1
View File
@@ -1294,6 +1294,10 @@ function OpenCommandPaletteDialog(props: {
),
keepOpen: true,
run: async () => {
if (option.cloudProvider) {
startAddProjectClone(option.environmentId, "url");
return;
}
await startAddProjectSourceSelection(option.environmentId);
},
});
@@ -1324,7 +1328,7 @@ function OpenCommandPaletteDialog(props: {
]
: []),
];
}, [addProjectEnvironmentOptions, startAddProjectSourceSelection]);
}, [addProjectEnvironmentOptions, startAddProjectClone, startAddProjectSourceSelection]);
const hasCloudAddProjectEnvironment = addProjectEnvironmentOptions.some(
(option) => option.cloudProvider !== null,
);
@@ -0,0 +1,255 @@
import { CheckIcon, CloudIcon, CopyIcon, ExternalLinkIcon, LoaderCircleIcon } from "lucide-react";
import { connectionStatusText } from "@t3tools/client-runtime/connection";
import {
isAtomCommandInterrupted,
squashAtomCommandFailure,
} from "@t3tools/client-runtime/state/runtime";
import type { EnvironmentId } from "@t3tools/contracts";
import { useCallback, useMemo, useState } from "react";
import { cloudEnvironmentProvider } from "~/cloud/cloudEnvironment";
import { openCommandPalette } from "~/commandPaletteBus";
import { environmentCatalog } from "~/connection/catalog";
import { connectPairing as connectPairingAtom } from "~/connection/onboarding";
import { readHostedPairingRequest } from "~/hostedPairing";
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
import { getPairingTokenFromUrl } from "~/pairingUrl";
import { useAtomCommand } from "~/state/use-atom-command";
import { type EnvironmentPresentation, useEnvironments } from "~/state/environments";
import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { stackedThreadToast, toastManager } from "../ui/toast";
import { SettingsPageContainer, SettingsRow, SettingsSection } from "./settingsLayout";
import { searchableSetting } from "./settingsSearch";
const RENDER_DEPLOY_URL =
"https://dashboard.render.com/blueprint/new?repo=https%3A%2F%2Fgithub.com%2Fpingdotgg%2Ft3code&branch=feat%2Frender-cloud-environment";
const CODEX_LOGIN_COMMAND = "codex login --device-auth";
const GITHUB_LOGIN_COMMAND = "gh auth login --web --git-protocol https";
const SHARE_ACCESS_COMMAND =
'node /app/apps/server/dist/bin.mjs auth pairing create --base-dir /data/t3 --label "Shared Render access" --ttl 24h --json | T3CODE_PUBLIC_URL="$RENDER_EXTERNAL_URL" node /app/infra/render/pair-url.mjs';
function pairingInput(value: string): { readonly host: string; readonly pairingCode: string } {
const url = new URL(value.trim());
const hostedRequest = readHostedPairingRequest(url);
if (hostedRequest) {
return { host: hostedRequest.host, pairingCode: hostedRequest.token };
}
const pairingCode = getPairingTokenFromUrl(url);
if (!pairingCode) {
throw new Error("Paste the full Pair URL from the Render logs.");
}
return { host: url.origin, pairingCode };
}
function CopyCommand({ command }: { readonly command: string }) {
const { copyToClipboard, isCopied } = useCopyToClipboard({ target: "command" });
return (
<div className="mt-2 flex min-w-0 items-start gap-2 rounded-lg border border-border/70 bg-muted/20 p-2">
<code className="min-w-0 flex-1 overflow-x-auto py-1 text-xs text-foreground">{command}</code>
<Button
size="icon-xs"
variant="ghost"
aria-label="Copy command"
onClick={() => copyToClipboard(command, undefined)}
>
{isCopied ? <CheckIcon className="size-3.5" /> : <CopyIcon className="size-3.5" />}
</Button>
</div>
);
}
function RenderEnvironmentRow({
environment,
busyEnvironmentId,
onConnect,
onDisconnect,
}: {
readonly environment: EnvironmentPresentation;
readonly busyEnvironmentId: EnvironmentId | null;
readonly onConnect: (environmentId: EnvironmentId) => void;
readonly onDisconnect: (environmentId: EnvironmentId) => void;
}) {
const isConnected = environment.connection.phase === "connected";
const isBusy = busyEnvironmentId === environment.environmentId;
return (
<SettingsRow
title={environment.label}
description="Powered by Render"
status={connectionStatusText(environment.connection)}
control={
<>
{isConnected ? (
<Button
size="xs"
variant="outline"
onClick={() => openCommandPalette({ open: "add-project" })}
>
Add project
</Button>
) : null}
<Button
size="xs"
variant="outline"
disabled={isBusy}
onClick={() =>
isConnected
? onDisconnect(environment.environmentId)
: onConnect(environment.environmentId)
}
>
{isBusy ? <LoaderCircleIcon className="size-3 animate-spin" /> : null}
{isConnected ? "Disconnect" : "Connect"}
</Button>
</>
}
/>
);
}
export function CloudEnvironmentsSettings() {
const { environments } = useEnvironments();
const connectPairing = useAtomCommand(connectPairingAtom, { reportFailure: false });
const retryEnvironment = useAtomCommand(environmentCatalog.retryNow, { reportFailure: false });
const removeEnvironment = useAtomCommand(environmentCatalog.remove, { reportFailure: false });
const [pairUrl, setPairUrl] = useState("");
const [pairing, setPairing] = useState(false);
const [pairError, setPairError] = useState<string | null>(null);
const [busyEnvironmentId, setBusyEnvironmentId] = useState<EnvironmentId | null>(null);
const renderEnvironments = useMemo(
() => environments.filter((environment) => cloudEnvironmentProvider(environment) === "render"),
[environments],
);
const reportFailure = useCallback((title: string, description: string) => {
toastManager.add(stackedThreadToast({ type: "error", title, description }));
}, []);
const handlePair = useCallback(async () => {
setPairError(null);
let input: ReturnType<typeof pairingInput>;
try {
input = pairingInput(pairUrl);
} catch (error) {
setPairError(error instanceof Error ? error.message : "Invalid Pair URL.");
return;
}
setPairing(true);
const result = await connectPairing(input);
setPairing(false);
if (result._tag === "Failure") {
if (!isAtomCommandInterrupted(result)) {
const failure = squashAtomCommandFailure(result);
setPairError(failure instanceof Error ? failure.message : "Could not pair environment.");
}
return;
}
setPairUrl("");
toastManager.add({ type: "success", title: "Render environment connected" });
}, [connectPairing, pairUrl]);
const handleConnect = useCallback(
async (environmentId: EnvironmentId) => {
setBusyEnvironmentId(environmentId);
const result = await retryEnvironment(environmentId);
setBusyEnvironmentId(null);
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
const failure = squashAtomCommandFailure(result);
reportFailure(
"Could not connect Render environment",
failure instanceof Error ? failure.message : "Could not connect Render environment.",
);
}
},
[reportFailure, retryEnvironment],
);
const handleDisconnect = useCallback(
async (environmentId: EnvironmentId) => {
setBusyEnvironmentId(environmentId);
const result = await removeEnvironment(environmentId);
setBusyEnvironmentId(null);
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
const failure = squashAtomCommandFailure(result);
reportFailure(
"Could not disconnect Render environment",
failure instanceof Error ? failure.message : "Could not disconnect Render environment.",
);
}
},
[removeEnvironment, reportFailure],
);
return (
<SettingsPageContainer>
<SettingsSection
{...searchableSetting("cloud-environments")}
icon={<CloudIcon className="size-4" />}
>
<SettingsRow
title="Powered by Render"
description="Persistent cloud agents and repositories."
control={
<Button
size="sm"
render={<a href={RENDER_DEPLOY_URL} target="_blank" rel="noreferrer" />}
>
Deploy on Render
<ExternalLinkIcon className="size-3.5" />
</Button>
}
/>
</SettingsSection>
<SettingsSection title="Connect">
<SettingsRow title="Pair URL" description="Paste the Pair URL printed in the Render logs.">
<div className="mt-3 flex flex-col gap-2 sm:flex-row">
<Input
value={pairUrl}
onChange={(event) => setPairUrl(event.target.value)}
placeholder="https://app.t3.codes/pair?host=..."
onKeyDown={(event) => {
if (event.key === "Enter") void handlePair();
}}
/>
<Button
disabled={pairing || pairUrl.trim().length === 0}
onClick={() => void handlePair()}
>
{pairing ? <LoaderCircleIcon className="size-4 animate-spin" /> : null}
Pair environment
</Button>
</div>
{pairError ? <p className="mt-2 text-xs text-destructive">{pairError}</p> : null}
</SettingsRow>
{renderEnvironments.map((environment) => (
<RenderEnvironmentRow
key={environment.environmentId}
environment={environment}
busyEnvironmentId={busyEnvironmentId}
onConnect={(environmentId) => void handleConnect(environmentId)}
onDisconnect={(environmentId) => void handleDisconnect(environmentId)}
/>
))}
</SettingsSection>
<SettingsSection title="Ready to use">
<SettingsRow title="Authenticate Codex" description="Run once in the Render Shell.">
<CopyCommand command={CODEX_LOGIN_COMMAND} />
</SettingsRow>
<SettingsRow
title="Private GitHub repositories"
description="Run in the Render Shell, or set GH_TOKEN in Render. Public URLs need nothing."
>
<CopyCommand command={GITHUB_LOGIN_COMMAND} />
</SettingsRow>
<SettingsRow
title="Give someone access"
description="Run in the Render Shell and send the new one-time Pair URL to that person."
>
<CopyCommand command={SHARE_ACCESS_COMMAND} />
</SettingsRow>
</SettingsSection>
</SettingsPageContainer>
);
}
@@ -1,6 +1,5 @@
import {
ChevronsLeftRightEllipsisIcon,
CloudIcon,
PlusIcon,
QrCodeIcon,
RefreshCwIcon,
@@ -1746,11 +1745,6 @@ export function ConnectionsSettings() {
.toSorted((left, right) => left.label.localeCompare(right.label)),
[environments],
);
const renderCloudEnvironments = useMemo(
() =>
savedEnvironments.filter((environment) => cloudEnvironmentProvider(environment) === "render"),
[savedEnvironments],
);
const savedNonCloudEnvironments = useMemo(
() => savedEnvironments.filter((environment) => cloudEnvironmentProvider(environment) === null),
[savedEnvironments],
@@ -3357,33 +3351,6 @@ export function ConnectionsSettings() {
</SettingsSection>
)}
<SettingsSection
{...searchableSetting("cloud-environments")}
icon={<CloudIcon className="size-4" />}
>
<SettingsRow
title="Powered by Render"
description="Run the normal T3 Code server as a persistent Render service. Pair it once, then clone repositories and run agents in its cloud workspace just like another device."
status="Cloud repositories are stored on the Render disk under /data/workspace."
/>
{renderCloudEnvironments.length === 0 ? (
<SettingsRow
title="No Render environment paired"
description="Deploy the Render Blueprint, copy the Pair URL from its service logs, and open it on this device. The environment will appear here automatically."
/>
) : (
renderCloudEnvironments.map((environment) => (
<SavedBackendListRow
key={environment.environmentId}
environment={environment}
removingEnvironmentId={removingSavedEnvironmentId}
onConnect={handleConnectSavedBackend}
onRemove={handleRemoveSavedBackend}
/>
))
)}
</SettingsSection>
<SettingsSection
{...searchableSetting("remote-environments")}
headerAction={
@@ -11,6 +11,7 @@ import {
ArchiveIcon,
ArrowLeftIcon,
BotIcon,
CloudIcon,
FlaskConicalIcon,
GitBranchIcon,
KeyboardIcon,
@@ -52,6 +53,7 @@ const SETTINGS_SECTION_ICONS: Readonly<
"/settings/providers": BotIcon,
"/settings/source-control": GitBranchIcon,
"/settings/connections": Link2Icon,
"/settings/cloud-environments": CloudIcon,
"/settings/beta": FlaskConicalIcon,
"/settings/archived": ArchiveIcon,
};
@@ -5,6 +5,7 @@ export type SettingsPath =
| "/settings/providers"
| "/settings/source-control"
| "/settings/connections"
| "/settings/cloud-environments"
| "/settings/beta"
| "/settings/archived";
@@ -26,6 +27,7 @@ export const SETTINGS_SECTION_LABELS: Readonly<Record<SettingsPath, string>> = {
"/settings/providers": "Providers",
"/settings/source-control": "Source Control",
"/settings/connections": "Connections",
"/settings/cloud-environments": "Cloud environments",
"/settings/beta": "Beta",
"/settings/archived": "Archive",
};
@@ -169,7 +171,7 @@ export const SETTINGS_SEARCH_ITEMS = [
{
id: "cloud-environments",
title: "Cloud environments",
to: "/settings/connections",
to: "/settings/cloud-environments",
},
{
id: "remote-environments",
+22
View File
@@ -20,6 +20,7 @@ import { Route as SettingsKeybindingsRouteImport } from './routes/settings.keybi
import { Route as SettingsGeneralRouteImport } from './routes/settings.general'
import { Route as SettingsDiagnosticsRouteImport } from './routes/settings.diagnostics'
import { Route as SettingsConnectionsRouteImport } from './routes/settings.connections'
import { Route as SettingsCloudEnvironmentsRouteImport } from './routes/settings.cloud-environments'
import { Route as SettingsBetaRouteImport } from './routes/settings.beta'
import { Route as SettingsArchivedRouteImport } from './routes/settings.archived'
import { Route as SettingsAppearanceRouteImport } from './routes/settings.appearance'
@@ -81,6 +82,12 @@ const SettingsConnectionsRoute = SettingsConnectionsRouteImport.update({
path: '/connections',
getParentRoute: () => SettingsRoute,
} as any)
const SettingsCloudEnvironmentsRoute =
SettingsCloudEnvironmentsRouteImport.update({
id: '/cloud-environments',
path: '/cloud-environments',
getParentRoute: () => SettingsRoute,
} as any)
const SettingsBetaRoute = SettingsBetaRouteImport.update({
id: '/beta',
path: '/beta',
@@ -122,6 +129,7 @@ export interface FileRoutesByFullPath {
'/settings/appearance': typeof SettingsAppearanceRoute
'/settings/archived': typeof SettingsArchivedRoute
'/settings/beta': typeof SettingsBetaRoute
'/settings/cloud-environments': typeof SettingsCloudEnvironmentsRoute
'/settings/connections': typeof SettingsConnectionsRoute
'/settings/diagnostics': typeof SettingsDiagnosticsRoute
'/settings/general': typeof SettingsGeneralRoute
@@ -139,6 +147,7 @@ export interface FileRoutesByTo {
'/settings/appearance': typeof SettingsAppearanceRoute
'/settings/archived': typeof SettingsArchivedRoute
'/settings/beta': typeof SettingsBetaRoute
'/settings/cloud-environments': typeof SettingsCloudEnvironmentsRoute
'/settings/connections': typeof SettingsConnectionsRoute
'/settings/diagnostics': typeof SettingsDiagnosticsRoute
'/settings/general': typeof SettingsGeneralRoute
@@ -159,6 +168,7 @@ export interface FileRoutesById {
'/settings/appearance': typeof SettingsAppearanceRoute
'/settings/archived': typeof SettingsArchivedRoute
'/settings/beta': typeof SettingsBetaRoute
'/settings/cloud-environments': typeof SettingsCloudEnvironmentsRoute
'/settings/connections': typeof SettingsConnectionsRoute
'/settings/diagnostics': typeof SettingsDiagnosticsRoute
'/settings/general': typeof SettingsGeneralRoute
@@ -180,6 +190,7 @@ export interface FileRouteTypes {
| '/settings/appearance'
| '/settings/archived'
| '/settings/beta'
| '/settings/cloud-environments'
| '/settings/connections'
| '/settings/diagnostics'
| '/settings/general'
@@ -197,6 +208,7 @@ export interface FileRouteTypes {
| '/settings/appearance'
| '/settings/archived'
| '/settings/beta'
| '/settings/cloud-environments'
| '/settings/connections'
| '/settings/diagnostics'
| '/settings/general'
@@ -216,6 +228,7 @@ export interface FileRouteTypes {
| '/settings/appearance'
| '/settings/archived'
| '/settings/beta'
| '/settings/cloud-environments'
| '/settings/connections'
| '/settings/diagnostics'
| '/settings/general'
@@ -314,6 +327,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsConnectionsRouteImport
parentRoute: typeof SettingsRoute
}
'/settings/cloud-environments': {
id: '/settings/cloud-environments'
path: '/cloud-environments'
fullPath: '/settings/cloud-environments'
preLoaderRoute: typeof SettingsCloudEnvironmentsRouteImport
parentRoute: typeof SettingsRoute
}
'/settings/beta': {
id: '/settings/beta'
path: '/beta'
@@ -377,6 +397,7 @@ interface SettingsRouteChildren {
SettingsAppearanceRoute: typeof SettingsAppearanceRoute
SettingsArchivedRoute: typeof SettingsArchivedRoute
SettingsBetaRoute: typeof SettingsBetaRoute
SettingsCloudEnvironmentsRoute: typeof SettingsCloudEnvironmentsRoute
SettingsConnectionsRoute: typeof SettingsConnectionsRoute
SettingsDiagnosticsRoute: typeof SettingsDiagnosticsRoute
SettingsGeneralRoute: typeof SettingsGeneralRoute
@@ -389,6 +410,7 @@ const SettingsRouteChildren: SettingsRouteChildren = {
SettingsAppearanceRoute: SettingsAppearanceRoute,
SettingsArchivedRoute: SettingsArchivedRoute,
SettingsBetaRoute: SettingsBetaRoute,
SettingsCloudEnvironmentsRoute: SettingsCloudEnvironmentsRoute,
SettingsConnectionsRoute: SettingsConnectionsRoute,
SettingsDiagnosticsRoute: SettingsDiagnosticsRoute,
SettingsGeneralRoute: SettingsGeneralRoute,
@@ -0,0 +1,7 @@
import { createFileRoute } from "@tanstack/react-router";
import { CloudEnvironmentsSettings } from "../components/settings/CloudEnvironmentsSettings";
export const Route = createFileRoute("/settings/cloud-environments")({
component: CloudEnvironmentsSettings,
});
+7 -6
View File
@@ -4,9 +4,9 @@ This experimental setup runs one T3 Code environment as a Render web service. Th
the provider processes, repositories, worktrees, terminals, and T3 Code state. The web, desktop, and
mobile clients connect to it over Render's public HTTPS and WebSocket endpoint.
This is a single-user deployment, not a multi-tenant hosted service. The attached persistent disk
also limits the service to one instance. Multiple agent threads can still run concurrently inside
that instance.
This is one shared environment, not a multi-tenant hosted service. Multiple trusted people can pair
to it and run agent threads concurrently. The attached persistent disk limits the service to one
instance.
## What the Blueprint Creates
@@ -23,8 +23,7 @@ The root [`render.yaml`](../../render.yaml) creates:
3. Deploy the Blueprint and wait for the service health check to pass.
4. Open the service logs and copy the `Pair URL` printed during startup. Treat this URL like a
password: it contains a one-time pairing credential.
5. Open the URL in a browser. The hosted T3 Code app pairs with the Render environment and saves it
under **Settings → Connections → Cloud environments**, labeled as powered by Render.
5. Open the URL in a browser, or paste it under **Settings → Cloud environments → Pair URL**.
6. Authenticate a provider and source control as described below.
7. Open the Command Palette and choose **Add Project → Cloud environments → Render cloud
environment**. Select a GitHub repository, another supported source-control repository, or any
@@ -71,13 +70,15 @@ or paste one into a project URL.
T3 Connect is not required for this deployment. Render already gives the environment a public HTTPS
and WebSocket endpoint, so the Pair URL registers it as a direct remote environment. Use its existing
Connect and Disconnect controls under **Settings → Connections**. T3 Connect remains useful for
Connect and Disconnect controls under **Settings → Cloud environments**. T3 Connect remains useful for
machines that need its managed tunnel or account-level environment discovery.
## Operations
- Each deploy prints a fresh pairing URL with a 24-hour lifetime. Existing paired browser sessions
remain authenticated until revoked with `t3 auth`.
- To share the environment, use the copyable command under **Settings → Cloud environments → Give
someone access** and send that person the new one-time Pair URL.
- Render terminates the previous instance before starting a new one because the service has a disk.
Expect a short interruption during deploys.
- Do not use this Blueprint for untrusted users or repositories. Coding agents can execute commands