Nx monorepo for an enterprise multi-agent stack: Angular studio UI, NestJS API gateway, shared developer CLI, and a Python FastAPI / LangGraph agent core.
enterprise-ai-workspace/
├── apps/
│ ├── client/ # Angular 17+ Studio UI
│ └── gateway-server/ # NestJS API Gateway (JWT, Kafka, proxy)
├── libs/
│ └── ai-cli/ # Shared developer CLI library
├── agent-core/ # Python FastAPI + LangGraph engine
├── docker-compose.yml # Full-stack Docker orchestration
├── package.json # Single Node.js dependency root
├── nx.json
├── workspace.json
└── tsconfig.base.json
| File | Purpose |
|---|---|
docker-compose.yml |
Runs client, gateway, agent-core, MongoDB, Kafka |
agent-core/Dockerfile |
Python FastAPI image |
apps/gateway-server/Dockerfile |
NestJS gateway image |
apps/client/Dockerfile |
Angular + nginx image |
Angular Client → NestJS Gateway (:3000) → Python Agent Core (:8000)
↓
Kafka events
| Layer | Role | Default URL |
|---|---|---|
apps/client |
Prompt console / studio UI | http://localhost:4200 |
apps/gateway-server |
Auth, proxy, event publishing | http://localhost:3000 |
agent-core |
LangGraph agent + RAG pipeline | http://localhost:8000 |
libs/ai-cli |
Shared developer CLI utilities | — |
| Method | Path | Service |
|---|---|---|
POST |
/api/v1/gateway/agent/dispatch |
Gateway → Agent Core proxy |
POST |
/api/v1/agent/chat |
Agent Core chat entry |
GET |
/ |
Agent Core health/status |
| Service | Docs URL | OpenAPI JSON |
|---|---|---|
| Gateway (NestJS) | http://localhost:3000/api/docs | http://localhost:3000/api/docs-json |
| Agent Core (FastAPI) | http://localhost:8000/docs | http://localhost:8000/openapi.json |
| Agent Core ReDoc | http://localhost:8000/redoc | — |
- Node.js 20+
- npm 10+
- Python 3.11+
- Git
- Optional: MongoDB (
localhost:27017), Kafka (localhost:9092), OpenAI + Pinecone API keys
git clone <your-repo-url> enterprise-ai-workspace
cd enterprise-ai-workspace
npm installCopy the example env files and fill in real values:
# Windows PowerShell
Copy-Item agent-core\.env.example agent-core\.env
Copy-Item apps\gateway-server\.env.example apps\gateway-server\.env
# macOS / Linux
cp agent-core/.env.example agent-core/.env
cp apps/gateway-server/.env.example apps/gateway-server/.envNever commit .env files. Only .env.example files are tracked.
cd agent-core
python -m venv .venv
# Windows
.\.venv\Scripts\Activate.ps1
# macOS / Linux
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000From the workspace root (another terminal):
npm run start:gateway
# or
npx nx serve gateway-serverGateway listens on http://localhost:3000.
From the workspace root (another terminal):
npm run start:client
# or
npx nx serve clientClient listens on http://localhost:4200 and posts prompts to:
http://localhost:3000/api/v1/gateway/agent/dispatch
| Variable | Required | Description |
|---|---|---|
APP_ENV |
No | Runtime environment (development, production) |
DEBUG |
No | Enable debug mode (true / false) |
OPENAI_API_KEY |
Yes | OpenAI API key for LLM / embeddings |
PINECONE_API_KEY |
Yes | Pinecone vector DB API key |
PINECONE_ENVIRONMENT |
No | Pinecone region / environment (default us-east-1) |
| Variable | Required | Description |
|---|---|---|
PORT |
No | Gateway HTTP port (default 3000) |
NODE_ENV |
No | Node environment |
MONGO_URI |
No | MongoDB connection string |
AI_CORE_URL |
Yes | Full agent-core chat URL |
KAFKA_BROKERS |
No | Comma-separated Kafka brokers |
JWT_SECRET |
Yes | Secret used to sign/verify JWTs |
JWT_EXPIRES_IN |
No | Token lifetime (e.g. 1h) |
KAFKA_CLIENT_ID |
No | Kafka client id |
KAFKA_GROUP_ID |
No | Kafka consumer group |
KAFKA_AI_EVENTS_TOPIC |
No | Topic for AI gateway events |
See:
| Command | Description |
|---|---|
npm run start:client |
Serve Angular studio |
npm run start:gateway |
Serve NestJS gateway |
npm run build |
Build all Node projects |
npm run build:client |
Build Angular app |
npm run build:gateway |
Build NestJS gateway |
npm run build:ai-cli |
Build shared CLI library |
npx nx graph |
Visualize project graph |
- Standalone components
-
AgentTerminalComponentfor real-time prompt/console UX -
AiGatewayServiceRxJS HTTP client to the Nest gateway
- Domain modules:
auth,ai-gateway,events - JWT strategy + guard
- Proxies validated prompts to Python agent-core
- Kafka producer/consumer for gateway events (degrades gracefully if Kafka is down)
- FastAPI entrypoint (
app/main.py) - LangGraph workflow (
app/graph.py) - RAG / LlamaIndex + Pinecone service (
app/service.py) - Settings via
python-dotenv+ pydantic (app/config.py)
- Shared Commander-based CLI helpers
- Path alias:
@enterprise-ai/ai-cli
Prerequisites: Docker Desktop with Compose v2.
- Ensure env files exist and contain real keys:
Copy-Item agent-core\.env.example agent-core\.env
Copy-Item apps\gateway-server\.env.example apps\gateway-server\.env- Build and start the full stack:
docker compose up --build -d
# or
npm run docker:up- Open:
| Service | URL |
|---|---|
| Client UI | http://localhost:4200 |
| Gateway Swagger | http://localhost:3000/api/docs |
| Agent Core Swagger | http://localhost:8000/docs |
- Useful commands:
npm run docker:ps # container status
npm run docker:logs # follow logs
npm run docker:down # stop stack
docker compose up --build agent-core gateway-server # subset onlyCompose wires internal networking automatically:
- Gateway →
http://agent-core:8000/api/v1/agent/chat - Gateway →
mongodb://mongo:27017/enterprise-ai - Gateway →
kafka:29092
- Copy both
.env.examplefiles to.env - Set OpenAI / Pinecone keys in
agent-core/.env - Set a strong
JWT_SECRETinapps/gateway-server/.env - Confirm
AI_CORE_URL=http://localhost:8000/api/v1/agent/chat - Start agent-core → gateway → client (in that order)
- Open the studio UI and submit a prompt
GitHub Actions workflows:
-
.github/workflows/ci-pipeline.yml— Node/Python build checks -
.github/workflows/docker.yml— Compose validate + image builds
Jobs (app CI):
-
gateway-validation —
npm ci+nx build gateway-server - ai-core-validation — install Python deps + flake8 syntax checks
-
client-validation —
npm ci+nx build client
-
.envfiles are gitignored - Do not commit API keys, JWT secrets, or connection strings
- Rotate any secrets that were previously committed or shared
- Prefer short-lived tokens and least-privilege cloud keys in production
UNLICENSED / private repository.