Skip to content

atayl16/siege-clan-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏰 Siege Clan Tracker

A modern web application for tracking Old School RuneScape clan member statistics, events, and achievements.

Better Stack Badge CI Node Version React Version License Website GitHub last commit GitHub issues GitHub pull requests

πŸ“– Overview

Siege Clan Tracker is a comprehensive clan management system for Old School RuneScape (OSRS). It provides real-time tracking of member statistics, boss kills, events, and achievements by integrating with the WiseOldMan API.

Website: https://siege-clan.com

Key Features

  • πŸ‘₯ Member Management - Track all clan members with automatic WiseOldMan sync
  • πŸ“Š Statistics Dashboard - Real-time stats, rankings, and leaderboards
  • 🎯 Goals & Races - Create and track personal goals and competitive races
  • πŸ“… Events Tracking - Monitor ongoing and past clan events
  • πŸ† Achievements - Track group achievements and milestones
  • πŸ”” Notifications - Anniversary notifications and RuneWatch alerts
  • πŸ‘‘ Admin Tools - Comprehensive admin panel for clan management
  • πŸ“± Responsive Design - Works seamlessly on desktop and mobile

πŸ› οΈ Technology Stack

Frontend

  • React 18 - UI framework
  • Vite - Build tool and dev server
  • React Query - Server state management
  • React Router - Client-side routing
  • CSS Modules - Scoped styling

Backend

  • Supabase - PostgreSQL database with RLS
  • Netlify Functions - Serverless API endpoints (Node.js)
  • Netlify Edge Functions - Edge-optimized endpoints (Deno)

APIs & Services

  • WiseOldMan API - OSRS player statistics
  • Discord Webhooks - Notifications
  • RuneWatch API - Player verification

Development Tools

  • ESLint - Code linting
  • GitHub Actions - Automated sync jobs
  • Git - Version control

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Supabase account (for database)
  • Netlify account (for deployment)
  • WiseOldMan API access

Installation

  1. Clone the repository
git clone https://github.com/atayl16/siege-clan-tracker.git
cd siege-clan-tracker
  1. Install dependencies
npm install
  1. Set up environment variables

Create a .env file in the root directory:

# Supabase (required)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key

Note: Do not add admin secrets or API keys to .env - these are configured server-side in Netlify environment variables for security.

  1. Run development server
npm run dev

The app will be available at http://localhost:5173

Running with Netlify Dev

For full functionality including serverless functions:

npm run netlify:dev

πŸ—οΈ Project Structure

siege-clan-tracker/
β”œβ”€β”€ src/                      # React frontend
β”‚   β”œβ”€β”€ components/           # Reusable React components
β”‚   β”‚   β”œβ”€β”€ admin/           # Admin-specific components
β”‚   β”‚   └── ui/              # UI library components
β”‚   β”œβ”€β”€ context/             # React Context providers
β”‚   β”‚   β”œβ”€β”€ AuthContext.js   # Authentication state
β”‚   β”‚   └── DataContext.js   # Data aggregation
β”‚   β”œβ”€β”€ hooks/               # Custom React hooks
β”‚   β”œβ”€β”€ pages/               # Route components
β”‚   β”œβ”€β”€ utils/               # Utility functions
β”‚   β”‚   └── adminApi.js      # Admin API client
β”‚   └── supabaseClient.js    # Supabase initialization
β”œβ”€β”€ netlify/
β”‚   β”œβ”€β”€ functions/           # Serverless functions (Node.js)
β”‚   β”‚   β”œβ”€β”€ anniversaries.js # Anniversary notifications
β”‚   β”‚   β”œβ”€β”€ discord.js       # Discord webhook handler
β”‚   β”‚   └── runewatch-check.js # RuneWatch verification
β”‚   └── edge-functions/      # Edge functions (Deno)
β”‚       β”œβ”€β”€ admin-*.js       # Admin operations
β”‚       β”œβ”€β”€ members.js       # Member data API
β”‚       β”œβ”€β”€ events.js        # Events data API
β”‚       └── _shared/         # Shared utilities
β”‚           └── auth.js      # Authentication middleware
β”œβ”€β”€ scripts/                 # Background sync jobs
β”‚   └── sync-tasks/
β”‚       β”œβ”€β”€ sync-wom.cjs     # WiseOldMan member sync
β”‚       β”œβ”€β”€ wom-events.cjs   # Events sync
β”‚       β”œβ”€β”€ anniversaries.cjs # Anniversary check
β”‚       └── runewatch-check.cjs # RuneWatch scan
β”œβ”€β”€ .github/workflows/       # GitHub Actions
β”‚   β”œβ”€β”€ hourly-clan-sync.yml # Hourly data sync
β”‚   β”œβ”€β”€ daily-clan-sync.yml  # Daily checks
β”‚   └── manual-clan-sync.yml # Manual triggers
└── supabase/               # Database migrations
    └── migrations/

πŸ”‘ Key Concepts

Authentication

  • Hardcoded Admin - Master admin with emergency access
  • User Registration - Self-service user accounts
  • Character Claims - Link OSRS characters to accounts
  • Admin Tokens - Server-side admin operation authentication

Data Flow

  1. WiseOldMan Sync - Hourly sync of member data via GitHub Actions
  2. Edge Functions - Cached API responses for fast data access
  3. React Query - Client-side caching and optimistic updates
  4. Supabase RLS - Row-level security for data access control

Admin Architecture

Admin operations use dedicated edge functions with JWT-based authentication:

  • Updates, deletes, and visibility changes bypass RLS using service role
  • JWT tokens authenticate admin requests (no secrets in client)
  • Admin-specific RPC functions handle privileged database operations

Caching Strategy

  • Edge Functions: 5-15 minute cache with ETags
  • React Query: Automatic background refetch
  • Netlify CDN: Global edge caching
  • Cache Invalidation: Purge on data updates

πŸ“š Documentation

Core Documentation

Additional Documentation

Comprehensive documentation is organized in the /docs directory:

Planning & Roadmap:

Setup Guides:

See the docs directory for the complete documentation index.

πŸ”’ Environment Variables

Frontend (.env)

SUPABASE_URL               # Supabase project URL
SUPABASE_ANON_KEY          # Public anon key (read-only access)

Backend (Netlify)

SUPABASE_URL               # Supabase project URL
SUPABASE_SERVICE_ROLE_KEY  # Service role key (private)
WOM_API_KEY                # WiseOldMan API key
WOM_GROUP_ID               # Clan group ID
DISCORD_WEBHOOK_URL        # Discord webhook
DISCORD_ANNIVERSARY_WEBHOOK_URL # Anniversary channel
API_KEY                    # Edge function API key
ADMIN_SECRET               # Admin operations secret
ALLOWED_ORIGIN             # CORS allowed origin

πŸ§ͺ Testing

# Run tests
npm test

# Run tests in watch mode
npm test -- --watch

# Run tests with coverage
npm test -- --coverage

πŸš€ Deployment

Automatic Deployment

Pushes to main branch automatically deploy to production via Netlify.

Manual Deployment

# Build for production
npm run build

# Preview build locally
npm run preview

Environment Setup

  1. Netlify: Configure environment variables in dashboard
  2. Supabase: Set up database and RLS policies
  3. GitHub: Add secrets for Actions workflows
  4. WiseOldMan: Register your clan group

πŸ”„ Background Jobs

Automated sync jobs run via GitHub Actions:

Job Frequency Purpose
WOM Sync Hourly Sync member data from WiseOldMan
WOM Events Hourly Sync event data and calculate points
Anniversaries Daily Check and notify clan anniversaries
RuneWatch Daily Scan for flagged members

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Test thoroughly
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

πŸ“ License

This project is private and not licensed for public use.

πŸ‘€ Author

Alisha Taylor (@atayl16)

πŸ™ Acknowledgments

  • WiseOldMan - OSRS tracking API
  • Supabase - Backend infrastructure
  • Netlify - Hosting and edge functions
  • Siege Clan members - Testing and feedback

πŸ“§ Support

For questions or issues:

  • Open an issue on GitHub
  • Contact clan leadership in Discord

Made with ❀️ for the Siege Clan

About

A stat tracker and admin tool for an OSRS clan

Topics

Resources

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •