Skip to content

jaredthivener/kaas

Repository files navigation

KaaS

CI Next.js Prisma

KaaS is a Kubernetes as a Service platform console built with Next.js, Prisma, Auth.js, and a GitOps-oriented control model. It combines platform administration, cluster lifecycle management, security posture, monitoring, support workflows, and GitOps visibility into a single operator-facing interface.

What It Includes

  • Cluster inventory, creation, scaling, deletion, and detail views
  • Operator-style cluster detail console with signals, GitOps, security, operations, and debug preview tabs
  • Monitoring, security, DORA metrics, support, teams, users, and audit views
  • Prisma-backed API routes for clusters, teams, users, audit logs, and internal reconciliation
  • GitOps manifest generation and reconciliation helpers for EKS, AKS, and GKE
  • Standalone production build support for containerized deployment
  • Unit and integration test coverage with Vitest

Stack

  • Next.js 16 App Router
  • React 19
  • Material UI 7
  • Prisma 7 with PostgreSQL
  • Auth.js v5 beta
  • SWR for client-side data fetching
  • Vitest for tests

Repo Layout

  • src/app: App Router pages and API routes
  • src/components: dashboard, cluster, layout, and shared UI components
  • src/lib: auth, Prisma, services, GitOps helpers, hooks, data, types, and utilities
  • prisma: schema definition
  • k8s: deployment manifests
  • docs/gitops-repo: example GitOps repository structure
  • __tests__: unit and integration tests

Quick Start

1. Install dependencies

npm install

2. Start PostgreSQL

docker compose up -d postgres

3. Create your local env file

cp .env.example .env

4. Initialize the schema

This repo currently uses prisma db push for local bootstrapping.

npm run db:push

5. Start the app

npm run dev

Open http://localhost:3000.

One-command local startup

If you want the repo to bootstrap PostgreSQL, install packages, sync Prisma, and start the dev server in one step, use:

npm run dev:local

By default the script runs with --allow-dirty so it works in an active local development tree. To require a clean git working tree, run the script directly:

./scripts/dev-local.sh

If you only want the setup steps without launching the dev server, use:

./scripts/dev-local.sh --allow-dirty --setup-only

The script performs these steps in order:

  • starts docker compose PostgreSQL
  • waits for PostgreSQL readiness with pg_isready
  • creates .env from .env.example if needed
  • clears stale .next output
  • runs npm install
  • runs npm run db:generate
  • runs npm run db:push
  • launches npm run dev

Production-Style Local Run

This project uses Next.js output: "standalone". Do not use next start here.

npm run build
npm run start

The start command copies the built static assets into the standalone output before launching the Node server.

Local Auth And Database Behavior

KaaS supports a local development sign-in path through Auth.js credentials.

  • AUTH_LOCAL_ENABLED="true" enables local dev sign-in
  • NEXT_PUBLIC_AUTH_LOCAL_ENABLED="true" exposes local auth in the UI
  • AUTH_LOCAL_SKIP_DB="true" allows local auth to work even if user rows are not seeded
  • AUTH_TRUST_HOST="true" avoids Auth.js UntrustedHost failures in local runtime

This is useful because the UI can boot even while you are still wiring database state, but cluster and admin APIs still require PostgreSQL to be reachable.

Environment Variables

The primary local variables are defined in .env.example.

Key groups:

  • Database: DATABASE_URL
  • Auth.js: NEXTAUTH_URL, NEXTAUTH_SECRET, AUTH_TRUST_HOST
  • Local dev auth: AUTH_LOCAL_ENABLED, AUTH_LOCAL_SKIP_DB, AUTH_LOCAL_EMAIL, AUTH_LOCAL_NAME
  • OAuth providers: GitHub, Google, optional Azure AD placeholders
  • GitOps integration: GITOPS_REPO_OWNER, GITOPS_REPO_NAME, GITOPS_REPO_BRANCH, GITHUB_TOKEN
  • Internal reconciliation: INTERNAL_API_TOKEN, KAAS_INTERNAL_URL, CAPI_NAMESPACE

Generate a local Auth.js secret with:

openssl rand -base64 32

Useful Commands

npm run dev
npm run build
npm run start
npm run lint
npm run type-check
npm test
npm run db:generate
npm run db:push
npm run db:studio

Testing

Run the full test suite:

npm test

Run type checks:

npm run type-check

Run linting:

npm run lint

CI

The GitHub Actions workflow runs:

  • lint and type-check
  • Prisma client generation
  • Vitest tests with PostgreSQL service container
  • production build validation

See .github/workflows/ci.yml.

Deployment Notes

Current State

This repository is a strong platform-console prototype with a meaningful API and UI surface area. Some advanced views still use synthesized or mock-backed data in the UI to validate operator workflows before wiring deeper backend integrations.

That is intentional: the information architecture is ahead of the data plumbing in a few areas, especially around cluster-scoped operator insights.

About

Kubernetes as a Service platform console built with Next.js, Prisma, Auth.js, and GitOps workflows

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages