Skip to content

atharv-asr-group/TravelNest

Repository files navigation

TravelNest

TravelNest is a full-stack booking platform built with Next.js, Prisma, and Tailwind CSS. It allows users to list properties, make reservations, and manage their bookings. The project integrates authentication using NextAuth.js and supports third-party login providers like Google and GitHub. Hosted at: https://travel-nest-one.vercel.app/

image

Features

  • User Authentication: Login and registration with email/password or third-party providers (Google, GitHub).
  • Property Listings: Users can list properties with details like title, description, price, and location.
  • Reservations: Users can book properties for specific dates.
  • Favorites: Users can mark properties as favorites.
  • Dashboard: Manage trips, reservations, and properties.
  • Search and Filters: Search properties by location, date, and other filters.
  • Responsive Design: Fully responsive UI built with Tailwind CSS.
  • Map Integration: Location selection and display using Leaflet.

Tech Stack

  • Frontend: Next.js, React, Tailwind CSS
  • Backend: Next.js API routes, Prisma ORM
  • Database: MongoDB (via Prisma)
  • Authentication: NextAuth.js
  • State Management: Zustand
  • File Uploads: Cloudinary
  • Other Libraries: Axios, React Hook Form, React Date Range, React Icons, React Hot Toast

Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB database
  • Cloudinary account for image uploads

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/TravelNest.git
    cd TravelNest
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    Create a .env file in the root directory and add the following variables:

    DATABASE_URL="your-mongodb-connection-string"
    NEXTAUTH_SECRET="your-nextauth-secret"
    GITHUB_ID="your-github-client-id"
    GITHUB_SECRET="your-github-client-secret"
    GOOGLE_CLIENT_ID="your-google-client-id"
    GOOGLE_CLIENT_SECRET="your-google-client-secret"
    NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="your-cloudinary-cloud-name"
  4. Generate Prisma client:

    npx prisma generate
  5. Run database migrations:

    npx prisma migrate dev
  6. Start the development server:

    npm run dev

    Open http://localhost:3000 in your browser to view the app.


Project Structure

TravelNest/
├── app/                     # Next.js app directory
│   ├── actions/             # Server-side actions
│   ├── api/                 # API routes
│   ├── components/          # Reusable UI components
│   ├── hooks/               # Custom React hooks
│   ├── libs/                # Utility libraries
│   ├── providers/           # Context and providers
│   ├── types/               # TypeScript types
│   ├── favorites/           # Favorites page
│   ├── listings/            # Listings page
│   ├── properties/          # Properties page
│   ├── reservations/        # Reservations page
│   ├── trips/               # Trips page
│   ├── layout.tsx           # Root layout
│   ├── page.tsx             # Home page
│   ├── globals.css          # Global styles
├── prisma/                  # Prisma schema
│   └── schema.prisma
├── public/                  # Public assets
├── .env                     # Environment variables
├── .eslintrc.json           # ESLint configuration
├── tailwind.config.js       # Tailwind CSS configuration
├── tsconfig.json            # TypeScript configuration
├── Dockerfile               # Docker configuration
├── package.json             # Project metadata and scripts
└── README.md                # Project documentation

Scripts

  • npm run dev: Start the development server.
  • npm run build: Build the project for production.
  • npm run start: Start the production server.
  • npm run lint: Run ESLint to check for code issues.

API Endpoints

Authentication

  • POST /api/auth/[...nextauth]: Handles user authentication.

Listings

  • POST /api/listings: Create a new listing.
  • DELETE /api/listings/[listingId]: Delete a listing.

Reservations

  • POST /api/reservations: Create a new reservation.
  • DELETE /api/reservations/[reservationId]: Cancel a reservation.

Favorites

  • POST /api/favorites/[listingId]: Add a listing to favorites.
  • DELETE /api/favorites/[listingId]: Remove a listing from favorites.

Deployment

Vercel

  1. Install the Vercel CLI.

  2. Deploy the app:

    vercel
  3. Set environment variables in the Vercel dashboard.


Environment Variables

Variable Description
DATABASE_URL MongoDB connection string
NEXTAUTH_SECRET Secret for NextAuth.js
GITHUB_ID GitHub OAuth client ID
GITHUB_SECRET GitHub OAuth client secret
GOOGLE_CLIENT_ID Google OAuth client ID
GOOGLE_CLIENT_SECRET Google OAuth client secret
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME Cloudinary cloud name

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m 'Add feature'.
  4. Push to the branch: git push origin feature-name.
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages