Tutorial: Terminal Setup — Blazor
Embed IsabyteTerminalClient: session tabs, floating/dockable window, collapsed launcher,
themes, localizable labels — and, on Blazor, a real server-side shell over SignalR.
Level: Intermediate · Time: ~15 minutes
Prerequisites
- The latest .NET SDK and the Isabyte Power Tools package (see Getting Started).
- SignalR (ships with ASP.NET Core — no extra package).
Step 1 — Map the Terminal Hub
The component talks to a SignalR hub that spawns the shell. Map it in Program.cs:
builder.Services.AddSignalR(opt =>
{
// Terminal output streams through SignalR; raise the cap if you tune payloads.
opt.MaximumReceiveMessageSize = 204800000;
});
var app = builder.Build();
app.MapIsabyteTerminalHub(); // default endpoint: /isabyte-terminalhub
// app.MapIsabyteTerminalHub("/admin/terminalhub"); // custom path overload
Step 2 — Add the Component
<IsabyteTerminalClient Height="480px"
Shell="/bin/bash"
Theme="IsabyteTerminalTheme.MateDesktop" />
HubUrl defaults to /isabyte-terminalhub — set it only if you mapped a custom path.
Shell defaults to powershell.exe on Windows and /bin/bash elsewhere.
Step 3 — Sandbox vs Real Shell
<IsabyteTerminalClient Sandbox="true" />
Sandbox="true" runs the built-in simulated shell (fake filesystem, history, Tab
completion) with no hub required — ideal for public pages. Without it, the hub spawns a
real shell on the server hosting your app, under the app's identity — it is not an SSH
client to other machines.
Step 4 — React to Sessions and Commands
<IsabyteTerminalClient OnSessionCreated="id => _log.SessionOpened(id)"
OnSessionClosed="id => _log.SessionClosed(id)"
OnCommandExecuted="cmd => _log.Audit(cmd)"
BlockedCommands="@_blockedCommands" />
@code {
private readonly string[] _blockedCommands = { "rm", "shutdown" };
}
OnCommandExecuted is the audit hook — persist every command with the signed-in user.
BlockedCommands refuses listed commands client-side; treat it as defense-in-depth only.
Step 5 — Window Chrome
Floating="true" detaches the terminal into a draggable window with snap/dock controls
(FloatingChanged reports state); CollapsedMode="true" renders a taskbar-style launcher
instead of an open pane. Enabled="false" gates the whole UI.
Security Checklist
- Real-shell pages live behind
[Authorize](or an<AuthorizeView>wrapper) and an admin-only policy — never expose them anonymously. - Run the app under a least-privilege service account: the shell inherits its permissions.
- Keep public/demo surfaces on
Sandbox="true". - Network-isolate the app host; the shell reaches whatever the host can reach.