2025-09-21 17:11:02 +01:00
2025-09-28 18:47:31 +01:00
2025-09-21 17:11:02 +01:00
2025-09-21 17:11:02 +01:00
2025-09-21 17:11:02 +01:00
2025-09-21 17:11:02 +01:00
2025-09-21 17:11:02 +01:00
2025-09-26 22:16:34 +01:00

Table Tennis Booking System

A modern, full-stack table tennis court booking system built with Next.js, shadcn/ui, and SQLite.

Features

  • 🔐 Secure Authentication: JWT-based registration and login
  • 📅 Interactive Calendar: Real-time court availability and booking
  • 📧 Email Notifications: Automatic booking confirmations
  • 📱 Mobile-First Design: Responsive UI for all devices
  • Admin Panel: Court management, user administration, analytics
  • 🔒 Security: Rate limiting, input validation, password hashing

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • npm/yarn
  • Gmail account (for notifications)

Installation

# Clone and install
git clone <repository-url>
cd tt-booking
npm install

# Configure environment
cp .env.sample .env.local
# Edit .env.local with your settings

# Setup database
npm run db:setup

# Start development
npm run dev

Access: http://localhost:3000 (Admin: /admin)

🔧 Configuration

Create .env.local with:

NEXTAUTH_SECRET=your-very-long-random-secret-key
NEXTAUTH_URL=http://localhost:3000
ADMIN_EMAIL=admin@your-domain.com
ADMIN_PASSWORD=your-secure-password

# Optional - Email notifications
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-gmail-app-password

🗄️ Database Commands

npm run db:setup          # Full database setup
npm run db:seed           # Essential data only
npm run db:reset-confirm  # Reset database
npm run db:studio         # Open database GUI

🐳 Deployment

Production (Docker)

cp .env.sample .env.production
docker compose -f docker-compose.production.yml up -d

Home Server

./setup-tunnel.sh  # Setup Cloudflare tunnel
./deploy.sh        # Deploy

🛠️ Technology Stack

  • Frontend: Next.js 14, React, TypeScript, shadcn/ui, Tailwind CSS
  • Backend: Next.js API routes, SQLite, Drizzle ORM
  • Auth: JWT with httpOnly cookies
  • Email: Nodemailer + Gmail
  • Deployment: Docker, Nginx

🗂️ Project Structure

tt-booking/
├── app/                    # Next.js app directory
│   ├── api/               # API routes
│   ├── dashboard/         # User dashboard
│   ├── admin/            # Admin panel
│   └── layout.tsx        # Root layout
├── components/            # React components
│   ├── ui/               # shadcn/ui components
│   ├── auth/             # Authentication
│   ├── booking/          # Booking system
│   └── admin/            # Admin interface
├── lib/                  # Utilities
│   ├── db/               # Database schema
│   ├── auth.ts           # Authentication
│   └── email.ts          # Email service
├── scripts/              # Database scripts
│   ├── setup-database.ts # Database setup
│   └── reset-db.ts       # Database reset
└── docker-compose.*.yml  # Deployment configs

🤝 Contributing

  1. Fork the repository
  2. Create feature branch
  3. Make changes and test
  4. Submit pull request

🆘 Support

S
Description
Fully customisable court booking application
Readme 642 KiB
Languages
TypeScript 95.8%
Shell 2.3%
CSS 1%
JavaScript 0.9%