{"id":29133125,"url":"https://github.com/morbargig/iagent","last_synced_at":"2026-05-08T04:03:51.016Z","repository":{"id":298500253,"uuid":"1000179466","full_name":"morbargig/iAgent","owner":"morbargig","description":"chat bot template","archived":false,"fork":false,"pushed_at":"2025-07-14T17:34:33.000Z","size":12444,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-14T18:14:37.969Z","etag":null,"topics":["chatbot","cursor","nestjs","nx","react","stream"],"latest_commit_sha":null,"homepage":"https://morbargig.github.io/iAgent/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morbargig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-11T11:38:41.000Z","updated_at":"2025-07-14T17:34:36.000Z","dependencies_parsed_at":"2025-06-29T13:25:11.605Z","dependency_job_id":"5dce5562-daaf-472a-93b8-635462f81ed3","html_url":"https://github.com/morbargig/iAgent","commit_stats":null,"previous_names":["morbargig/chatbot-temp","morbargig/iagent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morbargig/iAgent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morbargig%2FiAgent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morbargig%2FiAgent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morbargig%2FiAgent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morbargig%2FiAgent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morbargig","download_url":"https://codeload.github.com/morbargig/iAgent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morbargig%2FiAgent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266454758,"owners_count":23931335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","cursor","nestjs","nx","react","stream"],"created_at":"2025-06-30T07:02:01.100Z","updated_at":"2026-05-08T04:03:51.007Z","avatar_url":"https://github.com/morbargig.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 iAgent - AI Chat Application\n\n\u003e **📖 Documentation:**\n\u003e - **[DESIGN_PATTERNS_GUIDE.md](./DESIGN_PATTERNS_GUIDE.md)** - Generic design patterns and architectural principles (read first)\n\u003e - **[INFRASTRUCTURE_GUIDE.md](./INFRASTRUCTURE_GUIDE.md)** - Project-specific implementation details\n\u003e - **[STYLE_GUIDE.md](./STYLE_GUIDE.md)** - CSS style guidelines and design system\n\u003e - **[.cursorrules](./.cursorrules)** - AI assistant rules and patterns\n\n[![Made with Nx](https://img.shields.io/badge/Made%20with-Nx-blue)](https://nx.dev)\n[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n[![React](https://img.shields.io/badge/React-20232A?logo=react\u0026logoColor=61DAFB)](https://reactjs.org/)\n[![Material-UI](https://img.shields.io/badge/Material--UI-0081CB?logo=material-ui\u0026logoColor=white)](https://mui.com/)\n[![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-38B2AC?logo=tailwind-css\u0026logoColor=white)](https://tailwindcss.com/)\n[![NestJS](https://img.shields.io/badge/NestJS-E0234E?logo=nestjs\u0026logoColor=white)](https://nestjs.com/)\n\nA modern, full-stack AI chat application built with React, NestJS, and TypeScript in an Nx monorepo. Features real-time streaming, multi-language support, and a beautiful Material-UI interface.\n\n## ✨ Features\n\n- 🔄 **Real-time Streaming** - Live AI response streaming with Server-Sent Events\n- 🌍 **Multi-language Support** - English, Hebrew, Arabic with RTL/LTR support\n- 🎨 **Modern UI** - Beautiful Material-UI components with dark/light themes\n- 📱 **Mobile Responsive** - Optimized for all screen sizes\n- 🛡️ **Type Safe** - Full TypeScript implementation\n- 📚 **API Documentation** - Comprehensive Swagger/OpenAPI docs\n- 🎯 **Mock Mode** - Built-in mock responses for development\n- 💾 **Persistent Storage** - Conversation history and preferences\n\n## 🏗️ Architecture\n\nThe iAgent application follows a microservices architecture with a Backend-for-Frontend (BFF) pattern:\n\n![Architecture Diagram](./docs/architecture.svg)\n\n### Architecture Overview\n\n```\niAgent/\n├── apps/\n│   ├── frontend/          # React application with Material-UI (Port 4200)\n│   ├── backend/           # NestJS BFF - Chat persistence \u0026 proxy (Port 3030)\n│   └── agent-api/         # NestJS streaming service (Port 3033)\n├── libs/\n│   ├── chat-types/        # Shared DTOs and types\n│   └── shared-renderer/   # Markup parsing utilities\n├── docs/                  # Documentation\n└── scripts/               # Build and deployment scripts\n```\n\n### Request Flow\n\n1. **Frontend** → Sends chat request to **Backend** via HTTP/SSE\n2. **Backend** → Validates request, saves user message to MongoDB\n3. **Backend** → Proxies request to **Agent API** for streaming\n4. **Agent API** → Generates streaming response with mock data\n5. **Backend** → Streams chunks back to **Frontend** and saves final message to MongoDB\n\n### Components\n\n- **Frontend (React)**: User interface with real-time streaming, multi-language support, and chat management\n- **Backend (BFF)**: Handles authentication, chat persistence (MongoDB), file management, and proxies streaming requests\n- **Agent API**: Dedicated service for streaming logic, mock generation, and response formatting\n- **Shared Libraries**: Common DTOs and utilities used across all applications\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- Node.js \u003e= 18.0.0\n- npm \u003e= 8.0.0\n\n### Installation \u0026 Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/morbargig/iAgent.git\ncd iAgent\n\n# Install dependencies\nnpm install\n\n# Start the frontend (React app with Vite)\nnpx nx serve @iagent/frontend\n# The app will be available at: http://localhost:4200/iAgent/\n\n# Start the backend (NestJS BFF)\nnpx nx serve @iagent/backend\n# The API will be available at: http://localhost:3030\n\n# Start the agent-api (NestJS streaming service)\nnpx nx serve agent-api\n# The API will be available at: http://localhost:3033\n\n# Or use npm scripts to start all services\nnpm run dev  # Starts frontend, backend, and agent-api concurrently\n```\n\n### Available Scripts\n\n```bash\n# Development (using Nx)\nnpx nx serve @iagent/frontend   # Start React app at http://localhost:4200/iAgent/\nnpx nx serve @iagent/backend    # Start NestJS BFF at http://localhost:3030\nnpx nx serve agent-api          # Start Agent API at http://localhost:3033\n\n# Building (using Nx)\nnpx nx build @iagent/frontend   # Build React app\nnpx nx build @iagent/backend    # Build NestJS BFF\nnpx nx build agent-api          # Build Agent API\nnpx nx run-many -t build        # Build all projects\n\n# Testing (using Nx)\nnpx nx test @iagent/frontend    # Test React app\nnpx nx test @iagent/backend     # Test NestJS BFF\nnpx nx test agent-api           # Test Agent API\nnpx nx run-many -t test         # Test all projects\n\n# Linting (using Nx)\nnpx nx lint @iagent/frontend    # Lint React app\nnpx nx lint @iagent/backend     # Lint NestJS BFF\nnpx nx lint agent-api           # Lint Agent API\nnpx nx run-many -t lint         # Lint all projects\n\n# Utilities\nnpx nx graph                    # View dependency graph\nnpx nx reset                    # Reset Nx cache\nnpx nx affected:build           # Build affected projects\nnpx nx affected:test            # Test affected projects\n\n# Legacy npm scripts (if configured)\nnpm run dev:frontend     # Alternative to npx nx serve @iagent/frontend\nnpm run dev:backend      # Alternative to npx nx serve @iagent/backend\n```\n\n## 🛠️ Tech Stack\n\n### Frontend\n- **React 19** - Latest React with concurrent features\n- **TypeScript** - Type-safe development\n- **Material-UI v7** - Modern Material Design components\n- **Vite** - Fast build tool and dev server\n- **React Markdown** - Markdown rendering with syntax highlighting\n\n### Backend\n- **NestJS 11** - Progressive Node.js framework\n- **TypeScript** - Type-safe server development\n- **Express** - Fast, unopinionated web framework\n- **Swagger/OpenAPI** - API documentation and testing\n- **Server-Sent Events** - Real-time streaming\n\n### Development Tools\n- **Nx** - Monorepo management and build system\n- **ESLint** - Code linting and formatting\n- **Jest** - Testing framework\n- **Prettier** - Code formatting\n\n## 📱 Applications\n\n### [Frontend](./apps/frontend/README.md)\nReact-based chat interface with Material-UI components, real-time streaming, and multi-language support.\n\n**Key Features:**\n- Real-time message streaming\n- Dark/light theme switching\n- Mobile-responsive design\n- Conversation management\n- Message actions (copy, edit, regenerate)\n\n### [Backend](./apps/backend/README.md)\nNestJS BFF (Backend-for-Frontend) providing chat persistence, authentication, and request proxying.\n\n**Key Features:**\n- RESTful API with Swagger docs\n- Chat persistence with MongoDB\n- Authentication and authorization\n- Request validation and error handling\n- File upload and management\n- Proxies streaming requests to Agent API\n\n### [Agent API](./apps/agent-api/)\nNestJS service dedicated to streaming logic and mock generation.\n\n**Key Features:**\n- Server-Sent Events streaming\n- Mock response generation\n- Tokenization and delay calculation\n- Response formatting\n- Swagger documentation\n\n## 🌐 API Documentation\n\nWhen running the services, comprehensive API documentation is available at:\n\n**Backend (BFF):**\n- **Swagger UI**: http://localhost:3030/docs\n- **API Base**: http://localhost:3030/api\n\n**Agent API:**\n- **Swagger UI**: http://localhost:3033/docs\n- **API Base**: http://localhost:3033/api\n\n## 🔧 Configuration\n\n### Environment Variables\n\n⚠️ **Important**: Sensitive data (MongoDB connection strings, JWT secrets, passwords) are no longer hardcoded. You **MUST** configure environment variables before running the application.\n\n#### Getting Environment Configuration Files\n\n**Note**: The `.env` and `.env.prod` files containing production credentials are **not included** in this repository for security reasons.\n\n- **To get the environment configuration files**, please contact [@morbargig](https://github.com/morbargig) on GitHub\n- **Alternatively**, you can create your own `.env` files using the `.env.example` template and your own credentials\n\nSee the sections below for setting up your environment files.\n\n#### Backend Environment Setup\n\n1. **Option A: Get environment files from the maintainer**\n   - Contact [@morbargig](https://github.com/morbargig) to request the `.env` and `.env.prod` files\n   - Place them in `apps/backend/` directory\n\n2. **Option B: Create your own environment files**\n   - Copy the example environment file:\n     ```bash\n     cp apps/backend/.env.example apps/backend/.env\n     ```\n   - Fill in your actual values in `apps/backend/.env`:\n     ```bash\n     # Required variables (see .env.example for full list)\n     MONGODB_URI=your_mongodb_connection_string_here\n     JWT_SECRET=your_jwt_secret_key_here\n     DB_NAME=filesdb\n     ```\n\n3. **Generate a secure JWT secret** (if creating your own):\n   ```bash\n   openssl rand -base64 32\n   ```\n\n📋 **See** [`apps/backend/.env.example`](./apps/backend/.env.example) for a complete list of all environment variables.\n\n#### Frontend Environment Setup\n\nCreate `apps/frontend/.env`:\n```bash\nVITE_API_BASE_URL=http://localhost:3000\nVITE_MOCK_MODE=false\n```\n\n#### GitHub Actions Secrets\n\nFor CI/CD workflows, configure secrets in GitHub:\n- Repository Settings → Secrets and variables → Actions\n\n📋 **See** [`.github/SECRETS.md`](./.github/SECRETS.md) for a complete guide on configuring GitHub Actions secrets.\n\n## 🚀 Deployment\n\n### Production Build\n```bash\n# Build both applications\nnpm run build\n\n# Files will be in:\n# - dist/apps/frontend/  (Static files for hosting)\n# - dist/apps/backend/   (Node.js server files)\n```\n\n### Docker Support\n```bash\n# Build Docker images (when Dockerfiles are added)\ndocker build -t iAgent-frontend ./apps/frontend\ndocker build -t iAgent-backend ./apps/backend\n```\n\n## 🧪 Testing\n\n```bash\n# Run all tests\nnpm run test\n\n# Run tests with coverage\nnpm run test -- --coverage\n\n# Run e2e tests\nnpm run e2e\n```\n\n## 📊 Nx Workspace\n\nThis project uses Nx for monorepo management:\n\n```bash\n# View project graph\nnpm run graph\n\n# Run affected tests only\nnpx nx affected:test\n\n# Build affected projects only\nnpx nx affected:build\n\n# Generate new library\nnpx nx g @nx/react:lib my-lib\n\n# Generate new application\nnpx nx g @nx/react:app my-app\n```\n\n## 🤝 Contributing\n\n1. **Fork the repository**\n2. **Create a feature branch**: `git checkout -b feature/amazing-feature`\n3. **Make your changes** following the existing code style\n4. **Add tests** for new functionality\n5. **Run tests**: `npm run test`\n6. **Commit changes**: `git commit -m 'Add amazing feature'`\n7. **Push to branch**: `git push origin feature/amazing-feature`\n8. **Open a Pull Request**\n\n### Development Guidelines\n\n- Follow TypeScript strict mode\n- Add tests for new features\n- Update documentation as needed\n- Use conventional commit messages\n- Ensure all linting passes\n\n## 📄 License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🔗 Links\n\n- [Frontend Documentation](./apps/frontend/README.md)\n- [Backend Documentation](./apps/backend/README.md)\n- [API Documentation](http://localhost:3000/api/docs) (when running)\n- [Nx Documentation](https://nx.dev)\n\n---\n\n**Built with ❤️ using React, NestJS, and Nx**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorbargig%2Fiagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorbargig%2Fiagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorbargig%2Fiagent/lists"}