# Padel Pro Sistema integral de gestion para clubes de padel. Una solucion moderna y completa para administrar reservas, ventas, torneos, membresias y multiples sedes. ![Next.js](https://img.shields.io/badge/Next.js-14.2-black?style=flat-square&logo=next.js) ![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue?style=flat-square&logo=typescript) ![PostgreSQL](https://img.shields.io/badge/PostgreSQL-16-336791?style=flat-square&logo=postgresql) ![Prisma](https://img.shields.io/badge/Prisma-5.10-2D3748?style=flat-square&logo=prisma) ![TailwindCSS](https://img.shields.io/badge/Tailwind-3.4-38B2AC?style=flat-square&logo=tailwind-css) --- ## Caracteristicas Principales ### Sistema de Reservas - Calendario visual con vista diaria/semanal - Gestion de disponibilidad por cancha - Precios dinamicos (horario regular vs premium) - Integracion automatica con membresias - Reservas recurrentes ### Punto de Venta (POS) - Gestion de productos y categorias - Control de inventario con alertas de stock bajo - Multiples metodos de pago - Caja registradora con apertura/cierre - Historial de ventas detallado ### Torneos - Formatos: Eliminacion simple/doble, Round Robin, Liga - Inscripciones online - Generacion automatica de brackets - Seguimiento de partidos y resultados ### Membresias - Planes personalizables - Horas de cancha incluidas - Descuentos en reservas y tienda - Renovacion automatica opcional - Alertas de vencimiento ### Multi-Sede - Gestion centralizada de multiples ubicaciones - Usuarios con acceso por sede - Reportes por sede o consolidados - Configuracion independiente por sede --- ## Capturas de Pantalla ``` [Dashboard] [Reservas] [POS] [Torneos] [Membresias] [Clientes] ``` --- ## Inicio Rapido ### Requisitos Previos - Node.js 20.x o superior - PostgreSQL 16.x - pnpm 8.15.0 o superior ### Instalacion ```bash # Clonar el repositorio git clone https://github.com/tu-organizacion/padel-pro.git cd padel-pro # Instalar dependencias pnpm install # Configurar variables de entorno cp apps/web/.env.example apps/web/.env # Editar .env con tus credenciales # Generar cliente Prisma pnpm db:generate # Crear tablas en la base de datos pnpm db:push # Sembrar datos iniciales (opcional) cd apps/web && pnpm db:seed && cd ../.. # Iniciar en modo desarrollo pnpm dev ``` La aplicacion estara disponible en `http://localhost:3000` --- ## Estructura del Proyecto ``` padel-pro/ ├── apps/ │ └── web/ # Aplicacion Next.js principal │ ├── app/ │ │ ├── api/ # API Routes │ │ │ ├── auth/ # Autenticacion (NextAuth) │ │ │ ├── bookings/ # Reservas │ │ │ ├── cash-register/ # Caja registradora │ │ │ ├── clients/ # Clientes │ │ │ ├── courts/ # Canchas │ │ │ ├── dashboard/ # Estadisticas │ │ │ ├── membership-plans/ # Planes de membresia │ │ │ ├── memberships/# Membresias │ │ │ ├── products/ # Productos │ │ │ ├── sales/ # Ventas │ │ │ ├── sites/ # Sedes │ │ │ └── tournaments/# Torneos │ │ └── (admin)/ # Paginas del panel de administracion │ ├── components/ # Componentes React reutilizables │ ├── lib/ # Utilidades y configuraciones │ ├── prisma/ # Schema y migraciones │ └── types/ # Definiciones de tipos TypeScript ├── packages/ │ └── shared/ # Codigo compartido (tipos, validaciones) ├── docs/ # Documentacion ├── package.json ├── pnpm-workspace.yaml └── turbo.json ``` --- ## Variables de Entorno Crear un archivo `.env` en `apps/web/` con las siguientes variables: ```env # Base de datos DATABASE_URL="postgresql://usuario:password@localhost:5432/padel_pro?schema=public" # NextAuth NEXTAUTH_SECRET="tu-clave-secreta-aqui" NEXTAUTH_URL="http://localhost:3000" # Aplicacion NEXT_PUBLIC_APP_URL="http://localhost:3000" ``` ### Variables Requeridas | Variable | Descripcion | Ejemplo | |----------|-------------|---------| | `DATABASE_URL` | URL de conexion a PostgreSQL | `postgresql://user:pass@localhost:5432/db` | | `NEXTAUTH_SECRET` | Clave secreta para JWT (min 32 caracteres) | Generar con `openssl rand -base64 32` | | `NEXTAUTH_URL` | URL base de la aplicacion | `http://localhost:3000` | | `NEXT_PUBLIC_APP_URL` | URL publica de la aplicacion | `http://localhost:3000` | --- ## Scripts Disponibles ### Desarrollo ```bash pnpm dev # Iniciar servidor de desarrollo pnpm build # Construir para produccion pnpm lint # Ejecutar ESLint pnpm type-check # Verificar tipos TypeScript ``` ### Base de Datos ```bash pnpm db:generate # Generar cliente Prisma pnpm db:push # Sincronizar schema con DB pnpm db:studio # Abrir Prisma Studio (UI para DB) pnpm db:seed # Sembrar datos iniciales ``` --- ## Resumen de API La API REST sigue convenciones estandar. Todas las rutas requieren autenticacion excepto las indicadas. ### Endpoints Principales | Recurso | Ruta Base | Descripcion | |---------|-----------|-------------| | Auth | `/api/auth/*` | Autenticacion NextAuth | | Courts | `/api/courts` | Gestion de canchas | | Bookings | `/api/bookings` | Reservas | | Clients | `/api/clients` | Clientes | | Products | `/api/products` | Productos del POS | | Sales | `/api/sales` | Ventas | | Cash Register | `/api/cash-register` | Caja registradora | | Tournaments | `/api/tournaments` | Torneos | | Memberships | `/api/memberships` | Membresias | | Membership Plans | `/api/membership-plans` | Planes de membresia | | Sites | `/api/sites` | Sedes | | Dashboard | `/api/dashboard/stats` | Estadisticas | Ver documentacion completa en [docs/API.md](docs/API.md) --- ## Credenciales por Defecto Despues de ejecutar el seed, puedes acceder con: | Usuario | Password | Rol | |---------|----------|-----| | `admin@padelpro.com` | `admin123` | Super Admin | | `recepcion@padelpro.com` | `recepcion123` | Recepcionista | > **IMPORTANTE:** Cambiar estas credenciales inmediatamente en entornos de produccion. --- ## Contribuir 1. Fork el repositorio 2. Crear una rama para tu feature (`git checkout -b feature/nueva-funcionalidad`) 3. Commit tus cambios (`git commit -m 'feat: agregar nueva funcionalidad'`) 4. Push a la rama (`git push origin feature/nueva-funcionalidad`) 5. Abrir un Pull Request ### Convenciones de Commits Usamos [Conventional Commits](https://www.conventionalcommits.org/): - `feat:` Nueva funcionalidad - `fix:` Correccion de bug - `docs:` Cambios en documentacion - `style:` Cambios de formato (no afectan codigo) - `refactor:` Refactorizacion de codigo - `test:` Agregar o modificar tests - `chore:` Tareas de mantenimiento --- ## Documentacion Adicional - [API Reference](docs/API.md) - Documentacion completa de endpoints - [Deployment Guide](docs/DEPLOYMENT.md) - Guia de despliegue --- ## Licencia Este proyecto esta bajo la Licencia MIT. Ver el archivo [LICENSE](LICENSE) para mas detalles. ``` MIT License Copyright (c) 2024 Padel Pro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```