Skip to content

eltrueno/TruenoProClubServices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Trueno Pro Club Services (TPCS)

EspaΓ±ol ES | English GB


ES EspaΓ±ol

Un sistema integral de gestiΓ³n para clubes de Pro Clubs.

πŸ“‹ DescripciΓ³n General

Trueno Pro Club Services es una plataforma completa que permite gestionar todos los aspectos de un club de Pro Clubs, incluyendo miembros, logros, partidos, estadΓ­sticas de jugadores y mΓ‘s.

Este proyecto es una evoluciΓ³n de Caracantosmeaos.

🌐 Vista Previa (Live Demo)

Puedes ver el sistema en funcionamiento en el despliegue oficial de Casemuro City: πŸ‘‰ https://www.casemurocity.org

πŸ—οΈ Arquitectura del Proyecto

Este es un monorepo estructurado con pnpm workspaces que incluye:

/apps

api - REST API
  • Stack: Express.js + MongoDB
  • Funcionalidades principales:
    • GestiΓ³n de clubes (/club)
    • GestiΓ³n de miembros (/members)
    • Logros y estadΓ­sticas (/achievements)
    • Registro de partidos (/matches)
    • Team of the Week (/totw)
  • Modelos: Club, Club Members, Matches, Player Stats, Achievements, TOTW
web - Frontend
  • Stack: Astro + Vue + Tailwind
  • CaracterΓ­sticas:
    • Interfaz responsiva
    • DiseΓ±o moderno con DaisyUI
worker - Background Jobs
  • PropΓ³sito: Procesamiento asincrΓ³nico de events y tareas programadas
  • CaracterΓ­sticas: Sistema de eventos y manejo de trabajos en segundo plano

/packages

eafcapi - API de EA directa
  • Paquete compartido reutilizable
  • Contiene modelos y utilidades comunes

πŸš€ Primeros Pasos

Requisitos Previos

  • Node.js 18+
  • pnpm 8+

InstalaciΓ³n

# Clonar el repositorio
git clone <repository-url>
cd TruenoProClubServices

# Instalar dependencias de todo el monorepo
pnpm install

# Construir todos los proyectos
pnpm build

πŸ“¦ Scripts Disponibles

Monorepo

# Construir todas las aplicaciones
pnpm build

API

cd apps/api

# Iniciar en modo desarrollo
pnpm start

# Construir para producciΓ³n
pnpm build

# Ejecutar binario compilado
pnpm serve

Web

cd apps/web

# Iniciar servidor de desarrollo
pnpm dev

# Construir para producciΓ³n
pnpm build

# Previsualizar build de producciΓ³n
pnpm preview

πŸ”§ ConfiguraciΓ³n

Variables de Entorno

Las variables de entorno se deben configurar en archivos .env (u otro tipo variables de entorno si es en docker por ejemplo) en cada aplicaciΓ³n.

API (apps/api/.env)
Variable Tipo DescripciΓ³n Valor por defecto
PORT number Puerto en el que escucha la API 80
DEVMODE boolean Habilita CORS abierto para desarrollo false
MONGO_URL string URL de conexiΓ³n a MongoDB Requerido
CLUBID number ID del club en EA Sports 2766636
PLATFORM string Plataforma del club (Xbox/PS/PC) common-gen5
CLUB_CACHE_MS number Tiempo de cachΓ© para datos del club (ms) 3600000 (1 hora)
TOTW_CRON_SCHEDULE string ExpresiΓ³n cron para horario del TOTW 0 21 * * 0
TZ string Zona horaria para el cron (Huso horario) Europe/Madrid

Ejemplo .env:

PORT=3000
DEVMODE=true
MONGO_URL=mongodb://localhost:27017/tpcs
CLUBID=2766636
PLATFORM=common-gen5
CLUB_CACHE_MS=3600000
TOTW_CRON_SCHEDULE="0 21 * * 0"
TZ=Europe/Madrid
Worker (apps/worker/.env)
Variable Tipo DescripciΓ³n Valor por defecto
MONGO_URL string URL de conexiΓ³n a MongoDB Requerido
CLUBID number ID del club para sincronizar 290776
PLATFORM string Plataforma del club (Xbox/PS/PC) common-gen5
WORKER_INTERVAL number Intervalo de sincronizaciΓ³n en segundos 300 (5 minutos)
FORCE_RECALCULATE boolean Fuerza recΓ‘lculo de estadΓ­sticas en startup false
RABBITMQ_URL string URL de conexiΓ³n a RabbitMQ amqp://localhost
TZ string Zona horaria para cΓ‘lculos de fechas Europe/Madrid
TOTW_CRON_SCHEDULE string ExpresiΓ³n cron para proceso de TOTW 0 21 * * 0
TOTW_MIN_GAMES_PLAYED number MΓ­nimo de partidos jugados para ser considerado en el TOTW 5

Ejemplo .env:

MONGO_URL=mongodb://localhost:27017/tpcs
CLUBID=290776
PLATFORM=common-gen5
WORKER_INTERVAL=300
FORCE_RECALCULATE=false
RABBITMQ_URL=amqp://localhost
TZ=Europe/Madrid
TOTW_CRON_SCHEDULE="0 21 * * 0"
TOTW_MIN_GAMES_PLAYED=5

Servicios Externos

MongoDB:

# Usando Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest

RabbitMQ:

# Usando Docker
docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:3-management

πŸ“‚ Estructura de Carpetas

apps/
β”œβ”€β”€ api/                          # REST API
β”‚   └── src/
β”‚       β”œβ”€β”€ controllers/          # Controladores
β”‚       β”œβ”€β”€ models/               # Esquemas MongoDB
β”‚       β”œβ”€β”€ interfaces/           # TypeScript interfaces
β”‚       β”œβ”€β”€ routes/               # DefiniciΓ³n de rutas
β”‚       β”œβ”€β”€ services/             # LΓ³gica de negocio
β”‚       β”œβ”€β”€ middleware/           # Middlewares
β”‚       β”œβ”€β”€ database/             # ConfiguraciΓ³n DB
β”‚       └── app.ts                # Punto de entrada

β”œβ”€β”€ web/                          # Frontend Astro
β”‚   └── src/
β”‚       β”œβ”€β”€ components/           # Componentes Vue y Astro
β”‚       β”œβ”€β”€ pages/                # Rutas Astro
β”‚       β”œβ”€β”€ layouts/              # Layouts
β”‚       β”œβ”€β”€ services/             # Servicios HTTP
β”‚       β”œβ”€β”€ interfaces/           # TypeScript types
β”‚       β”œβ”€β”€ i18n/                 # Traducciones
β”‚       └── scripts/              # Scripts compartidos

└── worker/                       # Background Jobs
    └── src/
        β”œβ”€β”€ controllers/
        β”œβ”€β”€ services/
        β”œβ”€β”€ jobs/
        └── events/

πŸ”Œ Endpoints API

Base URL

  • Desarrollo: http://localhost:80

Rutas Disponibles

  • GET / - InformaciΓ³n general de rutas

πŸ—“οΈ Base de Datos

Motor: MongoDB

Colecciones principales:

  • clubs - InformaciΓ³n de clubes
  • clubmembers - Integrantes de los clubes
  • matches - Registro de partidos
  • playerstats - EstadΓ­sticas de jugadores
  • achievements - Logros desbloqueados
  • totw - Equipo de la semana

πŸ›“ Docker

Ambas aplicaciones principales incluyen Dockerfile para contenerizaciΓ³n:

# Construir imagen API
cd apps/api
docker build -t tpcs-api .

# Construir imagen Worker
cd apps/worker
docker build -t tpcs-worker .

πŸ–±οΈ Seguridad

  • CORS: Configurado para producciΓ³n (https://www.casemurocity.org)
  • Error Handling: Middleware centralizado para manejo de errores
  • ValidaciΓ³n: Schemas y tipos TypeScript fuertes

πŸ“ TecnologΓ­as Principales

Componente TecnologΓ­as
API Backend Express.js, TypeScript, MongoDB, Mongoose
Frontend Web Astro, Vue.js, Tailwind CSS, DaisyUI
Build Tools TypeScript, pnpm, Webpack

πŸ‘¨β€πŸ’» Autor

el_trueno

πŸ“„ Licencia

Este proyecto estΓ‘ bajo la Licencia MIT.

🀝 Contribuciones

Las contribuciones son bienvenidas. Por favor:

  1. Fork el repositorio
  2. Crea una rama para tu feature (git checkout -b feature/AmazingFeature)
  3. Commit tus cambios (git commit -m 'Add some AmazingFeature')
  4. Push a la rama (git push origin feature/AmazingFeature)
  5. Abre un Pull Request

GB English

A comprehensive management system for Pro Clubs.

πŸ“‹ Overview

Trueno Pro Club Services is a complete platform that allows you to manage all aspects of a Pro Club, including members, achievements, matches, player statistics, and more.

This project is an evolution of Caracantosmeaos.

🌐 Live Demo

You can see the system in action at the official Casemuro City deployment: πŸ‘‰ https://www.casemurocity.org

πŸ—οΈ Project Architecture

This is a monorepo structured with pnpm workspaces that includes:

/apps

api - REST API
  • Stack: Express.js + MongoDB
  • Main functionalities:
    • Club management (/club)
    • Member management (/members)
    • Achievements and statistics (/achievements)
    • Match registration (/matches)
    • Team of the Week (/totw)
  • Models: Club, Club Members, Matches, Player Stats, Achievements, TOTW
web - Frontend
  • Stack: Astro + Vue + Tailwind
  • Features:
    • Responsive interface
    • Modern design with DaisyUI
worker - Background Jobs
  • Purpose: Asynchronous processing of events and scheduled tasks
  • Features: Event system and background job handling

/packages

eafcapi - Direct EA API
  • Reusable shared package
  • Contains common models and utilities

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 8+

Installation

# Clone the repository
git clone <repository-url>
cd TruenoProClubServices

# Install dependencies for the entire monorepo
pnpm install

# Build all projects
pnpm build

πŸ“¦ Available Scripts

Monorepo

# Build all applications
pnpm build

API

cd apps/api

# Start in development mode
pnpm start

# Build for production
pnpm build

# Run compiled binary
pnpm serve

Web

cd apps/web

# Start development server
pnpm dev

# Build for production
pnpm build

# Preview production build
pnpm preview

πŸ”§ Configuration

Environment Variables

Environment variables should be configured in .env files (or other environment variable types if using Docker, for example) in each application.

API (apps/api/.env)
Variable Type Description Default Value
PORT number Port on which the API listens 80
DEVMODE boolean Enables open CORS for development false
MONGO_URL string MongoDB connection URL Required
CLUBID number Club ID on EA Sports 2766636
PLATFORM string Club platform (Xbox/PS/PC) common-gen5
CLUB_CACHE_MS number Cache time for club data (ms) 3600000 (1 hour)
TOTW_CRON_SCHEDULE string Cron expression for TOTW schedule 0 21 * * 0
TZ string Timezone for cron calculates Europe/Madrid

Example .env:

PORT=3000
DEVMODE=true
MONGO_URL=mongodb://localhost:27017/tpcs
CLUBID=2766636
PLATFORM=common-gen5
CLUB_CACHE_MS=3600000
TOTW_CRON_SCHEDULE="0 21 * * 0"
TZ=Europe/Madrid
Worker (apps/worker/.env)
Variable Type Description Default Value
MONGO_URL string MongoDB connection URL Required
CLUBID number Club ID to synchronize 290776
PLATFORM string Club platform (Xbox/PS/PC) common-gen5
WORKER_INTERVAL number Synchronization interval in seconds 300 (5 minutes)
FORCE_RECALCULATE boolean Force statistics recalculation on startup false
RABBITMQ_URL string RabbitMQ connection URL amqp://localhost
TZ string Timezone for date calculations Europe/Madrid
TOTW_CRON_SCHEDULE string Cron expression for TOTW process 0 21 * * 0
TOTW_MIN_GAMES_PLAYED number Minimum games played to be considered for TOTW 5

Example .env:

MONGO_URL=mongodb://localhost:27017/tpcs
CLUBID=290776
PLATFORM=common-gen5
WORKER_INTERVAL=300
FORCE_RECALCULATE=false
RABBITMQ_URL=amqp://localhost
TZ=Europe/Madrid
TOTW_CRON_SCHEDULE="0 21 * * 0"
TOTW_MIN_GAMES_PLAYED=5

External Services

MongoDB:

# Using Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest

RabbitMQ:

# Using Docker
docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:3-management

πŸ“‚ Folder Structure

apps/
β”œβ”€β”€ api/                          # REST API
β”‚   └── src/
β”‚       β”œβ”€β”€ controllers/          # Controllers
β”‚       β”œβ”€β”€ models/               # MongoDB Schemas
β”‚       β”œβ”€β”€ interfaces/           # TypeScript interfaces
β”‚       β”œβ”€β”€ routes/               # Route definitions
β”‚       β”œβ”€β”€ services/             # Business logic
β”‚       β”œβ”€β”€ middleware/           # Middlewares
β”‚       β”œβ”€β”€ database/             # Database configuration
β”‚       └── app.ts                # Entry point

β”œβ”€β”€ web/                          # Astro Frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ components/           # Vue and Astro components
β”‚       β”œβ”€β”€ pages/                # Astro routes
β”‚       β”œβ”€β”€ layouts/              # Layouts
β”‚       β”œβ”€β”€ services/             # HTTP services
β”‚       β”œβ”€β”€ interfaces/           # TypeScript types
β”‚       β”œβ”€β”€ i18n/                 # Translations
β”‚       └── scripts/              # Shared scripts

└── worker/                       # Background Jobs
    └── src/
        β”œβ”€β”€ controllers/
        β”œβ”€β”€ services/
        β”œβ”€β”€ jobs/
        └── events/

πŸ”Œ API Endpoints

Base URL

  • Development: http://localhost:80

Available Routes

  • GET / - General information about routes

πŸ—„οΈ Database

Engine: MongoDB

Main Collections:

  • clubs - Club information
  • clubmembers - Club members
  • matches - Match records
  • playerstats - Player statistics
  • achievements - Unlocked achievements
  • totw - Team of the Week

🐳 Docker

Both main applications include Dockerfile for containerization:

# Build API image
cd apps/api
docker build -t tpcs-api .

# Build Worker image
cd apps/worker
docker build -t tpcs-worker .

πŸ›‘οΈ Security

  • CORS: Configured for production (https://www.casemurocity.org)
  • Error Handling: Centralized error handling middleware
  • Validation: Strong TypeScript schemas and types

πŸ“ Main Technologies

Component Technologies
API Backend Express.js, TypeScript, MongoDB, Mongoose
Frontend Web Astro, Vue.js, Tailwind CSS, DaisyUI
Build Tools TypeScript, pnpm, Webpack

πŸ‘¨β€πŸ’» Author

el_trueno

πŸ“„ License

This project is licensed under the MIT License.

🀝 Contributions

Contributions are welcome. Please:

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

About

A comprehensive management system for Pro Clubs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors