Files

90 lines
4.3 KiB
Markdown

# Travel AntarKota
Travel AntarKota is a premium, high-performance, and feature-rich containerized Intercity Travel Booking Web Application built using Next.js 14, Prisma, and MySQL.
Designed with a modern, responsive **Glassmorphism Dark Theme**, it provides customers with a seamless ticket booking workflow and gives administrators full control over routes, schedules, transactions, and branding options.
---
## Key Features
### 👤 Customer Features
- **Route Search**: Find active intercity schedules by departure and arrival cities, date, and ticket pricing.
- **Seat Selection**: Interactive, vehicle-specific visual layout selection (Toyota HiAce 10-seater or Executive Bus 30-seater) preventing duplicate seat bookings in real time.
- **Digital Ticketing**: Generate and view digital tickets with QR/barcode references once payment is verified.
- **Order Tracking**: Check booking status (Pending, Lunas, Batal) at any time.
- **User Profile**: Dedicated customer dashboard to manage active tickets, view travel history, update personal details, and change security passwords.
### ⚙️ Administrator Features
- **Dashboard Overview**: Visual overview statistics for bookings, routes, active vehicles, revenue, and pending schedules.
- **Route Management**: Add, update, or remove intercity routes, durations, and pricing.
- **Schedule Management**: Create departure schedules linked to active routes, select vehicle formats, and define pricing overrides.
- **Booking Management**: Audit transaction logs, view passenger details, confirm payments, and cancel bookings.
- **Dynamic Branding & Styling**: Custom configuration via database settings:
- Custom Brand Name and Logo Icons/Images.
- Dynamically adjustable **Primary Theme Color** (calculates light/dark relative luminance dynamically on page load to adjust contrast and prevent styling issues).
- **Admin Profile**: Manage administrator information and securely update passwords.
---
## Tech Stack & Architecture
- **Frontend & Backend**: Next.js 14.2.x (React Server Components, App Router).
- **Database ORM**: Prisma Client v7.8.0.
- **Database**: MySQL 8.0.
- **Database Driver Adapter**: `@prisma/adapter-mariadb` (MariaDB node-driver compatibility layer).
- **Security & Session**: HTTP-Only Cookie-based JWT tokens (`jose`) with password verification hashed via `bcryptjs`.
- **Containerization**: Multi-stage `Dockerfile` and `docker-compose.yml` for isolated production-ready orchestration.
---
## Production Deployment & Orchestration
The application is fully containerized. A robust, non-blocking Next.js build configuration ensures that all dynamic pages are statically ignored at build-time using a dummy mock Prisma adapter, bypassing database query timeouts entirely.
### Requirements
- Docker and Docker Compose installed.
### Setup and Running the Application
1. **Clone and Navigate**:
```bash
git clone <repository_url>
cd travel-antarkota
```
2. **Launch Container Services**:
Start the MySQL database and Next.js application in background mode:
```bash
docker compose up -d --build
```
3. **Database Auto-Orchestration**:
- The Next.js container automatically executes `docker-entrypoint.sh` on startup.
- It performs a TCP healthcheck to wait until MySQL is fully initialized.
- It executes `prisma db push` to synchronize tables.
- It checks and seeds initial system settings and creates the default administrator:
- **Admin Email**: `admin@travel.com`
- **Admin Password**: `admin123`
4. **Accessing the App**:
- **User Frontend**: [http://localhost:3000](http://localhost:3000)
- **Admin Dashboard**: [http://localhost:3000/admin](http://localhost:3000/admin) (Log in using the default admin credentials).
---
## Configuration
Secrets and settings are managed strictly through environment variables inside `docker-compose.yml`:
- `JWT_SECRET`: Secret key used for signing session JSON Web Tokens.
- `ADMIN_EMAIL`: Initial admin account email created during database seeding.
- `ADMIN_PASSWORD`: Initial admin account password.
All database transactions, session management, and image uploads (stored as persistent base64 long-text entries in MySQL) are self-contained and run out of the box with zero external configuration requirements.
---
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.