Skip to content

Repository files navigation

AutoPipeline Frontend

Graduation Project β€” Faculty of Computers and Artificial Intelligence, Cairo University

The desktop client for AutoPipeline β€” a Next.js 16 UI wrapped in an Electron 41 shell. Point it at a local codebase, describe the pipeline you want, and watch the AI agent analyze, plan, generate, validate, and self-correct a production-ready CI/CD workflow live, streamed token-by-token. Approve commands and answer questions mid-run, then save the generated YAML to disk.

This is the frontend layer of AutoPipeline. It talks to the Backend BFF (NestJS), which proxies the Agent (Python/FastAPI). For the full experience, run all three together via the AutoPipeline launcher.


Key Features

  • Real-Time Streaming Chat β€” Reads a newline-delimited JSON (NDJSON) event stream from the backend and renders each event into an incrementally-updating timeline: assistant text, live reasoning/thinking, tool calls, plans, validation results, and YAML drafts β€” in the exact order they happened.
  • Desktop-Native Capabilities β€” An Electron main process provides the three things a browser can't: a project folder picker, encrypted API-key storage (OS keychain via safeStorage), and a file-save bridge for the generated workflow.
  • Human-in-the-Loop (HITL) β€” Interactive cards let you allow/deny shell commands and answer clarification questions mid-run; each decision opens a resume stream that continues the same message.
  • Multi-Provider LLM Selection β€” Pick a built-in provider/model (OpenAI, Anthropic, Gemini, Groq) or register a custom OpenAI-compatible endpoint (Ollama, vLLM, LM Studio). API keys are supplied per-request and stored encrypted β€” never in this repo.
  • Per-Message Controls β€” Choose the target CI platform (GitHub Actions / GitLab CI) and the reasoning effort on each prompt.
  • Session Management β€” Create, switch, auto-title, and delete chat sessions, with optimistic updates and resilient history rehydration.
  • Neo-Brutalist Theming β€” A monospace, terminal-inspired UI with class-based light/dark mode and no flash-of-wrong-theme on load.

Tech Stack

Layer Technology
UI Framework Next.js 16 (App Router, Turbopack, static export)
View Library React 19
Desktop Shell Electron 41
Desktop Storage electron-store + Electron safeStorage
Language TypeScript 5 (strict)
Styling Tailwind CSS 4
Markdown react-markdown + remark-gfm
Icons lucide-react
Testing Vitest 2 (+ v8 coverage)
Runtime Node.js β‰₯ 20

Quick Start

1. Install

git clone <repo-url>
cd frontend
npm install

2. Configure Environment

Create a .env file (or copy .env-example). Only one variable is read:

# Backend BFF base URL (NestJS server)
NEXT_PUBLIC_BACKEND_URL=http://localhost:3333

3. Run

# Full desktop experience (Next dev server + Electron window):
npm run electron-dev

# Web only (browser tab β€” no folder picker / keychain / save-to-disk):
npm run dev

The frontend serves at http://localhost:3001.

Note: LLM API keys are not configured here. You enter them at runtime in the app's model selector; they are stored encrypted in your OS keychain and sent per-request to the backend.


Architecture Overview

The app is an Electron desktop client with a layered Next.js renderer that talks to the backend over REST + NDJSON. The renderer never touches the Python agent directly β€” everything flows through the BFF.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Electron Desktop App ────────────────────┐
β”‚  electron/main.js ──contextBridge──► preload.js               β”‚
β”‚  (window, IPC, safeStorage,          window.electronAPI       β”‚
β”‚   dialogs, electron-store)                 β”‚                  β”‚
β”‚                                            β–Ό                  β”‚
β”‚                                   Next.js renderer (src/)     β”‚
β”‚   app/ ─► components/ ─► hooks/ ─► services/ ─► fetch ────────┼──► Backend BFF (:3333)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • app/ β€” App Router routes (home / sessions / settings); thin wiring.
  • components/ β€” presentational cards + the SessionsLayout orchestrator.
  • hooks/ β€” all stateful logic (useSessions, useMessages, useChat, useApiKeys), including the streaming reducer.
  • services/ β€” every fetch call, the NDJSON stream parser, and the Electron wrapper.
  • types/ / data/ / utils/ β€” shared types, the model seed list, helpers.

Application code lives under src/ (mirroring the backend and agent repos); electron/ and public/ stay at the root. The @/ import alias resolves to ./src/*.


Project Structure

frontend/
β”œβ”€β”€ electron/                 # Desktop shell (main process, preload bridge)
β”œβ”€β”€ public/                   # Static assets (logo, title images)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                  # Next.js App Router (layout, home, sessions, settings)
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ chat/             # AgentMessage + streaming cards (tool, plan, draft, HITL…)
β”‚   β”‚   β”œβ”€β”€ sessions/         # SessionsLayout (orchestrator), sidebar, chat input, modals
β”‚   β”‚   β”œβ”€β”€ settings/         # API-key & custom-model management
β”‚   β”‚   β”œβ”€β”€ ui/               # Button, Spinner, CornerAccent
β”‚   β”‚   └── (shell)           # Navbar, ThemeProvider, ThemeToggle, ScanlineOverlay
β”‚   β”œβ”€β”€ hooks/                # useSessions, useMessages, useChat, useApiKeys
β”‚   β”œβ”€β”€ services/             # projectService, sessionService, modelService, messages, electronService
β”‚   β”œβ”€β”€ types/                # agent (StreamEvent), message, session, LLM, streamData, electron.d.ts
β”‚   β”œβ”€β”€ data/                 # LLM_OPTIONS seed list
β”‚   └── utils/                # formatRelativeTime
β”œβ”€β”€ diagrams/                 # generate_diagrams.py + output/*.png
β”œβ”€β”€ docs/                     # DOCUMENTATION.md, TESTING.md
β”œβ”€β”€ next.config.ts            # output: 'export'
└── tsconfig.json             # paths: { "@/*": ["./src/*"] }

Backend API (consumed)

The frontend reads the backend base URL from NEXT_PUBLIC_BACKEND_URL and calls:

Method Endpoint Purpose
POST /projects Initialize the selected project
GET / DELETE /sessions List / delete chat sessions
GET /messages?sessionId= Load & rehydrate conversation history
POST /messages?projectId&modelId[&sessionId] Send a prompt (NDJSON stream)
POST /messages/permission Β· /messages/clarification Resume after a HITL prompt (NDJSON)
POST /messages/cancel Cancel an active run
GET/POST/PATCH/DELETE /models LLM catalog + custom models

The message send body carries the prompt, the per-request apikey, the targetPlatform, and the reasoningEffort:

{
  "message": "Create a GitHub Actions CI pipeline for this project",
  "apikey": "provider-api-key",
  "targetPlatform": "github_actions",
  "reasoningEffort": "medium"
}

Available Scripts

Command Description
npm run dev Next dev server on :3001
npm run build Static production build β†’ ./out
npm run start Serve the production build on :3001
npm run lint ESLint
npm test / npm run test:cov Vitest unit suite (+ coverage)
npm run electron Launch the Electron shell
npm run electron-dev Run Next dev + launch Electron when ready
npm run build-electron Build the frontend and package with electron-builder

Documentation

For comprehensive technical documentation β€” architecture deep-dives, the streaming/event-rendering pipeline, component/hook/service breakdowns, the Electron bridge, the data model, and design trade-offs β€” see:

πŸ“– Full Technical Documentation

Rendered architecture, sequence, flow, and class diagrams (one PNG per page, A4-friendly) live in diagrams/output/ and are regenerated with:

python diagrams/generate_diagrams.py

Testing

npm test           # run the unit suite once
npm run test:watch # watch mode
npm run test:cov   # with coverage report

43 hermetic unit tests (Vitest) cover the streaming, rehydration, request-shaping, and error-translation logic β€” the frontend's real risk. See TESTING.md for methodology and coverage.


Typical User Flow

  1. Launch the app; select a project folder (or a recent one).
  2. The frontend initializes the project via the backend.
  3. Pick an LLM provider/model and enter its API key (stored encrypted).
  4. Choose target platform + reasoning effort.
  5. Type a prompt; watch the run stream live.
  6. Approve/deny commands and answer clarifications as they appear.
  7. Copy or save the generated workflow YAML.

License

This project is licensed under the terms in the LICENSE file (MIT).

About

πŸ–₯️ The client tier of AutoPipelineAI: a Next.js 16 + Electron 41 desktop app with real-time streaming chat, human-in-the-loop approvals, encrypted API-key storage, and multi-provider LLM selection

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages