Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Chess Master Database - Environment Variables
# Copy this file to .env.local and fill in your values

# ======================
# Application
# ======================
VITE_APP_NAME=Chess Master Database
VITE_APP_VERSION=2.1.0
VITE_APP_URL=http://localhost:5173

# ======================
# Sentry (Error Tracking)
# ======================
# Get your DSN from: https://sentry.io/
VITE_SENTRY_DSN=your_sentry_dsn_here
VITE_SENTRY_ENVIRONMENT=development
# Sentry traces sample rate (0.0 to 1.0)
VITE_SENTRY_TRACES_SAMPLE_RATE=0.1

# ======================
# Lichess API
# ======================
# API Base URL (usually no need to change)
VITE_LICHESS_API_URL=https://lichess.org/api
# Optional: Lichess API token for authenticated requests
# Get a token from: https://lichess.org/account/oauth/token
VITE_LICHESS_API_TOKEN=

# ======================
# Chess Engine
# ======================
# Stockfish configuration
VITE_STOCKFISH_MIN_DEPTH=10
VITE_STOCKFISH_MAX_DEPTH=18
VITE_STOCKFISH_DEFAULT_DEPTH=15
VITE_STOCKFISH_MULTI_PV=3

# ======================
# Feature Flags
# ======================
VITE_ENABLE_AI_HINTS=true
VITE_ENABLE_CLOUD_SYNC=false
VITE_ENABLE_MULTIPLAYER=false
VITE_ENABLE_VOICE_COMMANDS=false
VITE_ENABLE_ADVANCED_STATS=true

# ======================
# Analytics (Optional)
# ======================
# Google Analytics ID
VITE_GA_MEASUREMENT_ID=
# Plausible Analytics
VITE_PLAUSIBLE_DOMAIN=
# Mixpanel
VITE_MIXPANEL_TOKEN=

# ======================
# Development
# ======================
# Enable development tools
VITE_ENABLE_DEV_TOOLS=true
# Enable verbose logging
VITE_ENABLE_LOGGING=false
# Mock API responses for development
VITE_MOCK_API=false

# ======================
# Cache Configuration
# ======================
# Cache duration in milliseconds
VITE_CACHE_DURATION=300000
# localStorage cache expiry for analysis (7 days)
VITE_ANALYSIS_CACHE_EXPIRY=604800000

# ======================
# Rate Limiting
# ======================
# Lichess API rate limit delay (ms)
VITE_LICHESS_RATE_LIMIT_DELAY=1000
# Max games per Lichess request
VITE_LICHESS_MAX_GAMES=100

# ======================
# UI Configuration
# ======================
# Default theme (light, dark, system)
VITE_DEFAULT_THEME=system
# Default language (fr, en, es)
VITE_DEFAULT_LANGUAGE=fr
# Default board theme
VITE_DEFAULT_BOARD_THEME=classic

# ======================
# PWA Configuration
# ======================
# Service Worker cache name
VITE_SW_CACHE_NAME=chess-master-v1
# Enable offline mode
VITE_ENABLE_OFFLINE_MODE=true

# ======================
# Database Configuration
# ======================
# For future cloud sync feature
VITE_DB_URL=
VITE_DB_API_KEY=

# ======================
# Security
# ======================
# CORS allowed origins (comma-separated)
VITE_CORS_ORIGINS=http://localhost:5173,http://localhost:3000
# Enable HTTPS in production
VITE_FORCE_HTTPS=false

# ======================
# External Services
# ======================
# YouTube API Key (for video library)
VITE_YOUTUBE_API_KEY=
# Chess.com API
VITE_CHESSCOM_API_URL=https://api.chess.com/pub
154 changes: 154 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: CI/CD

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Check formatting
run: npm run format:check

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm test -- --run

- name: Generate coverage report
run: npm run test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella

e2e:
name: E2E Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Run E2E tests
run: npm run test:e2e

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
retention-days: 30

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build application
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
retention-days: 7

type-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run TypeScript compiler
run: npx tsc --noEmit

security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Run npm audit
run: npm audit --audit-level=moderate
continue-on-error: true

- name: Run Snyk security scan
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
26 changes: 26 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependencies
node_modules

# Build outputs
dist
build
.vite

# Coverage
coverage

# PWA
public/sw.js
public/workbox-*.js

# Generated files
*.min.js
*.min.css

# Package files
package-lock.json
yarn.lock
pnpm-lock.yaml

# Logs
*.log
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "avoid",
"endOfLine": "lf"
}
46 changes: 46 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"recommendations": [
// Essential
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-playwright.playwright",

// TypeScript/JavaScript
"usernamehw.errorlens",
"streetsidesoftware.code-spell-checker",
"christian-kohler.path-intellisense",
"christian-kohler.npm-intellisense",

// React
"dsznajder.es7-react-js-snippets",
"burkeholland.simple-react-snippets",

// Tailwind CSS
"bradlc.vscode-tailwindcss",

// Git
"eamodio.gitlens",
"donjayamanne.githistory",

// Testing
"vitest.explorer",

// Utility
"aaron-bond.better-comments",
"wix.vscode-import-cost",
"formulahendry.auto-rename-tag",
"formulahendry.auto-close-tag",
"naumovs.color-highlight",
"ms-vsliveshare.vsliveshare",

// Documentation
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",

// Productivity
"usernamehw.errorlens",
"gruntfuggly.todo-tree",
"wayou.vscode-todo-highlight"
],
"unwantedRecommendations": []
}
Loading
Loading