main
Reviewed-on: #2
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
- Fork the repository
- Create feature branch
- Make changes and test
- Submit pull request
🆘 Support
- 📚 Database Setup Guide
- 🚀 Deployment Guide
- 🐛 Create an issue for bugs or questions
Description
Languages
TypeScript
95.8%
Shell
2.3%
CSS
1%
JavaScript
0.9%