diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94dc427 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Travel AntarKota by Belisov + +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. diff --git a/README.md b/README.md index e215bc4..0647ee4 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,89 @@ -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). +# Travel AntarKota -## Getting Started +Travel AntarKota is a premium, high-performance, and feature-rich containerized Intercity Travel Booking Web Application built using Next.js 14, Prisma, and MySQL. -First, run the development server: +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. -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev -``` +--- -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +## Key Features -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +### 👤 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. -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. +### ⚙️ 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. -## Learn More +--- -To learn more about Next.js, take a look at the following resources: +## Tech Stack & Architecture -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. +- **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. -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! +--- -## Deploy on Vercel +## Production Deployment & Orchestration -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. +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. -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. +### Requirements +- Docker and Docker Compose installed. + +### Setup and Running the Application + +1. **Clone and Navigate**: + ```bash + git clone + 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. diff --git a/src/app/booking/checkout/[code]/page.tsx b/src/app/booking/checkout/[code]/page.tsx index eb1336c..12150e4 100644 --- a/src/app/booking/checkout/[code]/page.tsx +++ b/src/app/booking/checkout/[code]/page.tsx @@ -3,7 +3,7 @@ import { notFound } from 'next/navigation'; import CheckoutClient from '@/components/CheckoutClient'; import { getSettings } from '@/lib/settings'; -export const revalidate = 0; +export const dynamic = 'force-dynamic'; export default async function CheckoutPage({ params, diff --git a/src/app/page.tsx b/src/app/page.tsx index 1be11f6..7d1085d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -4,7 +4,7 @@ import { FaBuilding, FaMountain, FaTree, FaChair, FaBolt, FaShieldAlt } from 're import styles from './page.module.css'; import { getSettings } from '@/lib/settings'; -export const revalidate = 0; +export const dynamic = 'force-dynamic'; export default async function HomePage() { const settings = await getSettings(); diff --git a/src/app/ticket/[code]/page.tsx b/src/app/ticket/[code]/page.tsx index 8e053a5..bfed06d 100644 --- a/src/app/ticket/[code]/page.tsx +++ b/src/app/ticket/[code]/page.tsx @@ -3,7 +3,7 @@ import { notFound } from 'next/navigation'; import TicketView from '@/components/TicketView'; import { getSettings } from '@/lib/settings'; -export const revalidate = 0; +export const dynamic = 'force-dynamic'; export default async function TicketPage({ params,