Skip to content
Β 
Β 

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏠 Airbnb Full Clone

A production-ready full-stack Airbnb clone built with modern technologies and best practices.

Next.js NestJS TypeScript Prisma Stripe

🎯 Features

Backend (NestJS)

  • βœ… 33 REST API Endpoints fully functional
  • πŸ” JWT Authentication with role-based access (Guest/Host)
  • πŸ’³ Stripe Payment Integration with webhooks
  • 🏠 Property Management (CRUD, publish/unpublish)
  • πŸ“… Booking System with status management
  • ⭐ Review System with ratings
  • ❀️ Favorites/Wishlist functionality
  • πŸ“Š Prisma ORM with SQLite/PostgreSQL support
  • πŸ›‘οΈ Input Validation with class-validator
  • πŸ”„ Error Handling with proper HTTP status codes

Frontend (Next.js 15)

  • ⚑ App Router with server components
  • 🎨 shadcn/ui + TailwindCSS for modern UI
  • πŸ“± Responsive Design mobile-first approach
  • πŸ”„ Zustand for state management
  • πŸͺ Custom Hooks for API integration
  • 🎯 TypeScript end-to-end type safety
  • 🌐 SEO Optimized with meta tags

πŸ—οΈ Architecture

airbnb-full-clone/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ api-gateway/         # NestJS Backend
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/        # Authentication module
β”‚   β”‚   β”‚   β”œβ”€β”€ properties/  # Property management
β”‚   β”‚   β”‚   β”œβ”€β”€ bookings/    # Booking system
β”‚   β”‚   β”‚   β”œβ”€β”€ payments/    # Stripe integration
β”‚   β”‚   β”‚   β”œβ”€β”€ reviews/     # Review system
β”‚   β”‚   β”‚   β”œβ”€β”€ favorites/   # Wishlist functionality
β”‚   β”‚   β”‚   └── common/      # Shared utilities
β”‚   β”‚   └── test/            # API tests
β”‚   β”‚
β”‚   └── web/                 # Next.js Frontend
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ app/         # App router pages
β”‚       β”‚   β”œβ”€β”€ components/  # React components
β”‚       β”‚   β”œβ”€β”€ lib/         # Utilities & API clients
β”‚       β”‚   └── types/       # TypeScript types
β”‚
└── packages/
    └── database/            # Prisma schema & migrations
        └── prisma/

πŸš€ Tech Stack

Backend

  • Framework: NestJS 10
  • Language: TypeScript 5
  • Database: Prisma ORM (SQLite/PostgreSQL)
  • Authentication: JWT with Passport
  • Payments: Stripe API
  • Validation: class-validator, class-transformer
  • Documentation: REST API with 33 endpoints

Frontend

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript 5
  • Styling: TailwindCSS + shadcn/ui
  • State: Zustand
  • Forms: React Hook Form + Zod
  • HTTP Client: Axios
  • UI Components: Radix UI + shadcn/ui

πŸ“¦ Installation

Prerequisites

  • Node.js 18+
  • pnpm 8+

Clone & Install

git clone https://github.com/YOUR_USERNAME/airbnb-fullstack-clone.git
cd airbnb-fullstack-clone
pnpm install

Setup Database

cd packages/database
npx prisma generate
npx prisma migrate dev --name init

Environment Variables

Backend (apps/api-gateway/.env):

DATABASE_URL="file:../../packages/database/prisma/dev.db"
JWT_SECRET=your_jwt_secret_key
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Frontend (apps/web/.env.local):

NEXT_PUBLIC_API_URL=http://localhost:3001/api
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...

πŸƒ Running the Project

Development Mode

Backend:

cd apps/api-gateway
pnpm run start:dev
# Server runs on http://localhost:3001

Frontend:

cd apps/web
pnpm run dev
# App runs on http://localhost:3000

Production Build

# Backend
cd apps/api-gateway
pnpm run build
pnpm run start:prod

# Frontend
cd apps/web
pnpm run build
pnpm run start

πŸ“‘ API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/me - Get current user

Properties

  • GET /api/properties - List all properties
  • GET /api/properties/:id - Get property details
  • POST /api/properties - Create property (Host only)
  • PATCH /api/properties/:id - Update property
  • DELETE /api/properties/:id - Delete property
  • PATCH /api/properties/:id/publish - Publish property
  • GET /api/properties/my-properties - Get my properties

Bookings

  • POST /api/bookings - Create booking
  • GET /api/bookings/my-bookings - Get my bookings
  • GET /api/bookings/host-bookings - Get bookings (Host)
  • GET /api/bookings/:id - Get booking details
  • PATCH /api/bookings/:id/confirm - Confirm booking (Host)
  • PATCH /api/bookings/:id/cancel - Cancel booking

Payments

  • POST /api/payments/create-intent - Create payment intent
  • POST /api/payments/confirm - Confirm payment
  • GET /api/payments/booking/:id - Get payment by booking
  • POST /api/payments/:id/refund - Refund payment
  • POST /api/payments/webhook - Stripe webhook

Reviews

  • POST /api/reviews - Create review
  • GET /api/reviews/property/:id - Get property reviews
  • GET /api/reviews/my-reviews - Get my reviews
  • GET /api/reviews/:id - Get review details
  • PATCH /api/reviews/:id - Update review
  • DELETE /api/reviews/:id - Delete review

Favorites

  • POST /api/favorites/:propertyId - Add to favorites
  • DELETE /api/favorites/:propertyId - Remove from favorites
  • POST /api/favorites/toggle/:propertyId - Toggle favorite
  • GET /api/favorites - Get my favorites
  • GET /api/favorites/check/:propertyId - Check if favorited
  • GET /api/favorites/count/:propertyId - Get favorite count

πŸ§ͺ Testing

API Testing

# Use REST Client extension in VS Code
# Open apps/api-gateway/test/complete-test.http

πŸ“Š Database Schema

model User {
  id        String   @id @default(cuid())
  email     String   @unique
  password  String
  name      String
  role      Role     @default(GUEST)
  avatar    String?
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model Property {
  id           String   @id @default(cuid())
  title        String
  description  String
  price        Float
  propertyType PropertyType
  maxGuests    Int
  bedrooms     Int
  bathrooms    Int
  city         String
  country      String
  images       String   // JSON array
  status       PropertyStatus @default(DRAFT)
  hostId       String
  host         User     @relation(fields: [hostId])
}

model Booking {
  id          String   @id @default(cuid())
  propertyId  String
  guestId     String
  checkIn     DateTime
  checkOut    DateTime
  guests      Int
  totalPrice  Float
  status      BookingStatus @default(PENDING)
}

model Payment {
  id                     String   @id @default(cuid())
  bookingId              String   @unique
  amount                 Float
  stripePaymentIntentId  String
  status                 PaymentStatus @default(PENDING)
}

model Review {
  id         String   @id @default(cuid())
  bookingId  String   @unique
  propertyId String
  userId     String
  rating     Int
  comment    String?
}

model Favorite {
  id         String   @id @default(cuid())
  userId     String
  propertyId String
  @@unique([userId, propertyId])
}

🎨 UI Components

Built with shadcn/ui:

  • Button, Input, Card, Dialog
  • Dropdown Menu, Avatar, Badge
  • Calendar, Select, Form
  • Toast notifications
  • Skeleton loaders
  • And more...

πŸš€ Deployment

Backend (Railway/Render)

cd apps/api-gateway
pnpm run build
# Deploy to Railway or Render

Frontend (Vercel)

cd apps/web
pnpm run build
# Deploy to Vercel

πŸ“ License

MIT License - feel free to use this project for learning purposes.


πŸ‘¨β€πŸ’» Author

Gherson

  • GitHub: [@YOUR_USERNAME]
  • LinkedIn: [Your LinkedIn]

πŸ™ Acknowledgments

  • Inspired by Airbnb
  • Built for learning and portfolio purposes
  • Not affiliated with Airbnb Inc.

πŸ“§ Contact

For questions or collaboration: your.email@example.com


⭐ If you found this project helpful, please give it a star!

About

Clon de Airbnb con arquitectura de microservicios | Next.js 15 + NestJS + Prisma + Stripe | JWT Auth, Booking System, Payments, Reviews & Favorites | 33 REST API endpoints | shadcn/ui + TailwindCSS | TypeScript monorepo

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages