Function bodies 63 total
timingSafeEqual function · typescript · L4-L15 (12 LOC)app/api/admin/leads/route.ts
function timingSafeEqual(a: string, b: string): boolean {
if (a.length !== b.length) {
return false
}
let result = 0
for (let i = 0; i < a.length; i++) {
result |= a.charCodeAt(i) ^ b.charCodeAt(i)
}
return result === 0
}verifyAdminAuth function · typescript · L18-L35 (18 LOC)app/api/admin/leads/route.ts
function verifyAdminAuth(request: NextRequest): boolean {
const adminToken = process.env.ADMIN_TOKEN
if (!adminToken || adminToken.length < 32) {
console.error('[SECURITY] ADMIN_TOKEN not set or too short')
return false
}
// Get token from header (NOT from query params or body)
const providedToken = request.headers.get('X-Admin-Token')
if (!providedToken) {
return false
}
// Use timing-safe comparison
return timingSafeEqual(providedToken, adminToken)
}getEnterpriseLeads function · typescript · L38-L54 (17 LOC)app/api/admin/leads/route.ts
function getEnterpriseLeads() {
// In production:
// const leads = db.prepare("SELECT * FROM enterprise_leads ORDER BY created_at DESC LIMIT 100").all()
return [
{
id: 1,
companyName: 'Example Corp',
role: 'CTO',
email: '[email protected]',
cloudProviders: 'AWS, GCP',
monthlySpend: '$50k-100k',
message: 'Interested in enterprise plan',
created_at: new Date().toISOString(),
}
]
}GET function · typescript · L56-L113 (58 LOC)app/api/admin/leads/route.ts
export async function GET(request: NextRequest) {
try {
// Verify authentication
if (!verifyAdminAuth(request)) {
// Log unauthorized access attempt
console.warn('[SECURITY] Unauthorized admin access attempt', {
ip: request.headers.get('x-forwarded-for') || 'unknown',
userAgent: request.headers.get('user-agent'),
timestamp: new Date().toISOString(),
})
return NextResponse.json(
{ error: 'Unauthorized' },
{
status: 401,
headers: {
'WWW-Authenticate': 'Bearer realm="Admin Area"',
},
}
)
}
// Get leads from database
const leads = getEnterpriseLeads()
// Sanitize data before sending (remove sensitive info if any)
const sanitizedLeads = leads.map(lead => ({
...lead,
// Don't send internal IDs, tokens, or raw user agents
}))
return NextResponse.json(
{
success: true,
leads: sanitizedLeads,
POST function · typescript · L116-L118 (3 LOC)app/api/admin/leads/route.ts
export async function POST() {
return NextResponse.json({ error: 'Method not allowed' }, { status: 405 })
}PUT function · typescript · L120-L122 (3 LOC)app/api/admin/leads/route.ts
export async function PUT() {
return NextResponse.json({ error: 'Method not allowed' }, { status: 405 })
}DELETE function · typescript · L124-L126 (3 LOC)app/api/admin/leads/route.ts
export async function DELETE() {
return NextResponse.json({ error: 'Method not allowed' }, { status: 405 })
}Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
saveToDatabase function · typescript · L5-L20 (16 LOC)app/api/enterprise/route.ts
function saveToDatabase(data: any) {
// In production, use prepared statements:
// db.prepare("INSERT INTO enterprise_leads (company_name, role, email, cloud_providers, monthly_spend, message) VALUES (?, ?, ?, ?, ?, ?)")
// .run(data.companyName, data.role, data.email, data.cloudProviders, data.monthlySpend, data.message || null)
console.log('[ENTERPRISE LEAD]', {
companyName: data.companyName,
role: data.role,
email: data.email,
cloudProviders: data.cloudProviders,
monthlySpend: data.monthlySpend,
timestamp: new Date().toISOString(),
})
return { success: true, id: Date.now() }
}POST function · typescript · L22-L114 (93 LOC)app/api/enterprise/route.ts
export async function POST(request: NextRequest) {
try {
// Parse request body with size limit
const contentLength = request.headers.get('content-length')
if (contentLength && parseInt(contentLength) > 10000) {
return NextResponse.json(
{ error: 'Payload too large' },
{ status: 413 }
)
}
const body = await request.json()
// Validate input against schema
const validation = validateInput(EnterpriseLeadSchema, body)
if (!validation.success) {
return NextResponse.json(
{ error: validation.error },
{ status: 400 }
)
}
const data = validation.data
// Additional security checks
const allValues = [
data.companyName,
data.role,
data.email,
data.cloudProviders,
data.monthlySpend,
data.message || '',
].join(' ')
if (containsSQLInjection(allValues)) {
console.warn('[SECURITY] Potential SQL injection attempt detected', {
ip: reGET function · typescript · L117-L119 (3 LOC)app/api/enterprise/route.ts
export async function GET() {
return NextResponse.json({ error: 'Method not allowed' }, { status: 405 })
}PUT function · typescript · L121-L123 (3 LOC)app/api/enterprise/route.ts
export async function PUT() {
return NextResponse.json({ error: 'Method not allowed' }, { status: 405 })
}DELETE function · typescript · L125-L127 (3 LOC)app/api/enterprise/route.ts
export async function DELETE() {
return NextResponse.json({ error: 'Method not allowed' }, { status: 405 })
}GET function · typescript · L3-L26 (24 LOC)app/api/health/route.ts
export async function GET() {
const API_URL = process.env.REFINEX_API_URL || 'http://localhost:8000';
const ADMIN_TOKEN = process.env.REFINEX_ADMIN_TOKEN || '';
try {
const res = await fetch(`${API_URL}/v1/trinity/health`, {
headers: { 'X-Admin-Token': ADMIN_TOKEN },
next: { revalidate: 30 },
});
if (!res.ok) {
return NextResponse.json({ ok: false }, { status: 200 });
}
const data = await res.json();
return NextResponse.json({
ok: data.issues_detected === 0,
checks: data.checks_run ?? 0,
issues: data.issues_detected ?? 0,
});
} catch {
return NextResponse.json({ ok: false }, { status: 200 });
}
}APIReferencePage function · typescript · L109-L305 (197 LOC)app/api-reference/page.tsx
export default function APIReferencePage() {
return (
<div className="relative min-h-screen">
<div className="mx-auto max-w-7xl px-6 py-20">
{/* Header */}
<div className="mb-16">
<h1 className="text-4xl md:text-5xl font-bold mb-4">
API Reference
</h1>
<p className="text-xl text-refinex-gray-100 opacity-80 mb-6">
Complete endpoint documentation for the RefineX signals API.
</p>
<div className="flex flex-wrap gap-4">
<div className="px-4 py-2 rounded-lg bg-refinex-navy-light border border-refinex-cyan/20">
<span className="text-sm text-refinex-gray-100 opacity-60">Base URL: </span>
<code className="text-refinex-cyan">https://api.refinex.io</code>
</div>
<div className="px-4 py-2 rounded-lg bg-refinex-navy-light border border-refinex-cyan/20">
<span className="text-sm text-refinex-gray-100 opacity-60">Auth: </sEnterprisePage function · typescript · L10-L42 (33 LOC)app/enterprise/page.tsx
export default function EnterprisePage() {
return (
<div className="relative min-h-screen">
<div className="mx-auto max-w-5xl px-6 py-20">
{/* Header */}
<div className="text-center mb-12">
<h1 className="text-4xl md:text-5xl font-bold mb-4">Enterprise</h1>
<p className="text-xl text-refinex-gray-100 opacity-80 max-w-2xl mx-auto">
RefineX works best for teams spending at scale. Tell us about your infrastructure
and we'll reach out.
</p>
</div>
{/* Form */}
<Card className="max-w-2xl mx-auto">
<EnterpriseForm />
</Card>
{/* Trust Indicators */}
<div className="mt-12 text-center">
<p className="text-sm text-refinex-gray-100 opacity-60 mb-4">
Trusted by infrastructure teams at scale
</p>
<div className="flex flex-wrap justify-center gap-6 text-refinex-gray-100 opacity-40">
<span>• 24-hour rCitation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
RootLayout function · typescript · L42-L58 (17 LOC)app/layout.tsx
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en" className={`${inter.variable} ${jetbrainsMono.variable}`}>
<body className="min-h-screen flex flex-col">
<Header />
<main className="flex-1">
{children}
</main>
<Footer />
</body>
</html>
)
}NotFound function · typescript · L4-L19 (16 LOC)app/not-found.tsx
export default function NotFound() {
return (
<div className="relative min-h-[80vh] flex items-center justify-center">
<div className="text-center px-6">
<h1 className="text-9xl font-bold gradient-text mb-4">404</h1>
<h2 className="text-3xl font-bold mb-4">Page not found</h2>
<p className="text-refinex-gray-100 opacity-80 mb-8 max-w-md mx-auto">
The page you're looking for doesn't exist or has been moved.
</p>
<Link href="/">
<Button>Back to Home</Button>
</Link>
</div>
</div>
)
}Home function · typescript · L10-L42 (33 LOC)app/page.tsx
export default function Home() {
return (
<main className="min-h-screen">
<HeroSection />
<IntegrationBar />
<FeaturesSection />
<HowItWorksSection />
<QuickstartSection />
{/* Final CTA */}
<section className="py-20 px-6">
<div className="max-w-4xl mx-auto text-center">
<h2 className="text-4xl font-bold text-refinex-primary mb-6">
Ready to Reduce Compute Waste?
</h2>
<p className="text-xl text-refinex-secondary mb-8">
Start with our free tier. No cloud credentials required.
</p>
<div className="flex gap-4 justify-center">
<Link href="/docs/quickstart"
className="inline-flex items-center justify-center px-6 py-3 rounded-lg font-semibold btn-blue">
Get Started
</Link>
<Link href="/api-reference"
className="inline-flex items-center justify-center px-6 py-3 rounded-lg font-semibold bPortalPage function · typescript · L5-L111 (107 LOC)app/portal/page.tsx
export default function PortalPage() {
const [email, setEmail] = useState('');
const [submitted, setSubmitted] = useState(false);
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError('');
try {
const res = await fetch(
`https://refinex-api.onrender.com/v1/portal/signup`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email }),
}
);
const data = await res.json();
if (!res.ok) throw new Error(data.detail || 'Something went wrong');
setSubmitted(true);
} catch (err: any) {
setError(err.message);
} finally {
setLoading(false);
}
}
if (submitted) {
return (
<main className="min-h-screen flex items-center justify-center px-6"
style={{ background: '#0A0F1E' }}>
handleSubmit function · typescript · L11-L33 (23 LOC)app/portal/page.tsx
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError('');
try {
const res = await fetch(
`https://refinex-api.onrender.com/v1/portal/signup`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email }),
}
);
const data = await res.json();
if (!res.ok) throw new Error(data.detail || 'Something went wrong');
setSubmitted(true);
} catch (err: any) {
setError(err.message);
} finally {
setLoading(false);
}
}VerifyContent function · typescript · L7-L123 (117 LOC)app/portal/verify/page.tsx
function VerifyContent() {
const params = useSearchParams();
const token = params.get('token');
const [state, setState] = useState<'loading' | 'success' | 'error'>('loading');
const [data, setData] = useState<any>(null);
const [copied, setCopied] = useState('');
useEffect(() => {
if (!token) { setState('error'); return; }
fetch(`https://refinex-api.onrender.com/v1/portal/verify?token=${token}`)
.then(r => r.json())
.then(d => {
if (d.detail) { setState('error'); return; }
setData(d);
setState('success');
})
.catch(() => setState('error'));
}, [token]);
function copyKey(key: string) {
navigator.clipboard.writeText(key);
setCopied(key);
setTimeout(() => setCopied(''), 2000);
}
if (state === 'loading') return (
<main className="min-h-screen flex items-center justify-center"
style={{ background: '#0A0F1E' }}>
<p className="text-refinex-secondary">Verifying your access...</p>
</macopyKey function · typescript · L27-L31 (5 LOC)app/portal/verify/page.tsx
function copyKey(key: string) {
navigator.clipboard.writeText(key);
setCopied(key);
setTimeout(() => setCopied(''), 2000);
}VerifyPage function · typescript · L125-L131 (7 LOC)app/portal/verify/page.tsx
export default function VerifyPage() {
return (
<Suspense>
<VerifyContent />
</Suspense>
);
}Repobility analyzer · published findings · https://repobility.com
PricingPage function · typescript · L101-L234 (134 LOC)app/pricing/page.tsx
export default function PricingPage() {
return (
<div className="min-h-screen py-20 px-6" style={{ background: '#0A0F1E' }}>
<div className="max-w-7xl mx-auto">
{/* Header */}
<div className="text-center mb-16">
<h1 className="text-5xl font-bold text-refinex-primary mb-4">
Pricing That Scales With Usage
</h1>
<p className="text-xl text-refinex-secondary max-w-2xl mx-auto">
Start free for evaluation. Pay for higher volume and faster support when you ship to production.
</p>
</div>
{/* Pricing Cards */}
<div className="grid md:grid-cols-2 lg:grid-cols-4 gap-6 mb-16">
{tiers.map((tier) => (
<div
key={tier.name}
className="rounded-xl p-8 flex flex-col relative"
style={{
background: '#0F172A',
border: tier.highlighted
? '2px solid #2563EB'
: '1pxPrivacy function · typescript · L1-L19 (19 LOC)app/privacy/page.tsx
export default function Privacy() {
return (
<main className="max-w-2xl mx-auto px-6 py-32">
<h1 className="text-3xl font-bold text-refinex-primary mb-6">Privacy Policy</h1>
<p className="text-refinex-secondary leading-relaxed mb-4">
RefineX collects API usage metadata (request counts, endpoint, timestamp, API key identifier)
for billing and rate limiting purposes. We do not collect, store, or analyze your
infrastructure data, spot instance decisions, or workload characteristics.
</p>
<p className="text-refinex-secondary leading-relaxed mb-4">
We do not sell data. We do not share data with third parties except as required
to operate the service (payment processing via Stripe, error monitoring via Sentry).
</p>
<p className="text-refinex-secondary leading-relaxed">
For questions: [email protected]
</p>
</main>
);
}Terms function · typescript · L1-L22 (22 LOC)app/terms/page.tsx
export default function Terms() {
return (
<main className="max-w-2xl mx-auto px-6 py-32">
<h1 className="text-3xl font-bold text-refinex-primary mb-6">Terms of Service</h1>
<p className="text-refinex-secondary leading-relaxed mb-4">
RefineX provides advisory spot market signals. Signals are probabilistic and do not
constitute infrastructure management advice, financial advice, or execution instructions.
</p>
<p className="text-refinex-secondary leading-relaxed mb-4">
RefineX makes no guarantee of signal accuracy, savings realization, or system performance
outcomes. Customer retains sole decision authority over all infrastructure actions.
</p>
<p className="text-refinex-secondary leading-relaxed mb-4">
Prohibited uses: reverse engineering confidence calculation methods, sharing API keys,
continuous automated polling beyond your rate tier, competitive intelligence extraction.
</p>
<p clConfidenceBadge function · typescript · L3-L17 (15 LOC)app/transparency/page.tsx
function ConfidenceBadge({ score }: { score: number }) {
const band = score >= 0.8 ? 'HIGH' : score >= 0.6 ? 'MEDIUM' : 'WATCH';
const colors: Record<string, { bg: string; text: string; border: string }> = {
HIGH: { bg: 'rgba(16,185,129,0.15)', text: '#10B981', border: 'rgba(16,185,129,0.3)' },
MEDIUM: { bg: 'rgba(245,158,11,0.15)', text: '#F59E0B', border: 'rgba(245,158,11,0.3)' },
WATCH: { bg: 'rgba(239,68,68,0.15)', text: '#EF4444', border: 'rgba(239,68,68,0.3)' },
};
const c = colors[band];
return (
<span className="px-2 py-0.5 rounded text-xs font-bold font-mono"
style={{ background: c.bg, color: c.text, border: `1px solid ${c.border}` }}>
{band}
</span>
);
}StatusDot function · typescript · L19-L28 (10 LOC)app/transparency/page.tsx
function StatusDot({ ok }: { ok: boolean }) {
return (
<span className="inline-flex items-center gap-1.5 text-sm"
style={{ color: ok ? '#10B981' : '#F59E0B' }}>
<span className="w-2 h-2 rounded-full inline-block"
style={{ background: ok ? '#10B981' : '#F59E0B' }} />
{ok ? 'Operational' : 'Degraded'}
</span>
);
}TransparencyPage function · typescript · L30-L159 (130 LOC)app/transparency/page.tsx
export default async function TransparencyPage() {
const [signal, health, dashboard] = await Promise.all([
getActiveSignal(),
getSystemHealth(),
getDashboardSnapshot(),
]);
const now = new Date().toISOString();
const systemOk = health && health.issues_detected === 0;
const activeSignals = dashboard?.product_metrics?.active_signals ?? '—';
const signals24h = dashboard?.product_metrics?.signals_24h ?? '—';
return (
<main className="pt-24 pb-32 px-6">
<div className="max-w-4xl mx-auto">
{/* Header */}
<div className="mb-16">
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium mb-6"
style={{ background: 'rgba(37,99,235,0.15)', border: '1px solid rgba(37,99,235,0.3)', color: '#3B82F6' }}>
Public log · Updated every 60 seconds
</div>
<h1 className="text-4xl font-bold text-refinex-primary mb-4">Signal Transparency</h1>
<p className="text-rEnterpriseForm function · typescript · L6-L178 (173 LOC)components/forms/EnterpriseForm.tsx
export default function EnterpriseForm() {
const [formData, setFormData] = useState({
companyName: '',
role: '',
email: '',
cloudProviders: '',
monthlySpend: '',
message: '',
})
const [submitted, setSubmitted] = useState(false)
const [loading, setLoading] = useState(false)
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
setLoading(true)
try {
const response = await fetch('/api/enterprise', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData),
})
if (response.ok) {
setSubmitted(true)
}
} catch (error) {
console.error('Form submission failed:', error)
} finally {
setLoading(false)
}
}
const handleChange = (
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>
) => {
setFormData((prev) => ({
...prev,
[e.target.name]: e.target.value,
}))IntegrationBar function · typescript · L3-L26 (24 LOC)components/IntegrationBar.tsx
export default function IntegrationBar() {
const integrations = ['AWS', 'Kubernetes', 'Terraform', 'Datadog', 'Grafana', 'PagerDuty', 'n8n'];
return (
<section className="py-12 px-6 section-divider">
<div className="max-w-6xl mx-auto">
<p className="text-center text-xs font-medium tracking-widest uppercase text-refinex-muted mb-8">
Works with your existing stack
</p>
<div className="flex flex-wrap justify-center items-center gap-8">
{integrations.map((name) => (
<span key={name}
className="text-sm font-semibold tracking-wide transition-colors duration-200"
style={{ color: '#475569' }}
onMouseEnter={e => (e.currentTarget.style.color = '#94A3B8')}
onMouseLeave={e => (e.currentTarget.style.color = '#475569')}>
{name}
</span>
))}
</div>
</div>
</section>
);
}Source: Repobility analyzer · https://repobility.com
Footer function · typescript · L3-L39 (37 LOC)components/layout/Footer.tsx
export default function Footer() {
return (
<footer className="py-12 px-6 section-divider">
<div className="max-w-6xl mx-auto">
<div className="flex flex-col md:flex-row justify-between items-start gap-8">
<div>
<p className="text-refinex-primary font-bold text-lg mb-2">RefineX</p>
<p className="text-refinex-muted text-sm max-w-xs">
Advisory spot market signals for cloud engineers and FinOps teams.
</p>
</div>
<div className="flex gap-12">
<div>
<p className="text-refinex-secondary text-xs font-semibold uppercase tracking-widest mb-3">Product</p>
<div className="flex flex-col gap-2">
<Link href="/pricing" className="text-refinex-muted hover:text-refinex-primary text-sm transition-colors">Pricing</Link>
<Link href="/transparency" className="text-refinex-muted hover:text-refinex-primary text-sm transition-colors">SignaHeader function · typescript · L14-L150 (137 LOC)components/layout/Header.tsx
export default function Header() {
const pathname = usePathname()
const [status, setStatus] = useState<'ok' | 'degraded' | 'loading'>('loading')
const [isOpen, setIsOpen] = useState(false)
useEffect(() => {
async function checkHealth() {
try {
const res = await fetch('/api/health')
if (res.ok) {
const data = await res.json()
setStatus(data.ok ? 'ok' : 'degraded')
} else {
setStatus('degraded')
}
} catch {
setStatus('degraded')
}
}
checkHealth()
const interval = setInterval(checkHealth, 60_000)
return () => clearInterval(interval)
}, [])
// Close mobile menu on route change
useEffect(() => {
setIsOpen(false)
}, [pathname])
const statusColor = status === 'ok' ? '#10B981' : status === 'degraded' ? '#F59E0B' : '#475569'
return (
<header className="sticky top-0 z-50"
style={{ background: 'rgba(10,15,30,0.95)', borderBottom: '1px solid rgba(255,255checkHealth function · typescript · L20-L32 (13 LOC)components/layout/Header.tsx
async function checkHealth() {
try {
const res = await fetch('/api/health')
if (res.ok) {
const data = await res.json()
setStatus(data.ok ? 'ok' : 'degraded')
} else {
setStatus('degraded')
}
} catch {
setStatus('degraded')
}
}FeaturesSection function · typescript · L1-L48 (48 LOC)components/sections/FeaturesSection.tsx
export default function FeaturesSection() {
const features = [
{
label: 'Regime-aware signals',
description: 'We classify market state — stable, volatile, mean-reverting — before scoring confidence. You get context, not just a number.',
},
{
label: 'Suppression by design',
description: 'Low-quality signals are blocked before they reach your API. Every suppression is logged with a reason. Discipline is the product.',
},
{
label: 'Advisory-only by default',
description: 'Signals inform decisions. Your autoscaler executes. We never touch your infrastructure. Preview mode is the default.',
},
{
label: 'Confidence bands, not scores',
description: 'We return HIGH, MEDIUM, or WATCH — never raw probability scores. Clean signal, clear action, no false precision.',
},
{
label: 'API-first design',
description: 'One endpoint. Structured JSON. Works with Kubernetes HPA, Terraform, n8n, or any automatioformatSignalRows function · typescript · L14-L24 (11 LOC)components/sections/HeroSection.tsx
function formatSignalRows(signal: Record<string, unknown>) {
return [
['signal_id', signal.signal_id || signal.id || FALLBACK_SIGNAL.signal_id, '#94A3B8'],
['region', signal.region || FALLBACK_SIGNAL.region, '#F8FAFC'],
['instance', signal.instance_type || signal.instance || FALLBACK_SIGNAL.instance, '#F8FAFC'],
['confidence', signal.confidence_label || signal.confidence || FALLBACK_SIGNAL.confidence, '#10B981'],
['regime', signal.regime || signal.market_regime || FALLBACK_SIGNAL.regime, '#3B82F6'],
['spot_savings', signal.savings_percent ? `-${signal.savings_percent}%` : FALLBACK_SIGNAL.spot_savings, '#10B981'],
['suppressed', String(signal.suppressed ?? FALLBACK_SIGNAL.suppressed), '#F59E0B'],
]
}HeroSection function · typescript · L26-L112 (87 LOC)components/sections/HeroSection.tsx
export default async function HeroSection() {
let signal: Record<string, unknown> = FALLBACK_SIGNAL
let isLive = false
try {
const data = await getActiveSignal()
if (data && (data.signal || data.id || data.signal_id)) {
signal = data.signal || data
isLive = true
}
} catch {
// Fallback to static
}
const rows = formatSignalRows(signal)
return (
<section className="relative pt-32 pb-24 px-6">
<div className="max-w-6xl mx-auto">
<div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
{/* Left — Copy */}
<div>
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium mb-8"
style={{ background: 'rgba(37,99,235,0.15)', border: '1px solid rgba(37,99,235,0.3)', color: '#3B82F6' }}>
<span className="w-1.5 h-1.5 rounded-full bg-refinex-success inline-block" />
{isLive ? 'Live signal · Production' : 'Advisory signalsHowItWorksSection function · typescript · L22-L73 (52 LOC)components/sections/HowItWorksSection.tsx
export default function HowItWorksSection() {
return (
<section className="py-20 section-divider">
<div className="mx-auto max-w-6xl px-6">
<div className="text-center mb-16">
<h2 className="text-3xl md:text-4xl font-bold text-refinex-primary mb-4">
How it works
</h2>
<p className="text-lg text-refinex-secondary max-w-2xl mx-auto">
Simple three-step pipeline from cloud APIs to your infrastructure decisions.
</p>
</div>
<div className="grid md:grid-cols-3 gap-6">
{steps.map((step, index) => (
<div key={step.title} className="relative">
<div className="rounded-xl p-8 text-center h-full"
style={{ background: '#0F172A', border: '1px solid rgba(255,255,255,0.08)' }}>
<div className="inline-flex items-center justify-center w-14 h-14 rounded-full mb-5"
style={{ background: 'rgba(37,99,235,0.12)', border: '1pxQuickstartSection function · typescript · L24-L64 (41 LOC)components/sections/QuickstartSection.tsx
export default function QuickstartSection() {
return (
<section className="py-20 section-divider">
<div className="mx-auto max-w-5xl px-6">
<div className="text-center mb-12">
<h2 className="text-3xl md:text-4xl font-bold text-refinex-primary mb-4">
Get started in minutes
</h2>
<p className="text-lg text-refinex-secondary">
One HTTP call. One decision. No complexity.
</p>
</div>
<div className="rounded-xl overflow-hidden"
style={{ background: '#0F172A', border: '1px solid rgba(255,255,255,0.08)' }}>
<div className="flex items-center gap-2 px-4 py-3"
style={{ borderBottom: '1px solid rgba(255,255,255,0.06)' }}>
<span className="w-3 h-3 rounded-full" style={{ background: '#EF4444' }} />
<span className="w-3 h-3 rounded-full" style={{ background: '#F59E0B' }} />
<span className="w-3 h-3 rounded-full" style={{ background: 'Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
CodeBlock function · typescript · L16-L68 (53 LOC)components/ui/CodeBlock.tsx
export default function CodeBlock({
code,
language = 'bash',
filename,
className,
showLineNumbers = false,
}: CodeBlockProps) {
const [copied, setCopied] = useState(false)
const handleCopy = async () => {
await navigator.clipboard.writeText(code)
setCopied(true)
setTimeout(() => setCopied(false), 2000)
}
return (
<div className={cn('relative group', className)}>
{filename && (
<div className="bg-refinex-navy-dark border border-refinex-cyan/20 border-b-0 rounded-t-lg px-4 py-2 text-sm text-refinex-cyan font-mono">
{filename}
</div>
)}
<div className="relative">
<button
onClick={handleCopy}
className="absolute right-4 top-4 p-2 rounded-lg bg-refinex-navy-light/50 border border-refinex-cyan/20 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-refinex-cyan/10"
title="Copy code"
>
{copied ? (
<Check className="w-4 h-4 text-semantic-sLogo function · typescript · L7-L147 (141 LOC)components/ui/Logo.tsx
export default function Logo({ className }: LogoProps) {
return (
<svg
viewBox="0 0 512 512"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={cn('', className)}
>
<g>
<path d="M145 152.353L150.945 147L237.932 243.609L231.987 248.962L145 152.353Z" fill="url(#paint0_linear)" />
<path d="M161 152.353L166.945 147L253.932 243.609L247.987 248.962L161 152.353Z" fill="url(#paint1_linear)" />
<path d="M129 152.353L134.945 147L221.932 243.609L215.987 248.962L129 152.353Z" fill="url(#paint2_linear)" />
<path d="M177 152.353L182.945 147L269.932 243.609L263.987 248.962L177 152.353Z" fill="url(#paint3_linear)" />
<path d="M193 152.353L198.945 147L285.932 243.609L279.987 248.962L193 152.353Z" fill="url(#paint4_linear)" />
</g>
<g>
<path d="M261.963 212.552L267.909 217.906L326.932 152.353L320.987 147L261.963 212.552Z" fill="url(#paint5_linear)" />
<path d="M269.432 222.028L275.377 227.3MetricCard function · typescript · L16-L61 (46 LOC)components/ui/MetricCard.tsx
export default function MetricCard({
value,
label,
suffix = '',
prefix = '',
decimals = 0,
className,
animate = true,
}: MetricCardProps) {
const [count, setCount] = useState(animate ? 0 : value)
useEffect(() => {
if (!animate) return
const duration = 1500
const steps = 60
const increment = value / steps
let current = 0
const timer = setInterval(() => {
current += increment
if (current >= value) {
setCount(value)
clearInterval(timer)
} else {
setCount(current)
}
}, duration / steps)
return () => clearInterval(timer)
}, [value, animate])
const formattedValue = count.toLocaleString('en-US', {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
})
return (
<Card className={cn('text-center', className)} hover>
<div className="text-4xl font-bold gradient-text mb-2">
{prefix}{formattedValue}{suffix}
</div>
<div className="text-sm SignalBadge function · typescript · L9-L40 (32 LOC)components/ui/SignalBadge.tsx
export default function SignalBadge({ type, confidence, className }: SignalBadgeProps) {
const config = {
spot_arbitrage: {
color: 'bg-semantic-success',
text: 'Spot Arbitrage',
icon: '↗',
},
interruption_risk: {
color: 'bg-semantic-warning',
text: 'Interruption Risk',
icon: '⚠',
},
}
const { color, text, icon } = config[type]
return (
<div
className={cn(
'inline-flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium text-refinex-navy',
color,
className
)}
>
<span className="text-lg">{icon}</span>
<span>{text}</span>
{confidence !== undefined && (
<span className="opacity-75">({Math.round(confidence * 100)}%)</span>
)}
</div>
)
}initDatabase function · typescript · L8-L43 (36 LOC)lib/db.ts
export function initDatabase() {
// Enterprise leads table
db.exec(`
CREATE TABLE IF NOT EXISTS enterprise_leads (
id INTEGER PRIMARY KEY AUTOINCREMENT,
company_name TEXT NOT NULL,
role TEXT NOT NULL,
email TEXT NOT NULL,
cloud_providers TEXT NOT NULL,
monthly_spend TEXT NOT NULL,
message TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
`)
// Waitlist table
db.exec(`
CREATE TABLE IF NOT EXISTS waitlist (
id INTEGER PRIMARY KEY AUTOINCREMENT,
email TEXT NOT NULL UNIQUE,
source TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
`)
// Support escalations table
db.exec(`
CREATE TABLE IF NOT EXISTS support_escalations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT NOT NULL,
message TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
`)
}saveEnterpriseLead function · typescript · L57-L71 (15 LOC)lib/db.ts
export function saveEnterpriseLead(lead: EnterpriseLead) {
const stmt = db.prepare(`
INSERT INTO enterprise_leads (company_name, role, email, cloud_providers, monthly_spend, message)
VALUES (?, ?, ?, ?, ?, ?)
`)
return stmt.run(
lead.companyName,
lead.role,
lead.email,
lead.cloudProviders,
lead.monthlySpend,
lead.message || null
)
}getEnterpriseLeads function · typescript · L73-L78 (6 LOC)lib/db.ts
export function getEnterpriseLeads() {
const stmt = db.prepare(`
SELECT * FROM enterprise_leads ORDER BY created_at DESC
`)
return stmt.all()
}addToWaitlist function · typescript · L85-L90 (6 LOC)lib/db.ts
export function addToWaitlist(entry: WaitlistEntry) {
const stmt = db.prepare(`
INSERT INTO waitlist (email, source) VALUES (?, ?)
`)
return stmt.run(entry.email, entry.source || null)
}Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
saveSupportEscalation function · typescript · L98-L104 (7 LOC)lib/db.ts
export function saveSupportEscalation(escalation: SupportEscalation) {
const stmt = db.prepare(`
INSERT INTO support_escalations (name, email, message)
VALUES (?, ?, ?)
`)
return stmt.run(escalation.name, escalation.email, escalation.message)
}apiFetch function · typescript · L5-L21 (17 LOC)lib/refinex-api.ts
async function apiFetch(path: string, useAdmin = false) {
try {
const headers: Record<string, string> = useAdmin
? { 'X-Admin-Token': ADMIN_TOKEN }
: { 'X-API-Key': API_KEY };
const res = await fetch(`${API_URL}${path}`, {
headers,
next: { revalidate: 60 },
});
if (!res.ok) return null;
return res.json();
} catch {
return null;
}
}getActiveSignal function · typescript · L23-L25 (3 LOC)lib/refinex-api.ts
export async function getActiveSignal() {
return apiFetch('/v1/signals/active?cloud=aws®ion=us-east-1&instance_type=c5.2xlarge');
}page 1 / 2next ›