Files

2094 lines
94 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cosmos Orbit — Application Platform</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><circle cx='16' cy='16' r='5' fill='%2338bdf8'/><ellipse cx='16' cy='16' rx='14' ry='6' fill='none' stroke='%2338bdf8' stroke-width='1.5' opacity='0.7'/><ellipse cx='16' cy='16' rx='14' ry='6' fill='none' stroke='%23a855f7' stroke-width='1' opacity='0.5' transform='rotate(60,16,16)'/></svg>">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
/* ─── CSS RESET & VARIABLES ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #030712;
--bg1: #080f1e;
--bg2: rgba(12, 20, 40, 0.9);
--bg3: rgba(18, 30, 55, 0.7);
--border: rgba(255,255,255,0.07);
--border2: rgba(255,255,255,0.12);
--ink-0: #f8fafc;
--ink-1: #cbd5e1;
--ink-2: #94a3b8;
--ink-3: #475569;
--cyan: #38bdf8;
--cyan-dark: #0ea5e9;
--purple: #a855f7;
--green: #10b981;
--amber: #f59e0b;
--red: #ef4444;
--mono: 'JetBrains Mono', monospace;
--sans: 'Inter', sans-serif;
--sidebar: 240px;
--header: 56px;
--radius: 12px;
--transition: cubic-bezier(0.22, 1, 0.36, 1);
}
html { scroll-behavior: smooth; }
body {
background: var(--bg);
color: var(--ink-0);
font-family: var(--sans);
min-height: 100vh;
overflow: hidden;
display: flex;
}
/* ─── ANIMATED BACKGROUND ─────────────────────────────────────── */
#orbit-bg {
position: fixed;
inset: 0;
z-index: 0;
pointer-events: none;
overflow: hidden;
}
#orbit-bg canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.bg-orb {
position: absolute;
border-radius: 50%;
filter: blur(80px);
animation: floatOrb 20s ease-in-out infinite;
pointer-events: none;
}
.bg-orb-1 { width: 600px; height: 600px; background: radial-gradient(circle, rgba(56,189,248,0.07) 0%, transparent 70%); top: -200px; left: -100px; animation-delay: 0s; }
.bg-orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(168,85,247,0.06) 0%, transparent 70%); top: 30%; right: -150px; animation-delay: -7s; }
.bg-orb-3 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(16,185,129,0.04) 0%, transparent 70%); bottom: -100px; left: 30%; animation-delay: -14s; }
@keyframes floatOrb {
0%,100% { transform: translate(0,0) scale(1); }
33% { transform: translate(30px,-30px) scale(1.05); }
66% { transform: translate(-20px,20px) scale(0.96); }
}
/* ─── LAYOUT ──────────────────────────────────────────────────── */
#sidebar {
width: var(--sidebar);
height: 100vh;
position: fixed;
left: 0; top: 0;
display: flex;
flex-direction: column;
background: rgba(5, 10, 20, 0.92);
backdrop-filter: blur(20px);
border-right: 1px solid var(--border);
z-index: 20;
transition: transform 0.3s var(--transition);
}
#main {
margin-left: var(--sidebar);
flex: 1;
display: flex;
flex-direction: column;
min-height: 100vh;
position: relative;
z-index: 10;
overflow: hidden;
}
#topbar {
height: var(--header);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 28px;
background: rgba(5, 10, 20, 0.75);
backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
z-index: 15;
flex-shrink: 0;
}
#content {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 28px 32px 64px;
scroll-behavior: smooth;
}
/* ─── SIDEBAR BRAND ───────────────────────────────────────────── */
.sidebar-brand {
padding: 20px 20px 16px;
display: flex;
align-items: center;
gap: 10px;
border-bottom: 1px solid var(--border);
}
.brand-icon {
width: 36px; height: 36px;
border-radius: 10px;
background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(168,85,247,0.15));
border: 1px solid rgba(56,189,248,0.3);
display: flex; align-items: center; justify-content: center;
flex-shrink: 0;
position: relative;
overflow: hidden;
}
.brand-icon svg { animation: spinOrbit 8s linear infinite; }
@keyframes spinOrbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.brand-text { font-size: 16px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.brand-text small { display: block; font-size: 10px; font-weight: 500; color: var(--ink-3); letter-spacing: 0.05em; text-transform: uppercase; }
/* ─── SIDEBAR NAV ─────────────────────────────────────────────── */
.sidebar-nav {
flex: 1;
padding: 16px 12px;
display: flex;
flex-direction: column;
gap: 2px;
overflow-y: auto;
}
.nav-section-label {
font-size: 10px;
font-weight: 700;
color: var(--ink-3);
text-transform: uppercase;
letter-spacing: 0.1em;
padding: 12px 8px 6px;
}
.nav-item {
display: flex;
align-items: center;
gap: 10px;
padding: 9px 12px;
border-radius: 9px;
font-size: 13.5px;
font-weight: 500;
color: var(--ink-2);
cursor: pointer;
transition: all 0.2s var(--transition);
position: relative;
border: 1px solid transparent;
user-select: none;
text-decoration: none;
}
.nav-item:hover {
color: var(--ink-0);
background: rgba(255,255,255,0.06);
border-color: rgba(255,255,255,0.08);
transform: translateX(3px);
}
.nav-item:hover .nav-icon { color: var(--cyan); }
.nav-item.active {
color: var(--ink-0);
background: rgba(56,189,248,0.1);
border-color: rgba(56,189,248,0.25);
box-shadow: 0 0 20px rgba(56,189,248,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}
.nav-item.active .nav-icon { color: var(--cyan); }
.nav-item.active::before {
content: '';
position: absolute;
left: -12px; top: 50%;
transform: translateY(-50%);
width: 3px; height: 18px;
background: linear-gradient(180deg, var(--cyan), var(--purple));
border-radius: 0 3px 3px 0;
}
.nav-icon {
width: 18px; height: 18px;
flex-shrink: 0;
color: var(--ink-3);
transition: color 0.2s;
}
.nav-badge {
margin-left: auto;
font-size: 10px;
font-weight: 700;
padding: 2px 7px;
border-radius: 999px;
background: rgba(56,189,248,0.12);
color: var(--cyan);
font-family: var(--mono);
}
/* ─── SIDEBAR QUOTA ───────────────────────────────────────────── */
.sidebar-quota {
margin: 12px;
padding: 14px;
background: rgba(255,255,255,0.03);
border: 1px solid var(--border);
border-radius: 10px;
}
.quota-label {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 11px;
color: var(--ink-2);
margin-bottom: 8px;
font-weight: 500;
}
.quota-label strong { color: var(--cyan); font-family: var(--mono); }
.quota-bar {
height: 4px;
background: rgba(255,255,255,0.07);
border-radius: 999px;
overflow: hidden;
}
.quota-fill {
height: 100%;
border-radius: 999px;
background: linear-gradient(90deg, var(--cyan), var(--purple));
transition: width 0.5s var(--transition);
}
/* ─── SIDEBAR FOOTER ──────────────────────────────────────────── */
.sidebar-footer {
padding: 14px;
border-top: 1px solid var(--border);
display: flex;
align-items: center;
gap: 10px;
}
.avatar {
width: 32px; height: 32px;
border-radius: 50%;
background: linear-gradient(135deg, var(--cyan-dark), var(--purple));
display: flex; align-items: center; justify-content: center;
font-size: 12px; font-weight: 700; color: #fff;
flex-shrink: 0;
}
.footer-user { flex: 1; min-width: 0; }
.footer-user-name { font-size: 12px; font-weight: 600; color: var(--ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-user-role { font-size: 10px; color: var(--ink-3); }
.btn-logout {
width: 28px; height: 28px;
border-radius: 7px;
border: 1px solid var(--border);
background: transparent;
color: var(--ink-3);
cursor: pointer;
display: flex; align-items: center; justify-content: center;
transition: all 0.2s;
flex-shrink: 0;
text-decoration: none;
}
.btn-logout:hover { border-color: rgba(239,68,68,0.4); color: #f87171; background: rgba(239,68,68,0.08); }
/* ─── TOPBAR ──────────────────────────────────────────────────── */
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-0); }
.topbar-sub { font-size: 12px; color: var(--ink-3); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
/* ─── VIEWS ───────────────────────────────────────────────────── */
.view { display: none; animation: viewIn 0.3s var(--transition); }
.view.active { display: block; }
@keyframes viewIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
/* ─── PAGE HEADER ─────────────────────────────────────────────── */
.page-hd {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 28px;
flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.page-sub { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
/* ─── BUTTONS ─────────────────────────────────────────────────── */
.btn {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 9px 16px;
border-radius: 9px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.22s var(--transition);
border: 1px solid transparent;
text-decoration: none;
white-space: nowrap;
font-family: var(--sans);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
background: linear-gradient(135deg, #0369a1 0%, #38bdf8 55%, #818cf8 100%);
background-size: 200%;
color: #fff;
border-color: rgba(255,255,255,0.2);
box-shadow: 0 2px 12px rgba(56,189,248,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-primary:hover {
background-position: right;
box-shadow: 0 0 24px rgba(56,189,248,0.55), 0 4px 16px rgba(0,0,0,0.4);
transform: translateY(-2px);
}
.btn-ghost {
background: rgba(255,255,255,0.04);
color: var(--ink-1);
border-color: var(--border2);
}
.btn-ghost:hover {
background: rgba(56,189,248,0.1);
color: var(--cyan);
border-color: rgba(56,189,248,0.4);
transform: translateY(-2px);
box-shadow: 0 0 14px rgba(56,189,248,0.2);
}
.btn-danger {
background: rgba(239,68,68,0.08);
color: #f87171;
border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover {
background: rgba(239,68,68,0.18);
border-color: rgba(239,68,68,0.5);
box-shadow: 0 0 14px rgba(239,68,68,0.2);
transform: translateY(-2px);
}
.btn-success {
background: rgba(16,185,129,0.1);
color: #34d399;
border-color: rgba(16,185,129,0.3);
}
.btn-success:hover {
background: rgba(16,185,129,0.2);
border-color: rgba(16,185,129,0.5);
box-shadow: 0 0 14px rgba(16,185,129,0.2);
transform: translateY(-2px);
}
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 6px; }
/* ─── STATS GRID ──────────────────────────────────────────────── */
.stats-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
gap: 16px;
margin-bottom: 28px;
}
.stat-card {
background: var(--bg2);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 18px 20px;
display: flex;
flex-direction: column;
gap: 6px;
transition: all 0.25s var(--transition);
position: relative;
overflow: hidden;
}
.stat-card::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(56,189,248,0.04), transparent);
opacity: 0;
transition: opacity 0.25s;
}
.stat-card:hover { border-color: rgba(56,189,248,0.3); transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 20px rgba(56,189,248,0.1); }
.stat-card:hover::after { opacity: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-lbl { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; color: var(--ink-0); }
.stat-hint { font-size: 12px; color: var(--ink-3); }
/* ─── APP GRID ────────────────────────────────────────────────── */
.apps-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
gap: 18px;
}
.app-card {
background: var(--bg2);
border: 1px solid var(--border);
border-radius: 14px;
padding: 22px;
display: flex;
flex-direction: column;
gap: 14px;
transition: all 0.28s var(--transition);
position: relative;
overflow: hidden;
}
.app-card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0; height: 1px;
background: linear-gradient(90deg, transparent, rgba(56,189,248,0.5), transparent);
opacity: 0;
transition: opacity 0.3s;
}
.app-card:hover {
border-color: rgba(56,189,248,0.35);
box-shadow: 0 20px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(56,189,248,0.12), 0 0 40px rgba(56,189,248,0.08);
transform: translateY(-4px);
}
.app-card:hover::before { opacity: 1; }
.app-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.app-name-row { flex: 1; min-width: 0; }
.app-name { font-size: 16px; font-weight: 700; color: var(--ink-0); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Status pills */
.pill {
display: inline-flex; align-items: center; gap: 5px;
padding: 3px 9px; border-radius: 999px;
font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.pill-running { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.pill-building { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.pill-stopped { background: rgba(100,116,139,0.12); color: #94a3b8; border: 1px solid rgba(100,116,139,0.2); }
.pill-failed { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.pill-dot {
width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.pill-running .pill-dot { animation: blink 1.8s ease-in-out infinite; box-shadow: 0 0 6px currentColor; }
.pill-building .pill-dot { animation: blink 0.9s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.25} }
/* Metrics grid inside app card */
.app-metrics {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
background: rgba(0,0,0,0.2);
border: 1px solid rgba(255,255,255,0.04);
border-radius: 9px;
padding: 10px 14px;
}
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.metric-val { font-size: 14px; font-weight: 700; color: var(--ink-0); font-family: var(--mono); }
/* Domain tag in app card */
.domain-tag {
display: inline-flex; align-items: center; gap: 5px;
font-size: 11px; font-family: var(--mono); color: var(--cyan);
background: rgba(56,189,248,0.07); border: 1px solid rgba(56,189,248,0.18);
padding: 3px 9px; border-radius: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* App card actions */
.app-actions {
display: flex; align-items: center; justify-content: space-between; gap: 8px;
padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.05);
}
.app-actions-left { display: flex; gap: 6px; flex-wrap: wrap; }
.app-actions-right { display: flex; gap: 6px; }
/* ─── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
grid-column: 1/-1;
padding: 80px 24px;
text-align: center;
border: 1px dashed rgba(255,255,255,0.08);
border-radius: 18px;
background: rgba(255,255,255,0.01);
}
.empty-state svg { margin: 0 auto 20px; opacity: 0.6; }
.empty-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--ink-2); max-width: 380px; margin: 0 auto 24px; line-height: 1.6; }
/* ─── DOMAINS VIEW ────────────────────────────────────────────── */
.domain-list { display: flex; flex-direction: column; gap: 14px; }
.domain-row {
background: var(--bg2);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 18px 22px;
display: flex;
align-items: center;
gap: 16px;
transition: all 0.22s var(--transition);
}
.domain-row:hover { border-color: var(--border2); transform: translateX(4px); box-shadow: 0 0 24px rgba(56,189,248,0.06); }
.domain-row-info { flex: 1; min-width: 0; }
.domain-row-app { font-size: 13px; font-weight: 600; color: var(--ink-0); }
.domain-row-addr { font-size: 12px; font-family: var(--mono); color: var(--cyan); margin-top: 2px; }
.domain-row-actions { display: flex; gap: 8px; flex-shrink: 0; }
/* ─── FORM INPUTS ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form-input, .form-select, .form-textarea {
background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.1);
border-radius: 9px;
padding: 10px 14px;
color: var(--ink-0);
font-size: 13.5px;
font-family: var(--sans);
outline: none;
width: 100%;
transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
border-color: rgba(56,189,248,0.6);
box-shadow: 0 0 0 3px rgba(56,189,248,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.form-hint { font-size: 11px; color: var(--ink-3); }
.form-select option { background: #0b1120; }
/* ─── MODAL ───────────────────────────────────────────────────── */
.modal-bg {
position: fixed; inset: 0;
background: rgba(2,7,18,0.88);
backdrop-filter: blur(14px);
z-index: 100;
display: flex; align-items: center; justify-content: center;
padding: 24px;
opacity: 0; pointer-events: none;
transition: opacity 0.25s;
}
.modal-bg.open { opacity: 1; pointer-events: auto; }
.modal-bg.open .modal-box { transform: translateY(0) scale(1); opacity: 1; }
.modal-box {
background: #07101f;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 18px;
width: 100%; max-width: 680px;
max-height: 88vh;
overflow-y: auto;
box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(56,189,248,0.08);
padding: 28px;
display: flex; flex-direction: column; gap: 22px;
transform: translateY(16px) scale(0.98);
opacity: 0;
transition: all 0.3s var(--transition);
}
.modal-hd { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.modal-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.modal-close {
width: 30px; height: 30px;
border-radius: 8px;
border: 1px solid var(--border);
background: transparent;
color: var(--ink-3);
cursor: pointer;
display: flex; align-items: center; justify-content: center;
font-size: 16px;
transition: all 0.2s;
flex-shrink: 0;
}
.modal-close:hover { border-color: rgba(239,68,68,0.4); color: #f87171; background: rgba(239,68,68,0.08); }
/* ─── TABS ────────────────────────────────────────────────────── */
.tab-row { display: flex; gap: 6px; border-bottom: 1px solid rgba(255,255,255,0.07); padding-bottom: 12px; }
.tab-btn {
padding: 7px 14px; border-radius: 8px;
font-size: 13px; font-weight: 600;
color: var(--ink-3); cursor: pointer;
background: transparent; border: 1px solid transparent;
transition: all 0.2s var(--transition);
font-family: var(--sans);
}
.tab-btn:hover { color: var(--ink-0); background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
.tab-btn.active {
background: rgba(56,189,248,0.12); color: var(--cyan);
border-color: rgba(56,189,248,0.3);
box-shadow: 0 0 14px rgba(56,189,248,0.15);
}
/* Template cards */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl-card {
background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.07);
border-radius: 9px; padding: 12px; cursor: pointer;
transition: all 0.22s var(--transition);
position: relative;
}
.tpl-card:hover { background: rgba(56,189,248,0.07); border-color: rgba(56,189,248,0.35); transform: translateY(-2px); box-shadow: 0 0 16px rgba(56,189,248,0.15); }
.tpl-card.selected { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.5); box-shadow: 0 0 20px rgba(56,189,248,0.2); }
.tpl-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tpl-name { font-size: 13px; font-weight: 700; color: var(--ink-0); display: flex; align-items: center; gap: 7px; }
.tpl-desc { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.tpl-pill { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.tpl-pill-cyan { background: rgba(56,189,248,0.15); color: var(--cyan); border: 1px solid rgba(56,189,248,0.3); }
.tpl-pill-green { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.tpl-pill-purple { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.3); }
.tpl-pill-amber { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.tpl-port-tag { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
/* Showcase grid in full view */
.tpl-showcase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; margin-top: 18px; }
.tpl-showcase-card {
background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.07);
border-radius: 14px; padding: 20px; transition: all 0.25s var(--transition);
display: flex; flex-direction: column; justify-content: space-between;
backdrop-filter: blur(8px);
}
.tpl-showcase-card:hover {
background: rgba(56,189,248,0.04); border-color: rgba(56,189,248,0.3);
transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,0.3), 0 0 20px rgba(56,189,248,0.12);
}
.tpl-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tpl-tag-item { font-size: 11px; font-family: var(--mono); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); padding: 2px 7px; border-radius: 5px; color: var(--ink-2); }
/* Filter pills */
.filter-pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.filter-pill {
padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
color: var(--ink-2); cursor: pointer; transition: all 0.2s var(--transition);
}
.filter-pill:hover { color: var(--ink-0); background: rgba(255,255,255,0.08); }
.filter-pill.active { background: rgba(56,189,248,0.15); border-color: rgba(56,189,248,0.4); color: var(--cyan); box-shadow: 0 0 12px rgba(56,189,248,0.2); }
/* Tech Matrix Card */
.tech-matrix-card {
background: rgba(15,23,42,0.45); border: 1px solid rgba(255,255,255,0.08);
border-radius: 14px; padding: 24px; margin-top: 32px;
}
.matrix-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 16px; }
.matrix-item { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 10px; padding: 14px 16px; }
.matrix-item-title { font-size: 13px; font-weight: 700; color: var(--cyan); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.matrix-item-list { font-size: 12px; color: var(--ink-2); line-height: 1.65; margin: 0; padding-left: 18px; }
/* Forge repo selector */
.forge-select {
background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
border-radius: 9px; padding: 10px 14px; color: var(--ink-0);
font-size: 13px; font-family: var(--sans);
outline: none; width: 100%; cursor: pointer;
transition: border-color 0.2s;
appearance: none;
}
.forge-select:focus { border-color: rgba(56,189,248,0.5); }
.forge-select option { background: #0b1120; }
/* ─── TERMINAL / LOGS ─────────────────────────────────────────── */
.terminal {
background: #010409;
border: 1px solid rgba(255,255,255,0.07);
border-radius: 12px;
padding: 16px;
font-family: var(--mono);
font-size: 12px;
line-height: 1.65;
color: #d4e0ef;
height: 420px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
}
.terminal::-webkit-scrollbar { width: 5px; }
.terminal::-webkit-scrollbar-track { background: transparent; }
.terminal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
/* ─── DOMAIN SETUP CARD ───────────────────────────────────────── */
.dns-card {
background: rgba(56,189,248,0.04);
border: 1px solid rgba(56,189,248,0.15);
border-radius: 10px;
padding: 16px;
}
.dns-row {
display: flex; gap: 10px; align-items: center;
padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.dns-row:last-child { border-bottom: none; }
.dns-type { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 5px; font-family: var(--mono); background: rgba(56,189,248,0.12); color: var(--cyan); flex-shrink: 0; }
.dns-name { font-family: var(--mono); font-size: 12px; color: var(--ink-1); flex: 1; }
.dns-val { font-family: var(--mono); font-size: 12px; color: var(--ink-0); }
.copy-btn {
width: 26px; height: 26px;
border-radius: 6px; border: 1px solid var(--border);
background: transparent; color: var(--ink-3);
cursor: pointer; display: flex; align-items: center; justify-content: center;
transition: all 0.2s;
}
.copy-btn:hover { border-color: var(--cyan); color: var(--cyan); }
/* ─── TOAST ───────────────────────────────────────────────────── */
#toast-wrap {
position: fixed; bottom: 24px; right: 24px;
z-index: 500; display: flex; flex-direction: column; gap: 8px;
pointer-events: none;
}
.toast {
padding: 12px 18px 12px 14px;
border-radius: 10px;
font-size: 13px; font-weight: 500;
display: flex; align-items: center; gap: 10px;
box-shadow: 0 8px 24px rgba(0,0,0,0.6);
animation: toastIn 0.3s var(--transition), toastOut 0.3s var(--transition) 3.2s forwards;
pointer-events: auto;
min-width: 240px; max-width: 380px;
}
.toast-info { background: rgba(15,23,42,0.98); border: 1px solid rgba(56,189,248,0.3); color: var(--ink-0); }
.toast-success { background: rgba(5,18,10,0.98); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.toast-error { background: rgba(18,5,5,0.98); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes toastOut { from{opacity:1} to{opacity:0;transform:translateX(20px)} }
/* ─── SCROLLBAR ───────────────────────────────────────────────── */
#content::-webkit-scrollbar { width: 5px; }
#content::-webkit-scrollbar-track { background: transparent; }
#content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }
/* ─── MOBILE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
#sidebar { transform: translateX(-100%); }
#sidebar.open { transform: translateX(0); }
#main { margin-left: 0; }
#content { padding: 20px 16px 64px; }
.apps-grid { grid-template-columns: 1fr; }
.stats-row { grid-template-columns: repeat(2, 1fr); }
#topbar { padding: 0 16px; }
.page-hd { flex-direction: column; align-items: flex-start; }
.modal-box { padding: 20px; }
.template-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
.stats-row { grid-template-columns: 1fr; }
.template-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<!-- Background -->
<div id="orbit-bg">
<canvas id="spaceCanvas"></canvas>
<div class="bg-orb bg-orb-1"></div>
<div class="bg-orb bg-orb-2"></div>
<div class="bg-orb bg-orb-3"></div>
</div>
<!-- Sidebar -->
<aside id="sidebar">
<div class="sidebar-brand">
<div class="brand-icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#38bdf8" stroke-width="1.8">
<circle cx="12" cy="12" r="4"/>
<ellipse cx="12" cy="12" rx="11" ry="5" transform="rotate(0,12,12)"/>
<ellipse cx="12" cy="12" rx="11" ry="5" transform="rotate(60,12,12)"/>
</svg>
</div>
<div class="brand-text">
Orbit
<small>Cosmos PaaS</small>
</div>
</div>
<nav class="sidebar-nav">
<div class="nav-section-label">Platform</div>
<div class="nav-item active" id="nav-apps" onclick="switchView('apps')">
<svg class="nav-icon" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><rect x="2" y="3" width="7" height="7" rx="1"/><rect x="15" y="3" width="7" height="7" rx="1"/><rect x="2" y="14" width="7" height="7" rx="1"/><rect x="15" y="14" width="7" height="7" rx="1"/></svg>
Applications
<span class="nav-badge" id="badge-apps">0</span>
</div>
<div class="nav-item" id="nav-templates" onclick="switchView('templates')">
<svg class="nav-icon" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><path d="M4 5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5z"/><path d="M4 13a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-6z"/><path d="M16 13a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-6z"/></svg>
Starter Templates
<span class="nav-badge" id="badge-templates" style="background:rgba(56,189,248,0.15);color:var(--cyan);">6</span>
</div>
<div class="nav-item" id="nav-domains" onclick="switchView('domains')">
<svg class="nav-icon" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
Custom Domains
<span class="nav-badge" id="badge-domains" style="display:none">0</span>
</div>
<div class="nav-item" id="nav-deploy" onclick="openDeployModal()">
<svg class="nav-icon" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
Deploy New App
</div>
<div class="nav-section-label" style="margin-top:8px">Links</div>
<a class="nav-item" href="/source/" target="_blank">
<svg class="nav-icon" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 00-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0020 4.77 5.07 5.07 0 0019.91 1S18.73.65 16 2.48a13.38 13.38 0 00-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 005 4.77a5.44 5.44 0 00-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 009 18.13V22"/></svg>
Forge Git
</a>
<a class="nav-item" href="/oort/console">
<svg class="nav-icon" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><path d="M21 16V8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16z"/></svg>
Oort Storage
</a>
</nav>
<!-- Port Quota -->
<div class="sidebar-quota">
<div class="quota-label">
<span>Port Quota</span>
<strong id="quota-text">0/10</strong>
</div>
<div class="quota-bar">
<div class="quota-fill" id="quota-fill" style="width:0%"></div>
</div>
</div>
<!-- User Footer -->
<div class="sidebar-footer">
<div class="avatar" id="user-avatar">U</div>
<div class="footer-user">
<div class="footer-user-name" id="user-name">Loading…</div>
<div class="footer-user-role">Orbit Developer</div>
</div>
<a class="btn-logout" href="/oort/logout" title="Sign out">
<svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
</a>
</div>
</aside>
<!-- Main Content -->
<div id="main">
<!-- Topbar -->
<header id="topbar">
<div style="display:flex;align-items:center;gap:12px;">
<button id="menu-toggle" onclick="toggleSidebar()" style="display:none;background:none;border:none;color:var(--ink-2);cursor:pointer;padding:4px;">
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<div>
<div class="topbar-title" id="topbar-title">Applications</div>
<div class="topbar-sub" id="topbar-sub">Your deployed container fleet</div>
</div>
</div>
<div class="topbar-right">
<button class="btn btn-ghost btn-sm" onclick="refreshAll()">
<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 11-2.12-9.36L23 10"/></svg>
Refresh
</button>
<button class="btn btn-primary btn-sm" onclick="openDeployModal()">
<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
Deploy
</button>
</div>
</header>
<!-- Content -->
<div id="content">
<!-- ── APPS VIEW ─────────────────────────────────────── -->
<div class="view active" id="view-apps">
<!-- Stats Row -->
<div class="stats-row" id="stats-row">
<div class="stat-card">
<div class="stat-top">
<span class="stat-lbl">Total Apps</span>
<div class="stat-icon" style="background:rgba(56,189,248,0.1)">
<svg width="16" height="16" fill="none" stroke="#38bdf8" stroke-width="2" viewBox="0 0 24 24"><rect x="2" y="3" width="7" height="7" rx="1"/><rect x="15" y="3" width="7" height="7" rx="1"/><rect x="2" y="14" width="7" height="7" rx="1"/><rect x="15" y="14" width="7" height="7" rx="1"/></svg>
</div>
</div>
<div class="stat-val" id="s-total">0</div>
<div class="stat-hint">of 10 max</div>
</div>
<div class="stat-card">
<div class="stat-top">
<span class="stat-lbl">Running</span>
<div class="stat-icon" style="background:rgba(16,185,129,0.1)">
<svg width="16" height="16" fill="none" stroke="#10b981" stroke-width="2" viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>
</div>
</div>
<div class="stat-val" id="s-running">0</div>
<div class="stat-hint">containers live</div>
</div>
<div class="stat-card">
<div class="stat-top">
<span class="stat-lbl">Memory</span>
<div class="stat-icon" style="background:rgba(168,85,247,0.1)">
<svg width="16" height="16" fill="none" stroke="#a855f7" stroke-width="2" viewBox="0 0 24 24"><rect x="2" y="6" width="20" height="14" rx="2"/><path d="M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2"/></svg>
</div>
</div>
<div class="stat-val" id="s-mem">—</div>
<div class="stat-hint">total used</div>
</div>
<div class="stat-card">
<div class="stat-top">
<span class="stat-lbl">Domains</span>
<div class="stat-icon" style="background:rgba(245,158,11,0.1)">
<svg width="16" height="16" fill="none" stroke="#f59e0b" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
</div>
</div>
<div class="stat-val" id="s-domains">0</div>
<div class="stat-hint">custom mapped</div>
</div>
</div>
<!-- Apps grid -->
<div class="apps-grid" id="apps-grid">
<div class="empty-state">
<svg width="48" height="48" fill="none" stroke="#38bdf8" stroke-width="1.2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 8v8M8 12h8"/></svg>
<h3>Loading applications…</h3>
<p>Fetching your container fleet.</p>
</div>
</div>
</div>
<!-- ── DOMAINS VIEW ───────────────────────────────────── -->
<div class="view" id="view-domains">
<div class="page-hd">
<div>
<div class="page-title">Custom Domains</div>
<div class="page-sub">Map your own domain to any Orbit application</div>
</div>
</div>
<!-- DNS Instructions -->
<div style="background:rgba(56,189,248,0.05);border:1px solid rgba(56,189,248,0.15);border-radius:12px;padding:18px 22px;margin-bottom:24px;">
<div style="font-size:13px;font-weight:700;color:var(--cyan);margin-bottom:10px;display:flex;align-items:center;gap:8px;">
<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
How Custom Domains Work
</div>
<div style="font-size:13px;color:var(--ink-2);line-height:1.7;">
1. Pick an app and set its custom domain below.<br>
2. In your DNS provider, add a <code style="background:rgba(255,255,255,0.06);padding:2px 6px;border-radius:4px;font-family:var(--mono);font-size:11px;">CNAME</code> record pointing <strong>your-domain.com</strong> → <strong id="server-host">this-server</strong><br>
3. For apex domains (e.g. <code style="background:rgba(255,255,255,0.06);padding:2px 6px;border-radius:4px;font-family:var(--mono);font-size:11px;">example.com</code>) use an <strong>A record</strong> pointing to this server's IP.<br>
4. DNS propagation takes up to 48h. Once live, traffic routes directly to your container.
</div>
</div>
<div class="domain-list" id="domains-list">
<div style="text-align:center;padding:40px;color:var(--ink-3);">Loading…</div>
</div>
</div>
<!-- ── TEMPLATES SHOWCASE VIEW ────────────────────────── -->
<div class="view" id="view-templates">
<div class="page-hd">
<div>
<div class="page-title">Starter Templates</div>
<div class="page-sub">Launch pre-configured application stacks, frontend frameworks, and API microservices in seconds</div>
</div>
<button class="btn btn-primary btn-sm" onclick="openDeployModal()">
<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg>
Deploy Custom App
</button>
</div>
<!-- Filter Bar -->
<div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-top:6px;">
<div class="filter-pill-row" id="tpl-filter-pills">
<div class="filter-pill active" onclick="filterTemplates('all', this)">All Stacks</div>
<div class="filter-pill" onclick="filterTemplates('frontend', this)">Frontend & SPAs</div>
<div class="filter-pill" onclick="filterTemplates('backend', this)">Backend APIs</div>
<div class="filter-pill" onclick="filterTemplates('static', this)">Static & Docs</div>
</div>
<div style="position:relative;width:240px;">
<input type="text" class="form-input" id="tpl-search" placeholder="Search templates…" oninput="onTemplateSearch(this.value)" style="padding-left:32px;font-size:12.5px;height:34px;">
<svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" style="position:absolute;left:10px;top:10px;color:var(--ink-3);"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
</div>
</div>
<!-- Showcase Grid -->
<div class="tpl-showcase-grid" id="tpl-showcase-container">
<!-- Rendered dynamically by loadTemplates() -->
</div>
<!-- Supported Stacks & Architecture Matrix -->
<div class="tech-matrix-card">
<div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;">
<div>
<div style="font-size:15px;font-weight:700;color:var(--ink-0);display:flex;align-items:center;gap:8px;">
<svg width="18" height="18" fill="none" stroke="var(--cyan)" stroke-width="2" viewBox="0 0 24 24"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg>
Supported Tech Stacks, Frameworks & Database Runtimes
</div>
<div style="font-size:12px;color:var(--ink-3);margin-top:3px;">Cosmos Orbit runs any workload in isolated OCI Docker containers with automated or custom Dockerfile execution</div>
</div>
<span style="font-family:var(--mono);font-size:11px;color:var(--cyan);background:rgba(56,189,248,0.1);padding:3px 8px;border-radius:6px;border:1px solid rgba(56,189,248,0.2);">Quota: 10 Ports (4100–4999)</span>
</div>
<div class="matrix-grid">
<!-- Frontend -->
<div class="matrix-item">
<div class="matrix-item-title">
<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
Frontend Frameworks
</div>
<ul class="matrix-item-list">
<li><strong>React, Vue 3, Svelte, Angular:</strong> Built via Node builder or Vite/Webpack, served statically through high-speed Nginx Alpine container (Port 80).</li>
<li><strong>Next.js / Nuxt / Astro:</strong> Supported in static output mode or Node.js SSR runtime (Port 3000).</li>
<li><strong>Static HTML5, CSS3, Tailwind:</strong> Zero-config Nginx container with Gzip compression and instant boot.</li>
</ul>
</div>
<!-- Backend -->
<div class="matrix-item">
<div class="matrix-item-title">
<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
Backend Runtimes & APIs
</div>
<ul class="matrix-item-list">
<li><strong>Node.js 20/22:</strong> Express, Fastify, NestJS, Koa, Hono with auto-detected <code style="font-family:var(--mono);font-size:10px;">PORT=3000</code>.</li>
<li><strong>Go 1.24+:</strong> Standard Library HTTP, Fiber, Gin, Chi built with multi-stage Alpine images (&lt;15MB, Port 8080).</li>
<li><strong>Python 3.11+:</strong> FastAPI, Flask, Django, Uvicorn, Gunicorn with auto-entrypoint discovery (Port 8000).</li>
<li><strong>Rust, Ruby, PHP, Java:</strong> 100% supported via custom repository <code style="font-family:var(--mono);font-size:10px;">Dockerfile</code>.</li>
</ul>
</div>
<!-- Databases -->
<div class="matrix-item">
<div class="matrix-item-title">
<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></svg>
Database & Storage Integration
</div>
<ul class="matrix-item-list">
<li><strong>Internal Cosmos ScyllaDB:</strong> Accessible to user apps on host port <code style="font-family:var(--mono);font-size:10px;">9042</code> (Cassandra CQL driver).</li>
<li><strong>Internal Cosmos Oort (S3):</strong> High-speed object storage on <code style="font-family:var(--mono);font-size:10px;">cosmos.linuxguy.space:9000</code> with 1-click snapshot backups.</li>
<li><strong>External Databases:</strong> Connect to any managed PostgreSQL, MySQL, Redis, MongoDB, Supabase, Neon via <code style="font-family:var(--mono);font-size:10px;">DATABASE_URL</code> env var.</li>
<li><strong>Dedicated DB Containers:</strong> Deploy Redis/Postgres container directly into your 10-port quota.</li>
</ul>
</div>
</div>
</div>
</div>
</div><!-- /#content -->
</div><!-- /#main -->
<!-- ─────────────────────────────────────────────────────────────── -->
<!-- MODAL: Deploy New App -->
<!-- ─────────────────────────────────────────────────────────────── -->
<div class="modal-bg" id="modal-deploy">
<div class="modal-box" style="max-width:700px;">
<div class="modal-hd">
<div>
<div class="modal-title">Deploy Application</div>
<div class="modal-sub">Launch a new container from Git or a starter template</div>
</div>
<button class="modal-close" onclick="closeModal('modal-deploy')">✕</button>
</div>
<div class="tab-row">
<button class="tab-btn active" id="tab-forge" onclick="switchTab('forge')">Forge Git</button>
<button class="tab-btn" id="tab-git" onclick="switchTab('git')">Custom URL</button>
<button class="tab-btn" id="tab-tpl" onclick="switchTab('tpl')">Templates</button>
</div>
<!-- Forge Repos -->
<div id="tc-forge">
<div class="form-group">
<label class="form-label">Select a Forge Repository</label>
<select class="forge-select" id="sel-forge-repo" onchange="onForgeRepoSelect(this.value)">
<option value="">Loading repositories…</option>
</select>
</div>
</div>
<!-- Custom Git URL -->
<div id="tc-git" style="display:none;">
<div class="form-group">
<label class="form-label">Git Repository URL</label>
<input type="url" class="form-input" id="inp-git-url" placeholder="https://github.com/you/repo.git">
<span class="form-hint">Public or private Git repository (HTTPS clone URL)</span>
</div>
</div>
<!-- Templates -->
<div id="tc-tpl" style="display:none;">
<div id="tpl-selected-notice" style="display:none;background:rgba(56,189,248,0.1);border:1px solid rgba(56,189,248,0.3);border-radius:8px;padding:8px 12px;margin-bottom:12px;font-size:12px;color:var(--cyan);display:flex;align-items:center;justify-content:space-between;">
<span>Selected Template: <strong id="tpl-selected-name">—</strong></span>
<button type="button" class="btn btn-ghost btn-sm" onclick="clearSelectedTpl()" style="padding:2px 8px;font-size:11px;">✕ Deselect</button>
</div>
<div class="template-grid" id="templates-list">
<div style="color:var(--ink-3);font-size:13px;grid-column:1/-1;">Loading templates…</div>
</div>
</div>
<!-- Common fields -->
<div style="display:grid;grid-template-columns:2fr 1fr;gap:14px;">
<div class="form-group">
<label class="form-label">Application Name</label>
<input type="text" class="form-input" id="inp-app-name" placeholder="my-web-app" pattern="[a-z0-9\-]+" required>
</div>
<div class="form-group">
<label class="form-label">Branch</label>
<input type="text" class="form-input" id="inp-branch" value="main">
</div>
</div>
<div class="form-group">
<label class="form-label">Environment Variables <span style="color:var(--ink-3)">(optional)</span></label>
<textarea class="form-textarea" id="inp-env" placeholder="NODE_ENV=production&#10;DATABASE_URL=postgres://..." rows="3"></textarea>
<span class="form-hint">One KEY=VALUE per line</span>
</div>
<div style="display:flex;justify-content:flex-end;gap:10px;">
<button class="btn btn-ghost" onclick="closeModal('modal-deploy')">Cancel</button>
<button class="btn btn-primary" id="btn-deploy" onclick="submitDeploy()">
<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M22 2L11 13"/><path d="M22 2L15 22 11 13 2 9l20-7z"/></svg>
Launch Application
</button>
</div>
</div>
</div>
<!-- ─────────────────────────────────────────────────────────────── -->
<!-- MODAL: Domain Manager -->
<!-- ─────────────────────────────────────────────────────────────── -->
<div class="modal-bg" id="modal-domain">
<div class="modal-box" style="max-width:580px;">
<div class="modal-hd">
<div>
<div class="modal-title" id="domain-modal-title">Custom Domain</div>
<div class="modal-sub">Connect your own domain to this application</div>
</div>
<button class="modal-close" onclick="closeModal('modal-domain')">✕</button>
</div>
<div class="form-group">
<label class="form-label">Domain Name</label>
<input type="text" class="form-input" id="inp-domain" placeholder="app.yourdomain.com">
<span class="form-hint">Enter your domain without http:// · Leave empty to remove mapping</span>
</div>
<div id="dns-instructions" style="display:none;">
<div style="font-size:12px;font-weight:600;color:var(--ink-2);margin-bottom:10px;">DNS Configuration</div>
<div class="dns-card">
<div class="dns-row">
<span class="dns-type">CNAME</span>
<span class="dns-name" id="dns-name">your-domain.com</span>
<span style="color:var(--ink-3);font-size:11px;">→</span>
<span class="dns-val" id="dns-value">orbit.yourdomain.com</span>
<button class="copy-btn" onclick="copyText(document.getElementById('dns-value').textContent)" title="Copy">
<svg width="11" height="11" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
</button>
</div>
<div style="font-size:11px;color:var(--ink-3);margin-top:10px;line-height:1.6;">
For apex domains (e.g. <code style="font-family:var(--mono)">example.com</code>), add an <strong>A record</strong> pointing to this server's IP address instead of a CNAME.
</div>
</div>
</div>
<div style="display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;">
<button class="btn btn-danger btn-sm" id="btn-remove-domain" onclick="removeDomain()" style="display:none;">Remove Domain</button>
<div style="display:flex;gap:10px;margin-left:auto;">
<button class="btn btn-ghost" onclick="closeModal('modal-domain')">Cancel</button>
<button class="btn btn-primary" id="btn-save-domain" onclick="saveDomain()">Save Domain</button>
</div>
</div>
</div>
</div>
<!-- ─────────────────────────────────────────────────────────────── -->
<!-- MODAL: App Logs -->
<!-- ─────────────────────────────────────────────────────────────── -->
<div class="modal-bg" id="modal-logs">
<div class="modal-box" style="max-width:880px;">
<div class="modal-hd">
<div>
<div class="modal-title" id="logs-title">Container Logs</div>
<div class="modal-sub" id="logs-sub" style="font-family:var(--mono)">—</div>
</div>
<div style="display:flex;gap:8px;align-items:center;">
<button class="btn btn-ghost btn-sm" onclick="refreshLogs()">↻ Refresh</button>
<button class="modal-close" onclick="closeModal('modal-logs')">✕</button>
</div>
</div>
<div class="terminal" id="terminal-out">Connecting…</div>
</div>
</div>
<!-- ─────────────────────────────────────────────────────────────── -->
<!-- MODAL: Env Vars Editor -->
<!-- ─────────────────────────────────────────────────────────────── -->
<div class="modal-bg" id="modal-env">
<div class="modal-box" style="max-width:580px;">
<div class="modal-hd">
<div>
<div class="modal-title" id="env-modal-title">Environment Variables</div>
<div class="modal-sub">Edit and save environment variables for this app</div>
</div>
<button class="modal-close" onclick="closeModal('modal-env')">✕</button>
</div>
<div class="form-group">
<label class="form-label">Variables <span style="color:var(--ink-3)">(KEY=VALUE per line)</span></label>
<textarea class="form-textarea" id="env-editor" rows="10" style="height:220px;"></textarea>
</div>
<div style="display:flex;justify-content:flex-end;gap:10px;">
<button class="btn btn-ghost" onclick="closeModal('modal-env')">Cancel</button>
<button class="btn btn-primary" onclick="saveEnv()">Save & Restart</button>
</div>
</div>
</div>
<!-- Toasts -->
<div id="toast-wrap"></div>
<script>
/* ─── STATE ────────────────────────────────────────────────── */
let allApps = [];
let currentView = 'apps';
let activeAppID = null; // for logs/env modals
let domainAppID = null; // for domain modal
let logsInterval = null;
/* ─── API ─────────────────────────────────────────────────── */
async function api(path, opts = {}) {
try {
const res = await fetch(path, opts);
if (res.status === 401) {
window.location.href = '/oort/login?next=/orbit';
return null;
}
const text = await res.text();
if (!text) return { success: true };
return JSON.parse(text);
} catch(e) {
console.error('API error:', e);
return null;
}
}
/* ─── TOAST ───────────────────────────────────────────────── */
function toast(msg, type = 'info') {
const w = document.getElementById('toast-wrap');
const el = document.createElement('div');
el.className = `toast toast-${type}`;
const icons = {
info: '<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>',
success: '<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><polyline points="20 6 9 17 4 12"/></svg>',
error: '<svg width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>'
};
el.innerHTML = (icons[type]||icons.info) + '<span>' + esc(msg) + '</span>';
w.appendChild(el);
setTimeout(() => el.remove(), 3800);
}
/* ─── ESCAPE ──────────────────────────────────────────────── */
function esc(s) {
return (s||'').replace(/[&<>"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
}
/* ─── UTILS ───────────────────────────────────────────────── */
function fmtDate(ts) {
if (!ts) return '—';
return new Date(ts * 1000).toLocaleDateString('en', {month:'short',day:'numeric',year:'numeric'});
}
function copyText(txt) {
navigator.clipboard.writeText(txt).then(() => toast('Copied!', 'success'));
}
/* ─── MODAL ───────────────────────────────────────────────── */
function openModal(id) { document.getElementById(id).classList.add('open'); }
function closeModal(id) {
document.getElementById(id).classList.remove('open');
if (id === 'modal-logs') {
clearInterval(logsInterval);
logsInterval = null;
activeAppID = null;
}
}
// Close modal on background click
document.querySelectorAll('.modal-bg').forEach(mb => {
mb.addEventListener('click', e => { if (e.target === mb) closeModal(mb.id); });
});
/* ─── SIDEBAR NAV ─────────────────────────────────────────── */
function switchView(name) {
// Update nav items
document.querySelectorAll('.nav-item[id^="nav-"]').forEach(el => el.classList.remove('active'));
const navEl = document.getElementById('nav-' + name);
if (navEl) navEl.classList.add('active');
// Update views
document.querySelectorAll('.view').forEach(v => v.classList.remove('active'));
const viewEl = document.getElementById('view-' + name);
if (viewEl) viewEl.classList.add('active');
currentView = name;
// Update topbar
const titles = {
apps: ['Applications','Your deployed container fleet'],
templates: ['Starter Templates','Pre-configured application stacks ready to deploy'],
domains: ['Custom Domains','Route traffic from your own domain']
};
const [t,s] = titles[name]||[name,''];
document.getElementById('topbar-title').textContent = t;
document.getElementById('topbar-sub').textContent = s;
// Load view data
if (name === 'apps') loadApps();
if (name === 'domains') renderDomains();
if (name === 'templates') renderTemplatesUI();
}
function toggleSidebar() {
document.getElementById('sidebar').classList.toggle('open');
}
/* ─── LOAD APPS ───────────────────────────────────────────── */
async function loadApps() {
const data = await api('/orbit/api/apps');
if (!data) return;
allApps = data.apps || [];
const portsUsed = data.ports_used || allApps.length;
const portQuota = data.port_quota || 10;
// Update sidebar quota
document.getElementById('quota-text').textContent = `${portsUsed}/${portQuota}`;
document.getElementById('quota-fill').style.width = `${Math.min(100, (portsUsed/portQuota)*100)}%`;
document.getElementById('badge-apps').textContent = allApps.length;
// Update stats
const running = allApps.filter(a => a.status === 'running').length;
let totalMem = 0;
allApps.forEach(a => { if (a.live_stats) totalMem += a.live_stats.mem_usage_mb || 0; });
const domains = allApps.filter(a => a.custom_domain).length;
document.getElementById('s-total').textContent = allApps.length;
document.getElementById('s-running').textContent = running;
document.getElementById('s-mem').textContent = totalMem > 0 ? `${totalMem.toFixed(0)} MB` : '—';
document.getElementById('s-domains').textContent = domains;
// Domain badge
if (domains > 0) {
document.getElementById('badge-domains').textContent = domains;
document.getElementById('badge-domains').style.display = '';
}
// User name
if (allApps.length > 0 && allApps[0].owner_email) {
const em = allApps[0].owner_email;
const name = em.split('@')[0];
document.getElementById('user-name').textContent = name;
document.getElementById('user-avatar').textContent = name[0].toUpperCase();
}
renderApps();
}
/* ─── RENDER APPS ─────────────────────────────────────────── */
function renderApps() {
const grid = document.getElementById('apps-grid');
if (allApps.length === 0) {
grid.innerHTML = `
<div class="empty-state">
<svg width="52" height="52" fill="none" stroke="#38bdf8" stroke-width="1.2" viewBox="0 0 24 24" style="opacity:.6">
<circle cx="12" cy="12" r="10"/><path d="M12 8v8M8 12h8"/>
</svg>
<h3>No Applications Yet</h3>
<p>Deploy your first containerized application from Forge Git, a public Git URL, or a ready-to-go template.</p>
<button class="btn btn-primary" onclick="openDeployModal()">
<svg width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
Deploy First App
</button>
</div>`;
return;
}
grid.innerHTML = allApps.map(app => {
const isRun = app.status === 'running';
const isBuild = app.status === 'building';
const cpuStr = app.live_stats ? `${app.live_stats.cpu_percent.toFixed(1)}%` : '—';
const memStr = app.live_stats ? `${app.live_stats.mem_usage_mb.toFixed(0)} MB` : '—';
const domainBadge = app.custom_domain
? `<div class="domain-tag"><svg width="10" height="10" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>${esc(app.custom_domain)}</div>`
: '';
return `
<div class="app-card" data-id="${app.app_id}">
<div class="app-card-head">
<div class="app-name-row">
<div class="app-name">${esc(app.name)}</div>
<div class="app-meta">
<span>:${app.exposed_port}</span>
<span>·</span>
<span>${esc(app.branch||'main')}</span>
${app.build_type && app.build_type !== 'detecting' ? `<span>·</span><span>${esc(app.build_type)}</span>` : ''}
</div>
</div>
<span class="pill pill-${app.status}">
<span class="pill-dot"></span>
${app.status}
</span>
</div>
${domainBadge}
<div class="app-metrics">
<div class="metric"><span class="metric-lbl">CPU</span><span class="metric-val">${cpuStr}</span></div>
<div class="metric"><span class="metric-lbl">Memory</span><span class="metric-val">${memStr}</span></div>
</div>
<div class="app-actions">
<div class="app-actions-left">
<button class="btn btn-ghost btn-xs" onclick="openLogs('${app.app_id}','${esc(app.name)}')">
<svg width="11" height="11" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>
Logs
</button>
${isRun
? `<button class="btn btn-ghost btn-xs" onclick="appAction('${app.app_id}','restart')">↺ Restart</button>
<button class="btn btn-ghost btn-xs" style="color:#fbbf24;border-color:rgba(245,158,11,0.3)" onclick="appAction('${app.app_id}','stop')">■ Stop</button>`
: `<button class="btn btn-success btn-xs" onclick="appAction('${app.app_id}','start')">▶ Start</button>
<button class="btn btn-ghost btn-xs" onclick="appAction('${app.app_id}','rebuild')">⚙ Rebuild</button>`
}
<button class="btn btn-ghost btn-xs" onclick="openEnvModal('${app.app_id}','${esc(app.name)}')" title="Environment Variables">
<svg width="11" height="11" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>
Env
</button>
</div>
<div class="app-actions-right">
<button class="btn btn-ghost btn-xs" onclick="openDomainModal('${app.app_id}','${esc(app.name)}','${esc(app.custom_domain||'')}')" title="Custom Domain">
<svg width="11" height="11" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
Domain
</button>
${isRun ? `<a class="btn btn-ghost btn-xs" style="color:var(--cyan);border-color:rgba(56,189,248,0.25)" href="${esc(app.proxy_url||`/orbit/proxy/${app.app_id}/`)}" target="_blank">Open ↗</a>` : ''}
<button class="btn btn-danger btn-xs" onclick="deleteApp('${app.app_id}','${esc(app.name)}')">✕</button>
</div>
</div>
</div>`;
}).join('');
}
/* ─── DOMAINS VIEW ────────────────────────────────────────── */
function renderDomains() {
const list = document.getElementById('domains-list');
document.getElementById('server-host').textContent = window.location.hostname;
const withDomains = allApps.filter(a => a.custom_domain);
if (withDomains.length === 0) {
list.innerHTML = `
<div class="empty-state">
<svg width="44" height="44" fill="none" stroke="#38bdf8" stroke-width="1.2" viewBox="0 0 24 24" style="opacity:.6"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
<h3>No Custom Domains</h3>
<p>Go to an application and click the <strong>Domain</strong> button to map your own domain.</p>
<button class="btn btn-ghost" onclick="switchView('apps')">View Applications</button>
</div>`;
return;
}
list.innerHTML = withDomains.map(a => `
<div class="domain-row">
<div style="width:10px;height:10px;border-radius:50%;background:${a.status==='running'?'#34d399':'#94a3b8'};box-shadow:${a.status==='running'?'0 0 6px #34d399':''};flex-shrink:0;"></div>
<div class="domain-row-info">
<div class="domain-row-app">${esc(a.name)}</div>
<div class="domain-row-addr">${esc(a.custom_domain)}</div>
</div>
<div class="domain-row-actions">
<a class="btn btn-ghost btn-sm" href="http://${esc(a.custom_domain)}" target="_blank">Open ↗</a>
<button class="btn btn-ghost btn-sm" onclick="openDomainModal('${a.app_id}','${esc(a.name)}','${esc(a.custom_domain)}')">Edit</button>
</div>
</div>
`).join('');
}
/* ─── TEMPLATES CATALOG & STATE ───────────────────────────── */
const DEFAULT_TEMPLATES = [
{
id: "node-starter",
name: "Node.js & Express API",
category: "backend",
tech: "Node.js 20",
description: "High-performance REST server with Express routing, CORS, and JSON error handling",
icon: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#22c55e" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>`,
repo_url: "http://127.0.0.1:3000/admin/node-express-starter.git",
branch: "main",
internal_port: 3000,
features: ["Express 4.x", "JSON APIs", "Zero-config Docker", "Healthcheck"]
},
{
id: "go-server",
name: "Go Lightweight Web Server",
category: "backend",
tech: "Go 1.24",
description: "Ultra-fast compiled HTTP server in under 15MB Alpine container with zero dependencies",
icon: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#38bdf8" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M8 12h8"/><path d="M12 8v8"/></svg>`,
repo_url: "http://127.0.0.1:3000/admin/go-web-starter.git",
branch: "main",
internal_port: 8080,
features: ["Standard Library HTTP", "15MB Image", "Instant Boot", "High Concurrency"]
},
{
id: "python-fastapi",
name: "Python FastAPI",
category: "backend",
tech: "Python 3.11",
description: "Modern asynchronous web framework with automatic Swagger & OpenAPI documentation",
icon: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#f59e0b" stroke-width="2"><path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm1 14.93V17a1 1 0 0 1-2 0v-.07A7 7 0 0 1 5.07 11H5a1 1 0 0 1 0-2h.07A7 7 0 0 1 11 5.07V5a1 1 0 0 1 2 0v.07A7 7 0 0 1 18.93 11H19a1 1 0 0 1 0 2h-.07A7 7 0 0 1 13 16.93z"/></svg>`,
repo_url: "http://127.0.0.1:3000/admin/python-fastapi-starter.git",
branch: "main",
internal_port: 8000,
features: ["FastAPI + Uvicorn", "Auto OpenAPI Docs", "Pydantic V2", "Async Endpoints"]
},
{
id: "static-landing",
name: "Static HTML5 / CSS3 Portal",
category: "static",
tech: "HTML5 / Nginx",
description: "Nginx Alpine container hosting static documentation, landing pages or portfolios",
icon: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#ec4899" stroke-width="2"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg>`,
repo_url: "http://127.0.0.1:3000/admin/static-landing-portal.git",
branch: "main",
internal_port: 80,
features: ["Nginx Alpine", "Gzip Compressed", "Ultra-low RAM (<10MB)", "Dark Theme"]
},
{
id: "react-vite",
name: "React SPA / Vite Portal",
category: "frontend",
tech: "React 19 / Vite",
description: "Modern Single Page App build pipeline deploying production static bundles via Nginx",
icon: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#06b6d4" stroke-width="2"><ellipse cx="12" cy="12" rx="10" ry="4" transform="rotate(30 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" transform="rotate(90 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" transform="rotate(150 12 12)"/><circle cx="12" cy="12" r="2"/></svg>`,
repo_url: "http://127.0.0.1:3000/admin/static-landing-portal.git",
branch: "main",
internal_port: 80,
features: ["React 19", "Vite Buildpack", "Client-Side Routing", "Nginx Edge"]
},
{
id: "python-flask",
name: "Python Flask Microservice",
category: "backend",
tech: "Flask / WSGI",
description: "Lightweight WSGI Python microservice suitable for data processing and quick web endpoints",
icon: `<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#a855f7" stroke-width="2"><path d="M10 2v7.31M14 9.3V1.99M8.5 2h7M14 9.3a6.5 6.5 0 1 1-4 0"/></svg>`,
repo_url: "http://127.0.0.1:3000/admin/python-fastapi-starter.git",
branch: "main",
internal_port: 8000,
features: ["Flask 3.x", "Lightweight WSGI", "Dynamic Routing", "Python 3.11"]
}
];
let cachedTemplates = DEFAULT_TEMPLATES;
let selectedTemplateObj = null;
let currentTplCategory = 'all';
let currentTplSearch = '';
function renderTemplatesUI() {
const modalList = document.getElementById('templates-list');
const showcaseContainer = document.getElementById('tpl-showcase-container');
// Filter templates for showcase view
let filtered = cachedTemplates;
if (currentTplCategory !== 'all') {
filtered = filtered.filter(t => t.category === currentTplCategory);
}
if (currentTplSearch) {
const q = currentTplSearch.toLowerCase();
filtered = filtered.filter(t => (t.name||'').toLowerCase().includes(q) || (t.description||'').toLowerCase().includes(q) || (t.tech||'').toLowerCase().includes(q));
}
// 1. Render in Deploy Modal
if (modalList) {
modalList.innerHTML = cachedTemplates.map(t => {
const isSel = selectedTemplateObj && selectedTemplateObj.id === t.id;
const pillClass = t.category === 'frontend' ? 'tpl-pill-cyan' : t.category === 'backend' ? 'tpl-pill-green' : 'tpl-pill-purple';
return `
<div class="tpl-card ${isSel ? 'selected' : ''}" id="tpl-card-${t.id}" onclick="selectTplById('${t.id}')">
<div class="tpl-card-top">
<div class="tpl-name">
<span>${t.icon || ''}</span>
<span>${esc(t.name)}</span>
</div>
<span class="tpl-pill ${pillClass}">${esc(t.tech || t.category)}</span>
</div>
<div class="tpl-desc">${esc(t.description)}</div>
<div style="display:flex;align-items:center;justify-content:space-between;margin-top:8px;">
<span class="tpl-port-tag">Port :${t.internal_port || 8080}</span>
<span style="font-size:11px;color:var(--cyan);font-weight:600;">${isSel ? '✓ Selected' : 'Select →'}</span>
</div>
</div>`;
}).join('');
}
// 2. Render in Showcase View
if (showcaseContainer) {
if (filtered.length === 0) {
showcaseContainer.innerHTML = '<div style="color:var(--ink-3);font-size:13px;grid-column:1/-1;text-align:center;padding:40px;">No templates found matching your search.</div>';
} else {
showcaseContainer.innerHTML = filtered.map(t => {
const pillClass = t.category === 'frontend' ? 'tpl-pill-cyan' : t.category === 'backend' ? 'tpl-pill-green' : 'tpl-pill-purple';
return `
<div class="tpl-showcase-card">
<div>
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;">
<div style="display:flex;align-items:center;gap:10px;">
<div style="background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.08);padding:9px;border-radius:10px;">${t.icon || ''}</div>
<div>
<div style="font-size:15px;font-weight:700;color:var(--ink-0);">${esc(t.name)}</div>
<div style="font-size:11.5px;color:var(--ink-3);margin-top:2px;">${esc(t.tech || '')} • Port :${t.internal_port || 8080}</div>
</div>
</div>
<span class="tpl-pill ${pillClass}">${esc(t.category)}</span>
</div>
<div style="font-size:12.5px;color:var(--ink-2);line-height:1.55;margin-bottom:12px;">${esc(t.description)}</div>
<div class="tpl-tag-row">
${(t.features || []).map(f => `<span class="tpl-tag-item">${esc(f)}</span>`).join('')}
</div>
</div>
<div style="margin-top:18px;padding-top:14px;border-top:1px solid rgba(255,255,255,0.06);display:flex;justify-content:space-between;align-items:center;">
<span style="font-family:var(--mono);font-size:11px;color:var(--ink-3);">Zero-Config</span>
<button class="btn btn-primary btn-sm" onclick="launchTemplateFromShowcase('${t.id}')">
<svg width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M22 2L11 13"/><path d="M22 2L15 22 11 13 2 9l20-7z"/></svg>
Deploy Template
</button>
</div>
</div>`;
}).join('');
}
}
}
function filterTemplates(cat, el) {
currentTplCategory = cat;
document.querySelectorAll('#tpl-filter-pills .filter-pill').forEach(p => p.classList.remove('active'));
if (el) el.classList.add('active');
renderTemplatesUI();
}
function onTemplateSearch(val) {
currentTplSearch = (val || '').trim();
renderTemplatesUI();
}
function selectTplById(id) {
const t = cachedTemplates.find(x => x.id === id);
if (!t) return;
selectedTemplateObj = t;
document.querySelectorAll('.tpl-card').forEach(c => c.classList.remove('selected'));
const card = document.getElementById('tpl-card-' + id);
if (card) card.classList.add('selected');
const notice = document.getElementById('tpl-selected-notice');
const nameEl = document.getElementById('tpl-selected-name');
if (notice && nameEl) {
nameEl.textContent = `${t.name} (${t.tech || ''})`;
notice.style.display = 'flex';
}
document.getElementById('inp-app-name').value = t.name.toLowerCase().replace(/[^a-z0-9]/g,'-').slice(0,25);
document.getElementById('inp-git-url').value = t.repo_url;
document.getElementById('inp-branch').value = t.branch || 'main';
toast(`Template selected: ${t.name}. Click "Launch Application" below to deploy!`, 'success');
}
function clearSelectedTpl() {
selectedTemplateObj = null;
document.querySelectorAll('.tpl-card').forEach(c => c.classList.remove('selected'));
const notice = document.getElementById('tpl-selected-notice');
if (notice) notice.style.display = 'none';
document.getElementById('inp-git-url').value = '';
}
function launchTemplateFromShowcase(id) {
openDeployModal();
switchTab('tpl');
selectTplById(id);
}
/* ─── DEPLOY MODAL ────────────────────────────────────────── */
function openDeployModal() {
openModal('modal-deploy');
loadForgeRepos();
loadTemplates();
}
function switchTab(tab) {
['forge','git','tpl'].forEach(t => {
document.getElementById('tab-'+t).classList.toggle('active', t===tab);
document.getElementById('tc-'+t).style.display = t===tab ? 'block' : 'none';
});
if (tab === 'tpl') {
loadTemplates();
}
}
async function loadForgeRepos() {
const sel = document.getElementById('sel-forge-repo');
sel.innerHTML = '<option value="">Loading Forge repositories…</option>';
const res = await api('/orbit/api/forge/repos');
if (res && res.repos && res.repos.length > 0) {
sel.innerHTML = '<option value="">— Select a repository —</option>' +
res.repos.map(r => `<option value="${esc(r.clone_url||r.html_url)}" data-name="${esc(r.name)}">${esc(r.name)} (${esc(r.default_branch||'main')})</option>`).join('');
} else {
sel.innerHTML = '<option value="">No Forge repositories found. Use Custom URL tab.</option>';
}
}
function onForgeRepoSelect(url) {
const sel = document.getElementById('sel-forge-repo');
const opt = sel.options[sel.selectedIndex];
const name = opt.getAttribute('data-name');
if (name) document.getElementById('inp-app-name').value = name.toLowerCase().replace(/[^a-z0-9]/g,'-');
}
async function loadTemplates() {
renderTemplatesUI();
try {
const res = await api('/orbit/api/templates');
if (res && res.templates && res.templates.length > 0) {
cachedTemplates = res.templates.map(rt => {
const d = DEFAULT_TEMPLATES.find(dt => dt.id === rt.id) || {};
return { ...d, ...rt };
});
renderTemplatesUI();
}
} catch(e) {
console.warn('API templates error:', e);
}
}
async function submitDeploy() {
const name = document.getElementById('inp-app-name').value.trim();
const branch = document.getElementById('inp-branch').value.trim() || 'main';
let repoURL = '';
const activeTab = document.querySelector('.tab-btn.active').id.replace('tab-','');
if (activeTab === 'forge') {
repoURL = document.getElementById('sel-forge-repo').value;
} else if (activeTab === 'tpl') {
repoURL = (selectedTemplateObj && selectedTemplateObj.repo_url) || document.getElementById('inp-git-url').value.trim();
} else {
repoURL = document.getElementById('inp-git-url').value.trim();
}
if (!name) { toast('Application name is required', 'error'); return; }
if (!repoURL) { toast('Please select or enter a Git repository URL', 'error'); return; }
// Parse env vars
const envText = document.getElementById('inp-env').value;
const envVars = {};
envText.split('\n').forEach(line => {
line = line.trim();
if (line && line.includes('=')) {
const i = line.indexOf('=');
envVars[line.slice(0,i).trim()] = line.slice(i+1).trim();
}
});
const btn = document.getElementById('btn-deploy');
btn.disabled = true;
btn.textContent = 'Launching…';
const res = await api('/orbit/api/apps', {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({ name, repo_url: repoURL, branch, env_vars: envVars })
});
btn.disabled = false;
btn.innerHTML = '<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M22 2L11 13"/><path d="M22 2L15 22 11 13 2 9l20-7z"/></svg> Launch Application';
if (res && res.success) {
closeModal('modal-deploy');
toast('Deployment initiated! Build is starting…', 'success');
await loadApps();
openLogs(res.app_id, name);
} else if (res && res.error === 'port_limit_exceeded') {
toast('Port limit reached (10/10). Delete an existing app first.', 'error');
} else {
toast((res && res.error) || 'Failed to launch application', 'error');
}
}
/* ─── APP ACTIONS ─────────────────────────────────────────── */
async function appAction(appID, action) {
const labels = { start:'Starting…', stop:'Stopping…', restart:'Restarting…', rebuild:'Rebuilding…' };
toast(labels[action] || `${action}…`);
const res = await api(`/orbit/api/apps/${appID}/action`, {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({ action })
});
if (res && res.success) {
toast(`${action} succeeded`, 'success');
await loadApps();
} else {
toast((res && res.error) || `Failed to ${action}`, 'error');
}
}
async function deleteApp(appID, name) {
if (!confirm(`Delete application "${name}"? This stops and removes the container permanently.`)) return;
toast('Deleting…');
const res = await api(`/orbit/api/apps/${appID}`, { method: 'DELETE' });
if (res && res.success) {
toast(`"${name}" deleted`, 'success');
await loadApps();
} else {
toast((res && res.error) || 'Delete failed', 'error');
}
}
/* ─── LOGS ────────────────────────────────────────────────── */
function openLogs(appID, name) {
activeAppID = appID;
document.getElementById('logs-title').textContent = `${name} — Logs`;
document.getElementById('logs-sub').textContent = `app_id: ${appID}`;
document.getElementById('terminal-out').innerHTML = '<span style="color:#64748b">Connecting to log stream…</span>';
openModal('modal-logs');
clearInterval(logsInterval);
refreshLogs();
logsInterval = setInterval(refreshLogs, 2000);
}
function colorizeLog(text) {
return text
.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;')
.replace(/\[ORBIT\]/g, '<span style="color:#38bdf8;font-weight:700">[ORBIT]</span>')
.replace(/\[GIT\]/g, '<span style="color:#a78bfa;font-weight:700">[GIT]</span>')
.replace(/\[DETECT\]/g, '<span style="color:#34d399;font-weight:700">[DETECT]</span>')
.replace(/\[TAR\]/g, '<span style="color:#94a3b8">[TAR]</span>')
.replace(/\[DOCKER\]/g, '<span style="color:#38bdf8;font-weight:700">[DOCKER]</span>')
.replace(/\[ORCHESTRATOR\]/g, '<span style="color:#10b981;font-weight:700">[ORCHESTRATOR]</span>')
.replace(/\[GIT ERROR\]/g, '<span style="color:#f87171;font-weight:700">[GIT ERROR]</span>')
.replace(/\[BUILD ERROR\]/g, '<span style="color:#f87171;font-weight:700">[BUILD ERROR]</span>')
.replace(/\[DOCKER ERROR\]/g, '<span style="color:#f87171;font-weight:700">[DOCKER ERROR]</span>')
.replace(/\[ORCHESTRATOR ERROR\]/g, '<span style="color:#f87171;font-weight:700">[ORCHESTRATOR ERROR]</span>')
.replace(/\[TAR ERROR\]/g, '<span style="color:#f87171;font-weight:700">[TAR ERROR]</span>')
.replace(/(completed|successfully|healthy|running)/gi, '<span style="color:#34d399">$1</span>')
.replace(/(failed|error|refused)/gi, '<span style="color:#f87171">$1</span>')
.replace(/(Step \d+\/\d+)/g, '<span style="color:#fbbf24">$1</span>');
}
async function refreshLogs() {
if (!activeAppID) return;
try {
const res = await fetch(`/orbit/api/apps/${activeAppID}/logs`);
const appStatus = res.headers.get('X-App-Status') || '';
const text = await res.text();
const el = document.getElementById('terminal-out');
el.innerHTML = colorizeLog(text || '[ORBIT] No output yet.');
el.scrollTop = el.scrollHeight;
// Update sub-label with current status
const statusColors = { running:'#34d399', failed:'#f87171', stopped:'#94a3b8', building:'#fbbf24' };
const col = statusColors[appStatus] || '#94a3b8';
document.getElementById('logs-sub').innerHTML =
`app_id: ${activeAppID} &nbsp;·&nbsp; <span style="color:${col};font-weight:700">${appStatus||'…'}</span>`;
// Stop polling when build/deploy is done (not actively building)
if (appStatus && appStatus !== 'building') {
clearInterval(logsInterval);
logsInterval = null;
// Refresh app list to show new status
await loadApps();
if (appStatus === 'running') {
toast('Deployment successful! Application is running.', 'success');
} else if (appStatus === 'failed') {
toast('Deployment failed. Check the logs for details.', 'error');
}
}
} catch(e) {
console.error('Log fetch error:', e);
}
}
/* ─── ENV VARS ────────────────────────────────────────────── */
function openEnvModal(appID, name) {
activeAppID = appID;
document.getElementById('env-modal-title').textContent = `${name} — Environment`;
const app = allApps.find(a => a.app_id === appID);
const vars = app && app.env_vars ? app.env_vars : {};
document.getElementById('env-editor').value = Object.entries(vars).map(([k,v]) => `${k}=${v}`).join('\n');
openModal('modal-env');
}
async function saveEnv() {
if (!activeAppID) return;
const text = document.getElementById('env-editor').value;
const envVars = {};
text.split('\n').forEach(line => {
line = line.trim();
if (line && line.includes('=')) {
const i = line.indexOf('=');
envVars[line.slice(0,i).trim()] = line.slice(i+1).trim();
}
});
const res = await api(`/orbit/api/apps/${activeAppID}/env`, {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({ env_vars: envVars })
});
if (res && res.success) {
toast('Environment variables saved. Restart the app to apply.', 'success');
closeModal('modal-env');
await loadApps();
} else {
toast((res && res.error) || 'Failed to save env vars', 'error');
}
}
/* ─── DOMAIN MODAL ────────────────────────────────────────── */
function openDomainModal(appID, name, currentDomain) {
domainAppID = appID;
document.getElementById('domain-modal-title').textContent = `${name} — Custom Domain`;
document.getElementById('inp-domain').value = currentDomain || '';
document.getElementById('dns-instructions').style.display = 'none';
document.getElementById('btn-remove-domain').style.display = currentDomain ? 'flex' : 'none';
document.getElementById('dns-value').textContent = window.location.hostname;
document.getElementById('dns-name').textContent = currentDomain || 'your-domain.com';
if (currentDomain) {
document.getElementById('dns-instructions').style.display = 'block';
}
openModal('modal-domain');
// Show DNS instructions on domain input change
document.getElementById('inp-domain').oninput = function() {
const d = this.value.trim();
document.getElementById('dns-instructions').style.display = d ? 'block' : 'none';
document.getElementById('dns-name').textContent = d || 'your-domain.com';
};
}
async function saveDomain() {
if (!domainAppID) return;
const domain = document.getElementById('inp-domain').value.trim().toLowerCase();
const btn = document.getElementById('btn-save-domain');
btn.disabled = true; btn.textContent = 'Saving…';
const res = await api(`/orbit/api/apps/${domainAppID}/domain`, {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({ domain })
});
btn.disabled = false; btn.textContent = 'Save Domain';
if (res && res.success) {
toast(domain ? `Domain "${domain}" mapped! Set your DNS CNAME to ${window.location.hostname}` : 'Custom domain removed', 'success');
closeModal('modal-domain');
await loadApps();
if (currentView === 'domains') renderDomains();
} else if (res && res.error === 'domain_conflict') {
toast('This domain is already mapped to another app', 'error');
} else {
toast((res && res.error) || 'Failed to update domain', 'error');
}
}
async function removeDomain() {
document.getElementById('inp-domain').value = '';
await saveDomain();
}
/* ─── REFRESH ALL ─────────────────────────────────────────── */
async function refreshAll() {
await loadApps();
if (currentView === 'domains') renderDomains();
toast('Refreshed', 'success');
}
/* ─── BACKGROUND CANVAS ───────────────────────────────────── */
(function initSpaceCanvas() {
const cv = document.getElementById('spaceCanvas');
if (!cv) return;
const ctx = cv.getContext('2d');
let W, H, pts = [], rings = [];
function resize() {
W = cv.width = window.innerWidth;
H = cv.height = window.innerHeight;
}
window.addEventListener('resize', resize);
resize();
// Particles
for (let i = 0; i < 80; i++) {
pts.push({
x: Math.random() * W, y: Math.random() * H,
vx: (Math.random()-.5)*.4, vy: (Math.random()-.5)*.4,
r: Math.random() < .2 ? 1.8 : 1.1,
hue: Math.random() > .5 ? 195 : 280,
a: .2 + Math.random()*.5
});
}
// Orbital rings (decorative background circles)
for (let i = 0; i < 3; i++) {
rings.push({
cx: Math.random() * W, cy: Math.random() * H,
rx: 80 + Math.random()*180, ry: 20 + Math.random()*50,
angle: Math.random() * Math.PI,
speed: (Math.random()-.5)*0.002,
a: .03 + Math.random()*.05
});
}
let mouse = { x: -999, y: -999 };
window.addEventListener('mousemove', e => { mouse.x = e.clientX; mouse.y = e.clientY; });
function draw() {
ctx.clearRect(0, 0, W, H);
// Orbital rings
rings.forEach(ring => {
ring.angle += ring.speed;
ctx.save();
ctx.translate(ring.cx, ring.cy);
ctx.rotate(ring.angle);
ctx.strokeStyle = `rgba(56,189,248,${ring.a})`;
ctx.lineWidth = .8;
ctx.beginPath();
ctx.ellipse(0, 0, ring.rx, ring.ry, 0, 0, Math.PI*2);
ctx.stroke();
ctx.restore();
});
// Constellation links
for (let i = 0; i < pts.length; i++) {
for (let j = i+1; j < pts.length; j++) {
const dx = pts[i].x - pts[j].x, dy = pts[i].y - pts[j].y;
const d = Math.sqrt(dx*dx + dy*dy);
if (d < 120) {
ctx.strokeStyle = `rgba(56,189,248,${(1-d/120)*.12})`;
ctx.lineWidth = .7;
ctx.beginPath();
ctx.moveTo(pts[i].x, pts[i].y);
ctx.lineTo(pts[j].x, pts[j].y);
ctx.stroke();
}
}
}
// Particles
for (const p of pts) {
p.x += p.vx; p.y += p.vy;
if (p.x < 0) p.x = W; if (p.x > W) p.x = 0;
if (p.y < 0) p.y = H; if (p.y > H) p.y = 0;
// Mouse repulsion
const mdx = mouse.x - p.x, mdy = mouse.y - p.y;
const md = Math.sqrt(mdx*mdx + mdy*mdy);
if (md < 120) {
p.x -= (mdx/md) * (1-md/120) * 1.2;
p.y -= (mdy/md) * (1-md/120) * 1.2;
}
ctx.fillStyle = `hsla(${p.hue},80%,70%,${p.a})`;
ctx.beginPath();
ctx.arc(p.x, p.y, p.r, 0, Math.PI*2);
ctx.fill();
}
requestAnimationFrame(draw);
}
draw();
})();
/* ─── BOOT ────────────────────────────────────────────────── */
loadApps();
loadTemplates();
setInterval(loadApps, 8000);
// Mobile menu button visibility
if (window.innerWidth <= 768) {
document.getElementById('menu-toggle').style.display = 'flex';
}
window.addEventListener('resize', () => {
document.getElementById('menu-toggle').style.display = window.innerWidth <= 768 ? 'flex' : 'none';
if (window.innerWidth > 768) document.getElementById('sidebar').classList.remove('open');
});
</script>
</body>
</html>