{"id":48749141,"url":"https://github.com/harshlocham/chat-app","last_synced_at":"2026-05-03T07:01:39.513Z","repository":{"id":311206451,"uuid":"1010085062","full_name":"harshlocham/chat-app","owner":"harshlocham","description":"Production-grade real-time chat system with scalable architecture","archived":false,"fork":false,"pushed_at":"2026-04-29T18:06:22.000Z","size":6361,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-29T19:12:31.983Z","etag":null,"topics":["chat","fullstack","javascript","messaging","nextjs","react","real-time","socket-io","typescript"],"latest_commit_sha":null,"homepage":"https://chat.harshlocham.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harshlocham.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":"SECURITY_AUDIT.md","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-06-28T10:04:22.000Z","updated_at":"2026-04-29T17:58:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"a79f4421-96e2-4aca-89f3-5f7ecdf6bd2e","html_url":"https://github.com/harshlocham/chat-app","commit_stats":null,"previous_names":["harshdeepsinghlocham/chat-app","harshlocham/chat-app"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/harshlocham/chat-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshlocham%2Fchat-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshlocham%2Fchat-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshlocham%2Fchat-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshlocham%2Fchat-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harshlocham","download_url":"https://codeload.github.com/harshlocham/chat-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshlocham%2Fchat-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32560914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chat","fullstack","javascript","messaging","nextjs","react","real-time","socket-io","typescript"],"created_at":"2026-04-12T15:56:17.241Z","updated_at":"2026-05-03T07:01:39.508Z","avatar_url":"https://github.com/harshlocham.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat App\n\nA production-oriented real-time chat monorepo built with Next.js 15, Socket.IO, MongoDB, and Turborepo.\n\n## Overview\n\nThis repository is structured to separate web UI, real-time transport, and shared domain code. It supports direct and group conversations, presence, delivery and seen tracking, and admin moderation flows.\n\n## Core capabilities\n\n- Real-time direct and group messaging\n- Typing indicators and online presence\n- Message reactions, edits, and deletes\n- Delivery and seen states\n- NextAuth-based authentication (Google and credentials/OTP)\n- Image upload signing through ImageKit\n- Admin APIs for moderation and reporting\n- Docker Compose setup for local or containerized development\n\n## Monorepo structure\n\n```text\n.\n├── apps/\n│   ├── web/        # Next.js app (UI + API routes)\n│   └── socket/     # Socket.IO transport server\n├── packages/\n│   ├── db/         # Mongo connection + models\n│   ├── services/   # Shared business logic, validators, repositories\n│   ├── redis/      # Redis and presence helpers\n│   └── types/      # Shared types and socket event contracts\n├── docker/\n├── nginx/\n├── docker-compose.yml\n└── turbo.json\n```\n\n## Architecture\n\n1. The web app handles pages, authentication, and API endpoints.\n2. API routes use shared packages for validation, persistence, and normalization.\n3. The socket app handles real-time connections and room-based event broadcasting.\n4. Shared contracts in packages/types keep client and server payloads aligned.\n5. Redis is used for scalable socket coordination, with development-friendly behavior when not configured.\n\n## Prerequisites\n\n- Node.js 20+\n- npm 10+\n- MongoDB\n- Redis (recommended)\n\n## Environment configuration\n\nCreate a root .env file.\n\n```env\n# Core\nMONGODB_URI=mongodb://localhost:27017/chat-app\nNEXTAUTH_SECRET=replace_with_a_strong_secret\nNEXTAUTH_URL=http://localhost:3000\n\n# Socket and internal bridge\nINTERNAL_SECRET=replace_with_shared_internal_secret\nORIGIN=http://localhost:3000\nREDIS_URL=redis://localhost:6379\nNEXT_PUBLIC_SOCKET_URL=http://localhost:3001\n\n# OAuth (optional)\nGOOGLE_CLIENT_ID=\nGOOGLE_CLIENT_SECRET=\n\n# ImageKit (required if image upload is enabled)\nNEXT_PUBLIC_PUBLIC_KEY=\nIMAGEKIT_PUBLIC_KEY=\nIMAGEKIT_PRIVATE_KEY=\nNEXT_PUBLIC_URI_ENDPOINT=\n\n# Email/OTP (optional)\nSMTP_HOST=\nSMTP_PORT=587\nSMTP_USER=\nSMTP_PASS=\nEMAIL_USER=\nEMAIL_PASS=\nEMAIL_FROM=\n```\n\n## Local development\n\n1. Install dependencies.\n\n```bash\nnpm install\n```\n\n2. Start all workspaces in development mode.\n\n```bash\nnpm run dev\n```\n\n3. Open the applications.\n- Web: http://localhost:3000\n- Socket server: http://localhost:3001\n\n## Scripts\n\nFrom the repository root:\n\n| Script | Description |\n| --- | --- |\n| npm run dev | Runs development mode for all workspaces via Turborepo |\n| npm run build | Builds all workspaces |\n| npm run start | Starts production targets where defined |\n| npm run lint | Runs lint tasks across workspaces |\n| npm run clean | Runs clean tasks across workspaces |\n\n## Docker\n\nTo run with containers:\n\n```bash\ndocker compose up --build\n```\n\nThe compose stack includes:\n\n- nginx\n- nextapp\n- socket\n- redis\n\n## Troubleshooting\n\n- If ports 3000 or 3001 are busy, stop the existing processes and restart.\n- If authentication fails, verify NEXTAUTH_SECRET and NEXTAUTH_URL.\n- If realtime events do not connect, verify ORIGIN, INTERNAL_SECRET, and NEXT_PUBLIC_SOCKET_URL.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshlocham%2Fchat-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharshlocham%2Fchat-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshlocham%2Fchat-app/lists"}