How ranpoe/init-nestjs works
This repository provides a chat UI and NestJS API that proxy prompts to a configured local Ollama instance. The principal workflow is user prompt → frontend session state and API request → chat controller → Ollama service → generated text displayed in the conversation. The backend also exposes health and Prometheus metrics endpoints, and includes trace/session correlation and logging infrastructure. Source excerpts support the chat, health, and metrics relationships; observability deployment wiring is represented only at the directory level because its configuration was not sampled.
Main entry points: App.tsx Chat screen · useChat.ts Conversation state · ollama.controller.ts Chat endpoint · main.ts NestJS bootstrap
Components 21
Chat frontend
- Chat screen
frontend/src/App.tsx - Conversation state
frontend/src/hooks/useChat.ts - Chat API client
frontend/src/api/chat.ts - Message list
frontend/src/components/ChatMessageList.tsx - Prompt input
frontend/src/components/ChatInput.tsx - Session badge
frontend/src/components/CopyIdBadge.tsx
Chat API
- NestJS bootstrap
src/main.ts - Application wiring
src/app.module.ts - Chat endpoint
src/ollama/ollama.controller.ts - Generation proxy
src/ollama/ollama.service.ts - Environment validation
src/config/env.validation.ts
Operations
- Health probes
src/health/health.controller.ts - Request metrics
src/common/interceptors/metrics.interceptor.ts - Metrics registry
src/common/metrics/metrics.service.ts - Metrics endpoint
src/common/metrics/metrics.controller.ts
Telemetry
- Session tagging
src/ollama/interceptors/chat-session.interceptor.ts - Trace setup
src/tracing.ts - Observability stack
observability
Other components
- Chat user
- Ollama
- Prometheus
Connections 21
- Chat user → Chat screen: uses
frontend/src/App.tsx - Chat screen → Conversation state: uses
frontend/src/App.tsx - Chat screen → Message list: renders
frontend/src/App.tsx - Chat screen → Prompt input: renders
frontend/src/App.tsx - Chat screen → Session badge: renders
frontend/src/App.tsx - Prompt input → Conversation state: submits prompt
frontend/src/App.tsx - Conversation state → Chat API client: sends request
frontend/src/hooks/useChat.ts - Conversation state → Message list: provides messages
frontend/src/components/ChatMessageList.tsx - Conversation state → Session badge: provides session ID
frontend/src/App.tsx - Chat API client → Chat endpoint: posts chat
- NestJS bootstrap → Application wiring: starts
src/main.ts - Application wiring → Environment validation: validates configuration
src/app.module.ts - Chat endpoint → Generation proxy: generates text
src/ollama/ollama.controller.ts - Chat endpoint → Session tagging: applies interceptor
src/ollama/ollama.controller.ts - Generation proxy → Ollama: requests generation
src/ollama/ollama.service.ts - Health probes → Ollama: pings readiness
src/health/health.controller.ts - Request metrics → Metrics registry: records requests
src/common/interceptors/metrics.interceptor.ts - Metrics endpoint → Metrics registry: exports metrics
src/common/metrics/metrics.controller.ts - Prometheus → Metrics endpoint: scrapes
- NestJS bootstrap → Trace setup: loads tracing
src/main.ts - Trace setup → Observability stack: exports telemetry