A modern, full-stack cruise booking application built with React, TypeScript, Node.js, and PostgreSQL. Features a comprehensive booking system with multi-language support (EN/TH), advanced discount validation, and secure payment processing.
- Cruise Search & Booking: Browse and book luxury cruises with advanced filtering
- Multi-language Support: Full EN/TH localization with React Context
- User Authentication: Secure JWT-based auth with bcrypt password hashing
- Payment Processing: Integrated Stripe payment system with multiple currencies
- Discount System: Sophisticated deal validation and coupon management
- Favorites System: Save and manage favorite cruises
- Responsive Design: Mobile-first design with Tailwind CSS
- Cruise Management: Add, edit, and manage cruise listings
- Promotion Management: Create and manage deals with complex conditions
- User Management: View and manage user accounts and bookings
- Real-time Updates: React Query for efficient data fetching
- Form Validation: Robust client and server-side validation
- Email Integration: Automated booking confirmations via SendGrid
- PDF Generation: Dynamic booking confirmations and invoices
- Database Seeding: Comprehensive seed data for development
- React 18 with TypeScript
- Vite for build tooling
- Tailwind CSS + shadcn/ui components
- React Query for state management
- Wouter for routing
- React Hook Form for form handling
- Stripe Elements for payments
- Node.js with Express
- TypeScript throughout
- PostgreSQL with Drizzle ORM
- JWT authentication
- Stripe payment processing
- SendGrid for email
- bcrypt for password hashing
- Neon Database (PostgreSQL)
- Express Session management
- CORS enabled
- Environment-based configuration
- Node.js 18+
- PostgreSQL database
- Stripe account
- SendGrid account (optional, for emails)
-
Clone the repository
git clone https://github.com/yourusername/cruise-booker.git cd cruise-booker -
Install dependencies
npm install
-
Environment Setup Create a
.envfile in the root directory:# Database DATABASE_URL="postgresql://username:password@localhost:5432/cruise_booker" # JWT Secret JWT_SECRET="your-super-secret-jwt-key" # Session Secret SESSION_SECRET="your-session-secret" # Stripe STRIPE_SECRET_KEY="sk_test_your_stripe_secret_key" VITE_STRIPE_PUBLISHABLE_KEY="pk_test_your_stripe_publishable_key" # SendGrid (Optional) SENDGRID_API_KEY="your-sendgrid-api-key" FROM_EMAIL="noreply@yourdomain.com" # App Configuration NODE_ENV="development" PORT=5000
-
Database Setup
# Push database schema npm run db:push # Seed with sample data npm run dev # The app will automatically seed on first run
-
Start Development Server
npm run dev
The app will be available at
http://localhost:5000
cruise-booker/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ lib/ # Utilities and contexts
β β βββ hooks/ # Custom React hooks
βββ server/ # Node.js backend
β βββ routes.ts # API routes
β βββ auth.ts # Authentication logic
β βββ db.ts # Database connection
β βββ enhanced-seed.ts # Database seeding
βββ shared/ # Shared TypeScript schemas
βββ db/ # Database migrations
The application features a sophisticated discount validation system:
- Complex Conditions: Date ranges, guest count, minimum spend, coupon codes
- Multiple Discount Types: Percentage and fixed amount discounts
- Real-time Validation: Immediate feedback on deal eligibility
- React Context: Global language state management
- Comprehensive Translations: 500+ translation keys for EN/TH
- Dynamic Switching: Instant language switching without page reload
- Stripe Elements: Secure, PCI-compliant payment forms
- Multi-currency: USD, EUR, SGD, THB support
- Payment Intents: Modern Stripe payment flow
- JWT Tokens: Secure, stateless authentication
- Password Hashing: bcrypt with salt rounds
- Session Management: Express sessions with PostgreSQL store
- Input Validation: Zod schemas for type-safe validation
- CORS Configuration: Proper cross-origin request handling
GET /api/cruises- List all cruisesGET /api/cruises/:id- Get cruise detailsGET /api/promotions- List active promotions
POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/bookings- Create bookingGET /api/favorites- Get user favoritesPOST /api/create-payment-intent- Create Stripe payment
POST /api/admin/cruises- Create cruisePUT /api/admin/promotions/:id- Update promotionGET /api/admin/users- List users
The project includes comprehensive discount testing:
- Check
DISCOUNT_SYSTEM_TEST.mdfor test scenarios - Use the admin panel to create test deals
- Test validation on the checkout pages
npm run buildEnsure all production environment variables are set:
- Database connection string
- Stripe production keys
- JWT secrets
- SendGrid API key
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run check # TypeScript type checking
npm run db:push # Push database schema changes- PDF generation requires puppeteer (optional dependency)
- Email service requires SendGrid configuration
- Some translations may need refinement
This project is licensed under the MIT License - see the LICENSE file for details.
- shadcn/ui for beautiful UI components
- Tailwind CSS for styling system
- Stripe for payment processing
- Neon for PostgreSQL hosting
- Vercel for inspiration on modern web apps
For support, email support@yourdomain.com or open an issue on GitHub.
Built with β€οΈ using React, TypeScript, and Node.js