127 lines
3.2 KiB
Markdown
127 lines
3.2 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```env
|
|
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
|
|
|
|
```bash
|
|
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)
|
|
|
|
```bash
|
|
cp .env.sample .env.production
|
|
docker compose -f docker-compose.production.yml up -d
|
|
```
|
|
|
|
### Home Server
|
|
|
|
```bash
|
|
./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
|
|
|
|
- 📚 [Database Setup Guide](docs/DATABASE_SETUP.md)
|
|
- 🚀 [Deployment Guide](docs/DEPLOYMENT_GUIDE.md)
|
|
- 🐛 Create an issue for bugs or questions
|