# CS2.WTF [![SvelteKit](https://img.shields.io/badge/SvelteKit-5.0-FF3E00?style=flat-square&logo=svelte)](https://kit.svelte.dev/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-3178C6?style=flat-square&logo=typescript)](https://www.typescriptlang.org/) [![Tailwind CSS](https://img.shields.io/badge/Tailwind-3.4-06B6D4?style=flat-square&logo=tailwindcss)](https://tailwindcss.com/) [![GPL3](https://img.shields.io/badge/licence-GPL3-%23007ec6?style=flat-square)](https://git.harting.dev/CSGOWTF/csgowtf/src/branch/master/LICENSE) [![Liberapay](https://img.shields.io/badge/donate%20on-LiberaPay-%23f6c915?style=flat-square)](https://liberapay.com/CSGOWTF/) [![status-badge](https://ci.somegit.dev/api/badges/CSGOWTF/csgowtf/status.svg?branch=cs2-port)](https://ci.somegit.dev/CSGOWTF/csgowtf) **Statistics for CS2 matchmaking matches** - A complete rewrite of CSGOW.TF with modern web technologies. --- ## ๐Ÿš€ Quick Start ### Prerequisites - **Node.js** โ‰ฅ 18.0.0 (v20.11.0 recommended - see `.nvmrc`) - **npm** or **yarn** ### Installation ```bash # Clone the repository git clone https://somegit.dev/CSGOWTF/csgowtf.git cd csgowtf # Switch to the cs2-port branch git checkout cs2-port # Install dependencies npm install # Copy environment variables cp .env.example .env # Start development server npm run dev ``` The app will be available at `http://localhost:5173` --- ## ๐Ÿ“ฆ Tech Stack ### Core Framework - **SvelteKit 2.0** - Full-stack framework with SSR/SSG - **Svelte 5** - Reactive UI framework - **TypeScript 5.3** - Type safety (strict mode) - **Vite 5** - Build tool and dev server ### Styling - **Tailwind CSS 3.4** - Utility-first CSS framework - **DaisyUI 4.0** - Component library with CS2 custom themes - **PostCSS** - CSS processing ### Data & State - **Axios** - HTTP client for API requests - **Zod** - Runtime type validation and parsing - **Svelte Stores** - State management ### Testing - **Vitest** - Unit and component testing - **Playwright** - End-to-end testing - **Testing Library** - Component testing utilities - **MSW** - API mocking ### Code Quality - **ESLint** - Linting (TypeScript + Svelte) - **Prettier** - Code formatting - **Stylelint** - CSS linting - **Husky** - Git hooks - **lint-staged** - Pre-commit linting --- ## ๐Ÿ› ๏ธ Development ### Available Scripts ```bash # Development npm run dev # Start dev server npm run dev -- --host # Expose to network # Type Checking npm run check # Run type check npm run check:watch # Type check in watch mode # Linting & Formatting npm run lint # Run ESLint + Prettier check npm run lint:fix # Auto-fix linting issues npm run format # Format code with Prettier # Testing npm run test # Run unit tests npm run test:watch # Run tests in watch mode npm run test:coverage # Generate coverage report npm run test:e2e # Run E2E tests (headless) npm run test:e2e:ui # Run E2E tests with UI npm run test:e2e:debug # Debug E2E tests # Building npm run build # Build for production npm run preview # Preview production build ``` ### Project Structure ``` csgowtf/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ lib/ โ”‚ โ”‚ โ”œโ”€โ”€ api/ # API client & endpoints โ”‚ โ”‚ โ”œโ”€โ”€ components/ # Reusable Svelte components โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ layout/ # Header, Footer, Nav โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ui/ # Base UI components โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ charts/ # Data visualization โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ match/ # Match-specific components โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ player/ # Player-specific components โ”‚ โ”‚ โ”œโ”€โ”€ stores/ # Svelte stores (state) โ”‚ โ”‚ โ”œโ”€โ”€ types/ # TypeScript types โ”‚ โ”‚ โ”œโ”€โ”€ utils/ # Helper functions โ”‚ โ”‚ โ””โ”€โ”€ i18n/ # Internationalization โ”‚ โ”œโ”€โ”€ routes/ # SvelteKit routes (pages) โ”‚ โ”œโ”€โ”€ mocks/ # MSW mock handlers โ”‚ โ”œโ”€โ”€ tests/ # Test setup โ”‚ โ”œโ”€โ”€ app.html # HTML shell โ”‚ โ””โ”€โ”€ app.css # Global styles โ”œโ”€โ”€ tests/ โ”‚ โ”œโ”€โ”€ unit/ # Unit tests โ”‚ โ”œโ”€โ”€ integration/ # Integration tests โ”‚ โ””โ”€โ”€ e2e/ # E2E tests โ”œโ”€โ”€ docs/ # Documentation โ”‚ โ”œโ”€โ”€ API.md # Backend API reference โ”‚ โ””โ”€โ”€ TODO.md # Project roadmap โ”œโ”€โ”€ public/ # Static assets โ””โ”€โ”€ static/ # Additional static files ``` --- ## ๐ŸŽจ Features ### Current (Phase 1 - โœ… Complete) - โœ… SvelteKit project scaffolded with TypeScript strict mode - โœ… Tailwind CSS + DaisyUI with CS2-themed color palette - โœ… Complete development tooling (ESLint, Prettier, Husky) - โœ… Testing infrastructure (Vitest + Playwright) - โœ… CI/CD pipeline (Woodpecker) - โœ… Backend API documented ### Planned (See `docs/TODO.md` for details) - ๐Ÿ  Homepage with featured matches - ๐Ÿ“Š Match listing with advanced filters - ๐Ÿ‘ค Player profiles with stats & charts - ๐ŸŽฎ Match detail pages (overview, economy, flashes, damage, chat) - ๐ŸŒ Multi-language support (i18n) - ๐ŸŒ™ Dark/Light theme toggle (default: dark) - ๐Ÿ“ฑ Mobile-responsive design - โ™ฟ WCAG 2.1 AA accessibility - ๐ŸŽฏ CS2-specific features (MR12, Premier rating, volumetric smokes) --- ## ๐Ÿ”— Backend This frontend connects to the [csgowtfd](https://somegit.dev/CSGOWTF/csgowtfd) backend. - **Language**: Go - **Framework**: Gin - **Database**: PostgreSQL - **Cache**: Redis - **API Docs**: See `docs/API.md` Default API endpoint: `http://localhost:8000` --- ## ๐Ÿงช Testing ### Unit & Component Tests ```bash # Run all tests npm run test # Watch mode for TDD npm run test:watch # Generate coverage report npm run test:coverage ``` ### End-to-End Tests ```bash # Run E2E tests (headless) npm run test:e2e # Run with Playwright UI npm run test:e2e:ui # Debug mode npm run test:e2e:debug ``` --- ## ๐Ÿšข Deployment ### Build for Production ```bash npm run build ``` The built app will be in the `build/` directory, ready to be deployed to any Node.js hosting platform. ### Environment Variables See `.env.example` for all available configuration options: - `VITE_API_BASE_URL` - Backend API URL - `VITE_API_TIMEOUT` - API request timeout - `VITE_ENABLE_LIVE_MATCHES` - Feature flag for live matches - `VITE_ENABLE_ANALYTICS` - Feature flag for analytics ### CI/CD Woodpecker CI automatically builds and deploys: - **`master`** branch โ†’ Production - **`dev`** branch โ†’ Development/Staging - **`cs2-port`** branch โ†’ CS2 Preview (during rewrite) --- ## ๐Ÿค Contributing We welcome contributions! Please follow these guidelines: ### Before You Start - Check existing issues or create one describing your feature/fix - Comment on the issue to avoid duplicate work - Fork the repository and create a feature branch ### Code Standards - Follow TypeScript strict mode (no `any` types) - Write tests for new features - Follow existing code style (enforced by ESLint/Prettier) - Keep components under 300 lines - Write meaningful commit messages (Conventional Commits) ### Pull Request Process 1. Create a feature branch: `feature/your-feature-name` 2. Make your changes and commit with clear messages 3. Run linting and tests: `npm run lint && npm run test` 4. Push to your fork and create a PR to the `cs2-port` branch 5. Ensure CI passes and address review feedback ### Git Workflow - Branch naming: `feature/`, `fix/`, `refactor/`, `docs/` - Commit messages: `feat:`, `fix:`, `docs:`, `test:`, `refactor:` - Only one feature/fix per PR - Squash commits before merging --- ## ๐Ÿ“š Documentation - **API Reference**: [`docs/API.md`](docs/API.md) - Complete backend API documentation - **Project Roadmap**: [`docs/TODO.md`](docs/TODO.md) - Detailed implementation plan - **SvelteKit Docs**: [kit.svelte.dev](https://kit.svelte.dev/) - **Tailwind CSS**: [tailwindcss.com](https://tailwindcss.com/) - **DaisyUI**: [daisyui.com](https://daisyui.com/) --- ## ๐Ÿ“„ License [GPL-3.0](LICENSE) ยฉ CSGOW.TF Team --- ## ๐Ÿ’– Support If you find this project helpful, consider supporting us: [![Liberapay](https://img.shields.io/badge/donate%20on-LiberaPay-%23f6c915?style=for-the-badge)](https://liberapay.com/CSGOWTF/) --- ## ๐Ÿ”— Links - **Website**: [csgow.tf](https://csgow.tf) (legacy CS:GO version) - **Backend**: [csgowtfd](https://somegit.dev/CSGOWTF/csgowtfd) - **Issues**: [Report a bug](https://somegit.dev/CSGOWTF/csgowtf/issues) --- **Status**: ๐Ÿšง **Phase 1 Complete** - Active rewrite for CS2 support