Skip to content

nickprotop/ClubManagement

Repository files navigation

🏊 Club Management Platform

A comprehensive, multi-tenant sport club management SAAS platform built with .NET 9, Blazor WASM, and modern web technologies.

πŸš€ Features

🏒 Multi-Tenant Architecture

  • Schema-per-tenant isolation for complete data separation
  • Custom domains and branding per tenant
  • Flexible subscription plans with usage limits

πŸ‘₯ Member Management

  • Member registration and profile management
  • Membership tiers and renewal tracking
  • Emergency contacts and medical information
  • Custom fields per tenant

🏟️ Dynamic Facility Management

  • Custom facility types with configurable properties
  • Real-time availability and booking system
  • Operating hours and capacity management
  • Maintenance scheduling

πŸ”§ Hardware Management

  • Custom equipment categories with dynamic attributes
  • Member equipment assignments with tracking
  • Maintenance logs and replacement planning
  • Usage history and analytics

πŸ“… Event & Class Scheduling

  • Recurring classes and one-time events
  • Staff can register members for classes
  • Capacity management and waitlists
  • Instructor assignments

πŸ’³ Payment Processing

  • Stripe integration for subscriptions and one-time payments
  • Automated billing and invoice generation
  • Refund processing and payment tracking

πŸ“± Modern UI/UX

  • Blazor WASM with MudBlazor Material Design components
  • Progressive Web App (PWA) ready
  • Responsive design for all devices
  • Real-time updates and notifications

πŸ› οΈ Technology Stack

Backend (.NET 9)

  • ASP.NET Core Web API with JWT authentication
  • Entity Framework Core with PostgreSQL
  • Clean Architecture (Domain, Application, Infrastructure)
  • MediatR for CQRS pattern
  • FluentValidation for input validation

Frontend (Blazor WASM)

  • MudBlazor UI component library
  • Progressive Web App capabilities
  • Real-time communication ready
  • Responsive Material Design

Infrastructure

  • PostgreSQL with schema-per-tenant multi-tenancy
  • Redis for caching and session management
  • MinIO for file storage (S3-compatible)
  • Docker containerization with docker-compose

External Services

  • Stripe for payment processing
  • Email/SMS notifications (configurable)

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Blazor WASM   β”‚    β”‚   ASP.NET API   β”‚    β”‚   PostgreSQL    β”‚
β”‚   (Port 4002/3) │◄──►│   (Port 4000/1) │◄──►│   (Port 4004)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚      Redis      β”‚    β”‚      MinIO      β”‚              β”‚
β”‚   (Port 4007)   β”‚    β”‚   (Port 4005/6) β”‚              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
                                                         β”‚
                              Schema per Tenant β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”œβ”€β”€ tenant1_schema
                              β”œβ”€β”€ tenant2_schema
                              └── demo_club (demo)

🚦 Quick Start

Prerequisites

  • .NET 9 SDK
  • Docker & Docker Compose
  • Git

1. Clone and Setup

git clone <repository-url>
cd ClubManagement

# Interactive setup (recommended)
./scripts/setup.sh

# OR quick setup with defaults (for development)
./scripts/setup.sh --quick

Setup Options

πŸ”§ Interactive Setup (Default)

  • Prompts for database, Redis, MinIO passwords
  • Uses existing .env values as defaults if present
  • Generates secure JWT key automatically
  • Best for production or when you need custom configuration

πŸš€ Quick Setup (--quick)

  • Uses default values from .env.sample
  • Uses existing .env values if present
  • No interactive prompts
  • Perfect for development and testing

The setup script will:

  • βœ… Check prerequisites (.NET 9, Docker, Docker Compose)
  • πŸ”§ Interactive configuration for passwords and settings
  • βš™οΈ Generate config.json from template using .env values
  • 🐳 Start Docker services (PostgreSQL, Redis, MinIO)
  • πŸ“Š Initialize database with demo data
  • πŸ” Generate HTTPS certificates

1.1. Security Configuration (Optional but Recommended)

For production or enhanced security, generate a secure JWT key:

# Generate a cryptographically secure JWT secret
./scripts/generate-jwt-secret.sh

# This will optionally update your .env file automatically

2. Start Development

Option A: Local Development (Recommended)

# Start infrastructure only (PostgreSQL, Redis, MinIO)
./scripts/start-infra.sh

# Run API locally (Terminal 1)
cd src/Api/ClubManagement.Api
dotnet run

# Run Client locally (Terminal 2)  
cd src/Client/ClubManagement.Client
dotnet run

Option B: Full Docker

# Start everything in containers
docker-compose up -d

3. Access the Platform

4. Demo Access

  • Domain: demo.localhost
  • Database Schema: demo_club

Demo Admin Account:

  • Email: admin@demo.localhost
  • Password: Admin123!
  • Role: Administrator (full system access)

Demo Member Account:

  • Email: member@demo.localhost
  • Password: Member123!
  • Role: Member (member portal access)
  • Membership: Basic tier, active status

Demo Coach Account:

  • Email: coach@demo.localhost
  • Password: Coach123!
  • Role: Coach (coaching and training access)
  • Purpose: For trainers, instructors, and coaching staff

πŸ“ Project Structure

ClubManagement/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Shared/                    # Shared models and DTOs
β”‚   β”œβ”€β”€ Domain/                    # Domain entities and interfaces
β”‚   β”œβ”€β”€ Application/               # Business logic and CQRS
β”‚   β”œβ”€β”€ Infrastructure/            # Data access and external services
β”‚   β”œβ”€β”€ Api/                       # ASP.NET Core Web API
β”‚   β”‚   └── config.sample.json     # Configuration template
β”‚   └── Client/                    # Blazor WASM frontend
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ setup.sh                   # Main setup script
β”‚   β”œβ”€β”€ generate-docker-config.sh  # Docker configuration generator
β”‚   └── init-db.sql               # Database initialization
β”œβ”€β”€ docker-compose.yml             # Docker services configuration
β”œβ”€β”€ .env.sample                    # Environment variables template
└── README.md

βš™οΈ Configuration

Configuration Workflow

  1. πŸ“‹ Template: .env.sample contains all required environment variables
  2. πŸ“ Generation: setup.sh copies .env.sample β†’ .env (first run only)
  3. ✏️ Customization: Edit .env with your specific values
  4. βš™οΈ Build: Script generates config.json from template using .env values
  5. πŸš€ Runtime: Application loads config.json for all configuration

Environment Variables (.env)

# Database Configuration
POSTGRES_HOST=localhost
POSTGRES_PORT=4004
POSTGRES_DB=clubmanagement
POSTGRES_USER=clubadmin
POSTGRES_PASSWORD=clubpassword

# JWT Authentication
JWT_SECRET_KEY=YourSuperSecretKey...
JWT_ISSUER=ClubManagement
JWT_AUDIENCE=ClubManagement

# External Services
REDIS_HOST=localhost
REDIS_PORT=4007
MINIO_ENDPOINT=localhost:4005
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

# Application URLs
API_BASE_URL=https://localhost:4001
CLIENT_BASE_URL=https://localhost:4003

Configuration Files

  • .env.sample β†’ Template with default values
  • .env β†’ Your actual configuration (git-ignored)
  • config.sample.json β†’ Template with placeholders like {{DB_HOST}}
  • config.json β†’ Generated configuration (git-ignored)

🐳 Docker Deployment

Development

docker-compose up -d

Production

  1. Update .env with production values
  2. Update Stripe keys and JWT secrets
  3. Configure custom domain and SSL certificates
  4. Deploy with:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

πŸ—„οΈ Database Schema

Multi-Tenant Design

  • Public Schema: Tenant management and authentication
  • Tenant Schemas: Isolated data per tenant (e.g., demo_club, tenant_abc)

Key Tables per Tenant

  • users - User accounts and profiles
  • members - Club member information
  • facility_types - Custom facility categories
  • facilities - Facility instances with dynamic properties
  • hardware_types - Equipment categories
  • hardware - Equipment instances with assignments
  • events - Classes and events
  • payments - Stripe payment records

πŸ”§ Development

Adding New Features

  1. Domain: Add entities to src/Domain/
  2. Application: Add commands/queries to src/Application/
  3. Infrastructure: Add data access to src/Infrastructure/
  4. API: Add controllers to src/Api/Controllers/
  5. Client: Add pages/components to src/Client/

Database Migrations

# Add migration
dotnet ef migrations add MigrationName --project src/Infrastructure/ClubManagement.Infrastructure --startup-project src/Api/ClubManagement.Api

# Update database
dotnet ef database update --project src/Infrastructure/ClubManagement.Infrastructure --startup-project src/Api/ClubManagement.Api

Testing

# Build and test
dotnet build
dotnet test

πŸ”’ Security Features

  • JWT Authentication with refresh tokens
  • Multi-tenant data isolation via database schemas
  • CORS protection with configurable origins
  • Input validation with FluentValidation
  • SQL injection protection with parameterized queries
  • HTTPS enforcement in production

πŸ“Š Monitoring & Health Checks

All services include health check endpoints:

  • API: /health
  • PostgreSQL: Built-in health checks
  • Redis: redis-cli ping
  • MinIO: /minio/health/live

🀝 Contributing

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

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

  • πŸ“§ Email: support@clubmanagement.com
  • πŸ’¬ GitHub Issues: For bug reports and feature requests
  • πŸ“– Documentation: Check the /docs folder for detailed guides

Built with ❀️ using .NET 9, Blazor WASM, and MudBlazor

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •