{"id":31675025,"url":"https://github.com/nagell/chat-nest","last_synced_at":"2026-04-30T08:33:33.393Z","repository":{"id":316479245,"uuid":"1062058496","full_name":"Nagell/chat-nest","owner":"Nagell","description":"  🚀 NestJS chat API with real-time messaging, guaranteed email notifications and zero message loss. Features WebSocket support, session management, and comprehensive validation.","archived":false,"fork":false,"pushed_at":"2025-09-24T20:00:25.000Z","size":126,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T22:08:42.342Z","etag":null,"topics":["nestjs","nodemailer","socket-io","supabase","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nagell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T18:45:27.000Z","updated_at":"2025-09-24T20:00:29.000Z","dependencies_parsed_at":"2025-09-24T22:09:25.888Z","dependency_job_id":"fcf25f95-cb32-44eb-8735-4b202793496e","html_url":"https://github.com/Nagell/chat-nest","commit_stats":null,"previous_names":["nagell/chat-nest"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Nagell/chat-nest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nagell%2Fchat-nest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nagell%2Fchat-nest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nagell%2Fchat-nest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nagell%2Fchat-nest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nagell","download_url":"https://codeload.github.com/Nagell/chat-nest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nagell%2Fchat-nest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278891744,"owners_count":26063856,"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-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["nestjs","nodemailer","socket-io","supabase","typescript"],"created_at":"2025-10-08T04:59:09.488Z","updated_at":"2025-10-08T04:59:11.362Z","avatar_url":"https://github.com/Nagell.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca id=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003c!-- PROJECT SHIELDS --\u003e\n[![CC BY-NC 4.0][license-shield]][license-url]\n[![LinkedIn][linkedin-shield]][linkedin-url]\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch3 align=\"center\"\u003eChat-Nest API\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    NestJS-based chat system backend with real-time messaging and guaranteed email notifications\n    \u003cbr /\u003e\n    \u003ca href=\"./docs/DEVELOPMENT.md\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/Nagell/chat-nest/issues/new?labels=bug\u0026template=bug-report---.md\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/Nagell/chat-nest/issues/new?labels=enhancement\u0026template=feature-request---.md\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#api-endpoints\"\u003eAPI Endpoints\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#deployment\"\u003eDeployment\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\nA robust NestJS-based chat system backend with REST API and WebSocket support. Designed to work with any modern frontend framework. Features zero message loss, guaranteed email notifications, and real-time communication capabilities.\n\n### Key Features\n\n- **Zero Message Loss**: All messages saved to database with atomic transactions\n- **Guaranteed Email Notifications**: Every visitor message triggers an email to admin\n- **Real-time Communication**: WebSocket support for instant messaging\n- **Session Management**: Automatic session creation and management\n- **Admin Dashboard API**: Complete session and message management\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n### Built With\n\n- [![NestJS][NestJS]][NestJS-url]\n- [![Supabase][Supabase]][Supabase-url]\n- [![TypeScript][TypeScript]][TypeScript-url]\n- [![Socket.IO][Socket.IO]][Socket.IO-url]\n- [![Nodemailer][Nodemailer]][Nodemailer-url]\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/en/)\n- [pnpm](https://pnpm.io/)\n- [Supabase account](https://supabase.com/)\n- [Docker Desktop](https://www.docker.com/products/docker-desktop/)\n- Email SMTP credentials (Gmail recommended)\n\n### Installation\n\n1. Clone the repository\n\n   ```sh\n   git clone https://github.com/Nagell/dawid-nitka-chat.git\n   ```\n\n2. Install packages\n\n   ```sh\n   pnpm install\n   ```\n\n3. Copy `.env.example` to `.env` and configure your environment variables\n\n   ```sh\n   cp .env.example .env\n   ```\n\n4. Set up your database using Supabase migrations (see [Development Guide](./docs/DEVELOPMENT.md#database-development) for details)\n\n   ```sh\n   # For local development\n   pnpm supabase start\n\n   # For production setup\n   pnpm supabase login\n   pnpm supabase link --project-ref \u003cyour-project-id\u003e\n   pnpm supabase db push\n   ```\n\n5. Start the development server\n\n   ```sh\n   pnpm run start:dev\n   ```\n\n6. The server will start on `http://localhost:3001`\n\n### Quick Start - Test the API\n\nOnce running, test the API with these simple curl commands:\n\n```sh\n# Health check\ncurl http://localhost:3001/api/chat/health\n\n# Create a chat session\ncurl -X POST http://localhost:3001/api/chat/sessions \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"visitor_email\":\"test@example.com\",\"visitor_name\":\"Test User\"}'\n\n# Send a message (use session_id from previous response)\ncurl -X POST http://localhost:3001/api/chat/messages \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"session_id\":1,\"content\":\"Hello!\",\"sender_type\":\"visitor\"}'\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- API ENDPOINTS --\u003e\n## API Endpoints\n\n### Chat Sessions\n\n- `POST /api/chat/sessions` - Create a new chat session\n- `GET /api/chat/sessions/{id}` - Get session details\n- `GET /api/chat/sessions/{id}/messages` - Get messages for a session\n- `POST /api/chat/sessions/{id}/mark-read` - Mark messages as read\n\n### Messages\n\n- `POST /api/chat/messages` - Send a new message\n\n### Admin\n\n- `GET /api/chat/admin/sessions` - Get all sessions with summary\n- `GET /api/chat/admin/stats` - Get WebSocket connection statistics\n\n### Health Check\n\n- `GET /api/chat/health` - Health check endpoint\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- ROADMAP --\u003e\n## Roadmap\n\n### ✅ Completed Features\n\n- [x] **Backend Architecture** - Complete NestJS setup with modular structure\n- [x] **Database Schema** - Comprehensive Supabase schema with triggers and RPC functions\n- [x] **REST API Endpoints** - Full CRUD operations tested in local and production environments\n- [x] **Input Validation** - class-validator DTOs with email, length, and type validation\n- [x] **WebSocket Gateway** - Server-side gateway with room management and typing indicators\n- [x] **Email Notifications** - HTML email service tested and working with Gmail SMTP\n- [x] **Environment Configuration** - Production/development environment separation working\n- [x] **HTML Security** - XSS protection with proper input escaping implemented\n- [x] **Database Testing** - Both local and production Supabase connections verified\n- [x] **Production Environment** - Production server tested with isolated database\n\n### 🔄 In Progress\n\n- [ ] **WebSocket Client Testing** - Need to test real-time functionality from client side\n- [ ] **Security Hardening** - Critical authentication guards and session security needed\n\n### ⏳ Upcoming Features\n\n- [ ] **Session Authentication** - Token-based session access control\n- [ ] **Admin Authentication** - Cross-Supabase JWT validation for admin endpoints\n- [ ] **Rate Limiting** - Protection against spam and abuse\n- [ ] **API Documentation** - OpenAPI/Swagger documentation generation\n- [ ] **Frontend Integration** - Nuxt.js components for portfolio integration\n- [ ] **Admin Dashboard** - Complete session management interface\n- [ ] **Performance Optimization** - Caching and query optimization\n- [ ] **Deployment Setup** - Production deployment to Vercel/Railway\n\n### 🚨 Security Priorities\n\n- [ ] **Session Access Control** - Prevent unauthorized access to chat sessions\n- [ ] **Admin Endpoint Protection** - Secure admin functionality with proper authentication\n- [ ] **WebSocket Validation** - Add validation DTOs for WebSocket message events\n- [ ] **Security Headers** - Add helmet middleware with security headers\n\nSee [TODO.md](./TODO.md) for detailed implementation progress and security audit findings.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- DEPLOYMENT --\u003e\n## Deployment\n\n### Vercel Deployment\n\n1. Deploy to Vercel:\n\n   ```bash\n   pnpm add -g vercel\n   vercel --prod\n   ```\n\n2. Set environment variables in Vercel dashboard\n\n### Railway Deployment\n\n1. Connect your repository to Railway\n2. Set environment variables\n3. Deploy automatically on push\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the CC BY-NC 4.0 License. See `LICENSE` for more information.\n\n[![CC BY-NC 4.0][cc-by-nc-image]][cc-by-nc]\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\nDawid Nitka - [LinkedIn][linkedin-url]\n\nProject Link: [https://github.com/Nagell/chat-nest](https://github.com/Nagell/chat-nest)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n[license-shield]: https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg?style=for-the-badge\n[license-url]: ./LICENSE\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge\u0026logo=linkedin\u0026colorB=555\n[linkedin-url]: https://www.linkedin.com/in/dawidnitka\n\n[NestJS]: https://img.shields.io/badge/nestjs-E0234E?style=for-the-badge\u0026logo=nestjs\u0026logoColor=white\n[NestJS-url]: https://nestjs.com/\n[Supabase]: https://img.shields.io/badge/Supabase-000000?style=for-the-badge\u0026logo=supabase\u0026logoColor=white\n[Supabase-url]: https://supabase.com/\n[TypeScript]: https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge\u0026logo=typescript\u0026logoColor=white\n[TypeScript-url]: https://www.typescriptlang.org/\n[Socket.IO]: https://img.shields.io/badge/Socket.io-010101?style=for-the-badge\u0026logo=socket.io\u0026logoColor=white\n[Socket.IO-url]: https://socket.io/\n[Nodemailer]: https://img.shields.io/badge/Nodemailer-0F9DCE?style=for-the-badge\u0026logo=nodemailer\u0026logoColor=white\n[Nodemailer-url]: https://nodemailer.com/\n\n[cc-by-nc]: https://creativecommons.org/licenses/by-nc/4.0/\n[cc-by-nc-image]: https://licensebuttons.net/l/by-nc/4.0/88x31.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagell%2Fchat-nest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnagell%2Fchat-nest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagell%2Fchat-nest/lists"}