Add backend and frontend skeleton
This commit is contained in:
@@ -19,15 +19,15 @@ ENV NPM_CONFIG_LOGLEVEL=warn \
|
||||
# Dependencies cache
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM base AS deps
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci
|
||||
COPY package*.json ./
|
||||
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Production dependencies only (pruned to omit dev tooling)
|
||||
# ------------------------------------------------------------------------------
|
||||
FROM base AS prod-deps
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --omit=dev
|
||||
COPY package*.json ./
|
||||
RUN if [ -f package-lock.json ]; then npm ci --omit=dev; else npm install --omit=dev; fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Builder: compile the application for production
|
||||
|
||||
236
app/frontend/app/globals.css
Normal file
236
app/frontend/app/globals.css
Normal file
@@ -0,0 +1,236 @@
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||
sans-serif;
|
||||
line-height: 1.5;
|
||||
background: #04060d;
|
||||
color: #f6f7fb;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
background: radial-gradient(circle at 20% 20%, #182147 0%, transparent 30%),
|
||||
radial-gradient(circle at 80% 10%, #1d3754 0%, transparent 25%),
|
||||
radial-gradient(circle at 40% 80%, #1b2744 0%, transparent 30%),
|
||||
#04060d;
|
||||
}
|
||||
|
||||
.page {
|
||||
position: relative;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 40px 24px 80px;
|
||||
}
|
||||
|
||||
.nebula {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: radial-gradient(
|
||||
circle at 20% 30%,
|
||||
rgba(121, 160, 255, 0.22),
|
||||
transparent 32%
|
||||
),
|
||||
radial-gradient(
|
||||
circle at 80% 20%,
|
||||
rgba(255, 120, 200, 0.12),
|
||||
transparent 28%
|
||||
),
|
||||
radial-gradient(
|
||||
circle at 50% 80%,
|
||||
rgba(80, 200, 255, 0.14),
|
||||
transparent 30%
|
||||
);
|
||||
filter: blur(60px);
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
margin-bottom: 32px;
|
||||
border-radius: 14px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
backdrop-filter: blur(16px);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.orb {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle at 30% 30%, #8fd6ff, #5c72ff);
|
||||
box-shadow: 0 0 18px rgba(92, 114, 255, 0.6);
|
||||
}
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 12px;
|
||||
color: #f6f7fb;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 8px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.16em;
|
||||
font-size: 0.78rem;
|
||||
color: #9fb3ff;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
margin: 0 0 12px;
|
||||
font-size: 2.4rem;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.lede {
|
||||
margin: 0 0 18px;
|
||||
max-width: 720px;
|
||||
color: #c7cee7;
|
||||
}
|
||||
|
||||
.chip-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
font-weight: 600;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.pill.subtle {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #cdd5f5;
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.status-pill.ok {
|
||||
color: #92ffba;
|
||||
background: rgba(28, 187, 124, 0.14);
|
||||
border-color: rgba(28, 187, 124, 0.4);
|
||||
}
|
||||
|
||||
.status-pill.bad {
|
||||
color: #ffc7c7;
|
||||
background: rgba(255, 99, 99, 0.12);
|
||||
border-color: rgba(255, 99, 99, 0.3);
|
||||
}
|
||||
|
||||
.grid {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-top: 28px;
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
}
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
border-radius: 18px;
|
||||
padding: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.glass {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(255, 255, 255, 0.02)
|
||||
),
|
||||
rgba(255, 255, 255, 0.02);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: #a5acc7;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||
gap: 12px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.meta-label {
|
||||
color: #7f88a8;
|
||||
margin: 0 0 4px;
|
||||
font-size: 0.85rem;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.meta-value {
|
||||
margin: 0;
|
||||
color: #f6f7fb;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 4px 8px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.topbar {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
}
|
||||
16
app/frontend/app/layout.tsx
Normal file
16
app/frontend/app/layout.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import "./globals.css";
|
||||
import type { Metadata } from "next";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "avaaz.ai",
|
||||
description: "Health check frontend for avaaz.ai",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
177
app/frontend/app/page.tsx
Normal file
177
app/frontend/app/page.tsx
Normal file
@@ -0,0 +1,177 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
type HealthResponse = {
|
||||
status: string;
|
||||
service: string;
|
||||
environment: string;
|
||||
};
|
||||
|
||||
export default function Home() {
|
||||
const [health, setHealth] = useState<HealthResponse | null>(null);
|
||||
const [ready, setReady] = useState<HealthResponse | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [readyError, setReadyError] = useState<string | null>(null);
|
||||
const [attemptedHealthUrl, setAttemptedHealthUrl] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
const [attemptedReadyUrl, setAttemptedReadyUrl] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
const [lastUpdated, setLastUpdated] = useState<string | null>(null);
|
||||
|
||||
const apiBase = useMemo(
|
||||
() => process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000",
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchHealth() {
|
||||
try {
|
||||
const url = `${apiBase}/healthz`;
|
||||
setAttemptedHealthUrl(url);
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) throw new Error(`Health check failed: ${res.status}`);
|
||||
const payload = (await res.json()) as HealthResponse;
|
||||
setHealth(payload);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "Unknown error";
|
||||
setError(message);
|
||||
setHealth(null);
|
||||
}
|
||||
}
|
||||
async function fetchReady() {
|
||||
try {
|
||||
const url = `${apiBase}/readyz`;
|
||||
setAttemptedReadyUrl(url);
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) throw new Error(`Ready check failed: ${res.status}`);
|
||||
const payload = (await res.json()) as HealthResponse;
|
||||
setReady(payload);
|
||||
setReadyError(null);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "Unknown error";
|
||||
setReadyError(message);
|
||||
setReady(null);
|
||||
}
|
||||
}
|
||||
|
||||
const run = async () => {
|
||||
await Promise.allSettled([fetchHealth(), fetchReady()]);
|
||||
setLastUpdated(new Date().toLocaleTimeString());
|
||||
};
|
||||
|
||||
run();
|
||||
const id = setInterval(run, 10_000);
|
||||
return () => clearInterval(id);
|
||||
}, [apiBase]);
|
||||
|
||||
const badgeClass =
|
||||
health && health.status === "ok" && !error
|
||||
? "status-pill ok"
|
||||
: "status-pill bad";
|
||||
|
||||
const readyClass =
|
||||
ready && ready.status === "ok" && !readyError
|
||||
? "status-pill ok"
|
||||
: "status-pill bad";
|
||||
|
||||
return (
|
||||
<main className="page">
|
||||
<div className="nebula" aria-hidden="true" />
|
||||
<header className="topbar">
|
||||
<div className="brand">
|
||||
<span className="orb" />
|
||||
avaaz.ai status
|
||||
</div>
|
||||
<div className="pill subtle">Polling every 10s</div>
|
||||
</header>
|
||||
|
||||
<section className="hero">
|
||||
<div>
|
||||
<p className="eyebrow">System overview</p>
|
||||
<h1>Minimal health & readiness monitor</h1>
|
||||
<p className="lede">
|
||||
Inspired by gemini.google.com — lightweight cards, soft gradients,
|
||||
and live probes for backend health.
|
||||
</p>
|
||||
<div className="chip-row">
|
||||
<div className={badgeClass}>
|
||||
Health: {health && !error ? "ok" : "unhealthy"}
|
||||
</div>
|
||||
<div className={readyClass}>
|
||||
Ready: {ready && !readyError ? "ok" : "not ready"}
|
||||
</div>
|
||||
{lastUpdated && (
|
||||
<div className="pill subtle">Updated {lastUpdated}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="grid">
|
||||
<article className="card glass">
|
||||
<div className="card-header">
|
||||
<span className="pill subtle">/healthz</span>
|
||||
<span className={badgeClass}>
|
||||
{health && !error ? "ok" : "unhealthy"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="muted">
|
||||
{attemptedHealthUrl || `${apiBase}/healthz`}
|
||||
</p>
|
||||
{health ? (
|
||||
<div className="meta">
|
||||
<div>
|
||||
<p className="meta-label">Service</p>
|
||||
<p className="meta-value">{health.service}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="meta-label">Environment</p>
|
||||
<p className="meta-value">{health.environment}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="meta-label">Status</p>
|
||||
<p className="meta-value">{health.status}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">{error || "Waiting for response..."}</p>
|
||||
)}
|
||||
</article>
|
||||
|
||||
<article className="card glass">
|
||||
<div className="card-header">
|
||||
<span className="pill subtle">/readyz</span>
|
||||
<span className={readyClass}>
|
||||
{ready && !readyError ? "ok" : "not ready"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="muted">
|
||||
{attemptedReadyUrl || `${apiBase}/readyz`}
|
||||
</p>
|
||||
{ready ? (
|
||||
<div className="meta">
|
||||
<div>
|
||||
<p className="meta-label">Service</p>
|
||||
<p className="meta-value">{ready.service}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="meta-label">Environment</p>
|
||||
<p className="meta-value">{ready.environment}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="meta-label">Status</p>
|
||||
<p className="meta-value">{ready.status}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">{readyError || "Waiting for response..."}</p>
|
||||
)}
|
||||
</article>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
6
app/frontend/next.config.mjs
Normal file
6
app/frontend/next.config.mjs
Normal file
@@ -0,0 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
5388
app/frontend/package-lock.json
generated
Normal file
5388
app/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
app/frontend/package.json
Normal file
24
app/frontend/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "avaaz-frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "15.5.6",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "22.9.4",
|
||||
"@types/react": "18.3.18",
|
||||
"@types/react-dom": "18.3.1",
|
||||
"eslint": "9.39.1",
|
||||
"eslint-config-next": "15.5.6",
|
||||
"typescript": "5.7.3"
|
||||
}
|
||||
}
|
||||
1
app/frontend/public/.gitkeep
Normal file
1
app/frontend/public/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
# Placeholder to ensure public assets directory exists for builds.
|
||||
38
app/frontend/tsconfig.json
Normal file
38
app/frontend/tsconfig.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2017",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user