{"id":48883082,"url":"https://github.com/lessup/chatroom","last_synced_at":"2026-04-16T04:01:02.936Z","repository":{"id":325778530,"uuid":"1094419113","full_name":"LessUp/chatroom","owner":"LessUp","description":"Real-Time Chat Room: Go + Gin + WebSocket Backend, React + TypeScript Frontend, JWT Auth \u0026 Prometheus | 实时聊天室：Go + Gin + WebSocket 后端，React + TypeScript 前端，JWT 鉴权与 Prometheus 监控","archived":false,"fork":false,"pushed_at":"2026-04-13T11:01:53.000Z","size":935,"stargazers_count":0,"open_issues_count":16,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-13T13:07:35.394Z","etag":null,"topics":["chat","docker","go","golang","instant-messaging","react","real-time","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","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/LessUp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-11-11T17:22:11.000Z","updated_at":"2026-04-13T11:01:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/LessUp/chatroom","commit_stats":null,"previous_names":["lessup/chatroom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LessUp/chatroom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LessUp%2Fchatroom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LessUp%2Fchatroom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LessUp%2Fchatroom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LessUp%2Fchatroom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LessUp","download_url":"https://codeload.github.com/LessUp/chatroom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LessUp%2Fchatroom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["chat","docker","go","golang","instant-messaging","react","real-time","websocket"],"created_at":"2026-04-16T04:00:58.605Z","updated_at":"2026-04-16T04:01:02.929Z","avatar_url":"https://github.com/LessUp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatRoom\n\n[![CI](https://github.com/LessUp/chatroom/actions/workflows/ci.yml/badge.svg)](https://github.com/LessUp/chatroom/actions/workflows/ci.yml)\n[![Docs](https://github.com/LessUp/chatroom/actions/workflows/pages.yml/badge.svg)](https://lessup.github.io/chatroom/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\nEnglish | [简体中文](README.zh-CN.md)\n\nA teaching-oriented real-time chat room project built with Go, React, PostgreSQL, REST API, and WebSocket.\n\n**Design Philosophy**: Runnable, Understandable, Verifiable, Extendable — not feature-heavy.\n\n## Features\n\n- **Authentication**: JWT + Refresh Token with automatic rotation\n- **Real-time Chat**: WebSocket with room-based broadcasting\n- **Presence**: Online count, join/leave events, typing indicators\n- **History**: Paginated message history with cursor-based loading\n- **Security**: Rate limiting, CORS validation, input sanitization\n- **Observability**: Prometheus metrics, structured logging, health checks\n- **Deployment**: Docker, Kubernetes manifests, GitHub Actions CI/CD\n\n## Quick Start\n\n### Prerequisites\n\n- Go 1.24+\n- Node.js 20+\n- Docker \u0026 Docker Compose\n\n### Run Locally\n\n```bash\n# 1. Start PostgreSQL\ndocker compose up -d postgres\n\n# 2. Start backend (Terminal 1)\ngo run ./cmd/server\n\n# 3. Start frontend (Terminal 2)\nnpm --prefix frontend ci\nnpm --prefix frontend run dev\n```\n\n### Access\n\n| Service | URL |\n|---------|-----|\n| Frontend (Dev) | http://localhost:5173 |\n| Backend | http://localhost:8080 |\n| Health Check | http://localhost:8080/health |\n| Ready Check | http://localhost:8080/ready |\n| Version | http://localhost:8080/version |\n| Metrics | http://localhost:8080/metrics |\n\n## Tech Stack\n\n| Layer | Technology |\n|-------|------------|\n| Backend | Go 1.24, Gin, GORM, gorilla/websocket, zerolog |\n| Frontend | React 19, TypeScript, Vite 7, Tailwind CSS v4 |\n| Database | PostgreSQL 16 |\n| Monitoring | Prometheus, Grafana |\n| Deployment | Docker, Kubernetes |\n\n## Project Structure\n\n```\nchatroom/\n├── cmd/server/              # Application entry point\n├── internal/                # Private packages\n│   ├── auth/                # JWT, password hashing, tokens\n│   ├── config/              # Configuration loading\n│   ├── db/                  # Database connection, migrations\n│   ├── server/              # HTTP routes and handlers\n│   ├── service/             # Business logic layer\n│   ├── ws/                  # WebSocket Hub and connections\n│   ├── mw/                  # Middleware (auth, rate limit, CORS)\n│   ├── metrics/             # Prometheus metrics\n│   └── models/              # GORM data models\n├── frontend/                # React frontend\n├── web/                     # Static fallback UI\n├── docs/                    # VitePress documentation site\n├── deploy/                  # Docker, Kubernetes configs\n└── .github/workflows/       # CI/CD pipelines\n```\n\n## Configuration\n\nThe backend reads configuration from **environment variables**. It does NOT auto-load `.env` files.\n\nKey configuration options:\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `APP_PORT` | 8080 | HTTP port |\n| `APP_ENV` | dev | Environment (dev/staging/production) |\n| `DATABASE_DSN` | localhost | PostgreSQL connection string |\n| `JWT_SECRET` | dev-secret-change-me | JWT signing key (MUST change in production) |\n| `ALLOWED_ORIGINS` | - | CORS allowed origins (comma-separated) |\n| `ACCESS_TOKEN_TTL_MINUTES` | 15 | Access token lifetime |\n| `REFRESH_TOKEN_TTL_DAYS` | 7 | Refresh token lifetime |\n\nSee `.env.example` for the complete list.\n\n## Commands\n\n```bash\n# Go\nmake test          # Run tests\nmake lint          # Lint code\nmake build         # Build binary\nmake all           # lint + test + build\n\n# Frontend\nnpm --prefix frontend run dev     # Development server\nnpm --prefix frontend run build   # Production build\nnpm --prefix frontend run test    # Run tests\n\n# Docker\ndocker compose up -d              # Start all services\ndocker compose up -d postgres     # Database only\n```\n\n## Documentation\n\n- 📖 [Documentation Site](https://lessup.github.io/chatroom/)\n- 🚀 [Getting Started](docs/getting-started.md)\n- 📚 [API Reference](docs/API.md)\n- 🏗️ [Architecture](docs/ARCHITECTURE.md)\n- 🎨 [Design Decisions](docs/DESIGN.md)\n- ❓ [FAQ](docs/FAQ.md)\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## Security\n\nSee [SECURITY.md](SECURITY.md) for security policy and best practices.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessup%2Fchatroom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flessup%2Fchatroom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessup%2Fchatroom/lists"}