"use client"; import { useEffect, useState } from "react"; import { api } from "@/lib/api"; import DashboardLayout from "@/components/DashboardLayout"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Download, Terminal, MonitorSmartphone, Apple, Copy, Check, Loader2, Shield, } from "lucide-react"; interface PlatformInfo { os: string; arch: string; label: string; filename: string; available: boolean; size: number; sizeFormatted: string; installHint: string; } interface AgentInfo { version: string; platforms: PlatformInfo[]; } const osIcons: Record = { linux: Terminal, windows: MonitorSmartphone, darwin: Apple, }; function getApiBase() { return process.env.NEXT_PUBLIC_API_URL || "http://localhost:3002/api"; } function WindowsInstallerCard() { const [serverUrl, setServerUrl] = useState(""); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [success, setSuccess] = useState(false); useEffect(() => { setServerUrl(getApiBase().replace(/\/api$/, "")); }, []); const handleGenerate = async () => { setLoading(true); setError(null); setSuccess(false); try { const token = api.getToken(); const res = await fetch(`${getApiBase()}/v1/installers/generate`, { method: "POST", headers: { "Content-Type": "application/json", ...(token ? { Authorization: `Bearer ${token}` } : {}), }, body: JSON.stringify({ serverUrl }), }); if (!res.ok) { let message = `Failed to generate installer (${res.status})`; try { const data = await res.json(); if (data?.error?.message) message = data.error.message; } catch {} setError(message); return; } const blob = await res.blob(); const blobUrl = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = blobUrl; a.download = "forge-agent.msi"; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(blobUrl); setSuccess(true); } catch (err) { setError( err instanceof Error ? err.message : "Failed to generate installer" ); } finally { setLoading(false); } }; return ( Windows MSI Installer
setServerUrl(e.target.value)} placeholder="http://your-server:3002" />

The installer will be pre-configured to point the agent at this Fleet Forge server.

{error && ( {error} )} {success && !error && ( Installer generated and downloaded as forge-agent.msi. )} The installer embeds a single-use enrollment token. Each generated MSI can only enroll one device; generate a new installer for every device you deploy.
); } export default function DownloadsPage() { const [agentInfo, setAgentInfo] = useState(null); const [copied, setCopied] = useState(null); useEffect(() => { api.get("/v1/downloads/agent").then((res) => { if (res.success && res.data) setAgentInfo(res.data); }); }, []); const handleDownload = async (filename: string) => { const token = api.getToken(); const url = `${getApiBase()}/v1/downloads/agent/${filename}`; const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` }, }); const blob = await res.blob(); const blobUrl = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = blobUrl; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(blobUrl); }; const copyToClipboard = (text: string, key: string) => { navigator.clipboard.writeText(text); setCopied(key); setTimeout(() => setCopied(null), 2000); }; const gpoTemplate = `msiexec /i forge-agent.msi /qn /l*v install.log`; const uninstallTemplate = `sc stop FleetForgeAgent msiexec /x forge-agent.msi /qn`; const linuxTemplate = `chmod +x forge-agent-linux-amd64 sudo ./forge-agent enroll -token -server http://SERVER:3002 sudo ./forge-agent run`; const systemdTemplate = `[Unit] Description=Fleet Forge Agent After=network.target [Service] ExecStart=/usr/local/bin/forge-agent run Restart=always RestartSec=5 [Install] WantedBy=multi-user.target`; return (

Agent Downloads

Download the Fleet Forge agent for your platform

Windows MSI Installer All Binaries Deployment Guide Forge Agent {agentInfo?.version}
{agentInfo?.platforms.map((platform) => { const Icon = osIcons[platform.os] || Download; return (
{platform.label}
{platform.sizeFormatted}
); })}
{!agentInfo && (
Loading agent binaries...
)}
Windows GPO Deployment

Deploy the MSI silently across your fleet via Group Policy:

                    {gpoTemplate}
                  
Uninstall

Stop the service and remove the agent from a Windows device:

                    {uninstallTemplate}
                  
Linux Quick Start

Download the Linux binary, then enroll and run it:

                    {linuxTemplate}
                  
Linux Systemd Service

For permanent installation on Linux, create a systemd unit file:

                    {systemdTemplate}
                  
); }