- Project Overview
- Prerequisites
- Quick Start
- Detailed Installation
- LambdaTest GitHub App Integration
- Configuration
- Running the Application
- Deployment
- Troubleshooting
This is a full-stack Airbnb clone built with modern web technologies, featuring property listings, search functionality, user authentication, and booking management. The application demonstrates best practices in React, TypeScript, and Node.js development.
Live Demo: https://demo.lambdatestinternal.com/
Frontend:
- React 18 with TypeScript
- Vite (Build tool & dev server)
- React Router (Client-side routing)
- React Query (Server state management)
- Zustand (Client state management)
- Tailwind CSS (Styling)
Backend:
- Node.js & Express.js
- TypeScript
- MongoDB (Optional - Mock data mode available)
- JWT Authentication
- bcryptjs (Password hashing)
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher) - Download
- npm or yarn - Comes with Node.js
- Git - Download
- GitHub Account - For LambdaTest integration
- LambdaTest Account - Sign up
node --version # Should show v16.x.x or higher
npm --version # Should show 8.x.x or higher
git --version # Should show 2.x.x or higherGet the application running in 5 minutes:
# 1. Clone the repository
git clone https://github.com/AbhishekLambda/Abhishek-Github-App-Demo.git
cd Abhishek-Github-App-Demo
# 2. Install backend dependencies
cd backend
npm install
# 3. Install frontend dependencies
cd ../frontend
npm install
# 4. Start backend server (from backend directory)
cd ../backend
npm run dev
# 5. Start frontend server (open new terminal, from frontend directory)
cd frontend
npm run devThe application will be available at:
- Frontend: http://localhost:5174
- Backend API: http://localhost:5000
git clone https://github.com/AbhishekLambda/Abhishek-Github-App-Demo.git
cd Abhishek-Github-App-Democd backendnpm installThis will install:
- express
- typescript
- cors
- bcryptjs
- jsonwebtoken
- And other required packages
Create a .env file in the backend directory:
# Server Configuration
PORT=5000
NODE_ENV=development
# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:5174
# JWT Secret (for production)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# MongoDB Configuration (Optional - App runs with mock data by default)
MONGODB_URI=mongodb://localhost:27017/airbnb-clone
USE_MOCK_DATA=trueNote: The application runs in mock data mode by default, so MongoDB is not required for development.
npm run devYou should see:
✓ Server running on port 5000
✓ Mock data mode enabled
✓ 42 listings loaded
✓ 8 users loaded
Open a new terminal window:
cd frontendnpm installIf you encounter peer dependency issues:
npm install --legacy-peer-depsnpm run devYou should see:
VITE v5.x.x ready in xxx ms
➜ Local: http://localhost:5174/
➜ Network: use --host to expose
- Open your browser and navigate to http://localhost:5174
- You should see the homepage with property listings
- Try the demo login credentials:
- Email:
lambdatestadmin@email.com - Password:
password123
- Email:
LambdaTest AI Cloud GitHub App enables automated test case generation for your pull requests. Follow these steps to integrate it with your repository.
- Navigate to https://github.com/apps/lambdatest-ai-cloud
- Click "Install" or "Configure" if already installed
- Select the repositories where you want to install the application
- You can choose "All repositories" or "Only select repositories"
- Note: You need GitHub Admin access to install the app
- Click "Install" to complete the GitHub side of the integration
After installing the GitHub App:
- You'll be automatically redirected to the LambdaTest Dashboard
- Make sure you are logged into your LambdaTest account
- If not logged in, sign in with your credentials
- Complete the authorization process to link your GitHub account with LambdaTest
Create a configuration file at .lambdatest/config.yaml in your repository root:
# LambdaTest Configuration
# Project and folder configuration
project_id: "your_project_id"
folder_id: "your_folder_id"
# Test Run configuration
assignee: 123456
environment_id: 78901
# Test URL for automation
test_url: "https://demo.lambdatestinternal.com/"
# Enable test duplication for reliability (optional)
use_duplication: true
template_test_run_id: "your_template_run_id"| Parameter | Description | Required | Example |
|---|---|---|---|
project_id |
Your LambdaTest project identifier | Yes | "01K88GEM5X8BDHWWVY819YRJTA" |
folder_id |
Folder ID where tests will be organized | Yes | "01K88GFKKP1TDP3AYBP725BW7C" |
assignee |
User ID to assign test runs | Yes | 1732948 |
environment_id |
Test environment configuration ID | Yes | 156450 |
test_url |
URL of your deployed application | Yes | "https://demo.lambdatestinternal.com/" |
use_duplication |
Enable test duplication for reliability | No | true or false |
template_test_run_id |
Template for duplicating test runs | No | "01K8953PEH0M4R7KQKXSSM66PM" |
-
project_id & folder_id:
- Log into LambdaTest Dashboard
- Navigate to your project
- Copy the IDs from the URL or project settings
-
assignee:
- Go to your LambdaTest profile settings
- Your user ID will be displayed
-
environment_id:
- Navigate to Settings > Environments
- Select or create an environment
- Copy the environment ID
-
test_url:
- Use your deployed application URL
- For local testing:
http://localhost:5174 - For production:
https://demo.lambdatestinternal.com/
Once configured, you can generate test cases automatically:
- Create a Pull Request on GitHub with your changes
- Add a comment to the PR with:
@LambdaTest Generate test cases - Watch the magic happen! The LambdaTest bot will:
- Analyze your code changes
- Generate relevant test cases
- Create automated tests
- Run tests and report results
# Generate test cases for the entire PR
@LambdaTest Generate test cases
# Generate specific test types
@LambdaTest Generate UI test cases
@LambdaTest Generate API test cases
# Run existing tests
@LambdaTest Run tests- Check that the
.lambdatest/config.yamlfile is committed to your repository - Ensure the LambdaTest bot appears in your repository's integrations
- Create a test PR and trigger test generation to verify everything works
The backend can be configured through environment variables or the .env file:
# Server
PORT=5000 # Backend server port
NODE_ENV=development # Environment (development/production)
# CORS
FRONTEND_URL=http://localhost:5174 # Frontend URL for CORS
# Authentication
JWT_SECRET=your-secret-key # JWT signing secret
JWT_EXPIRES_IN=7d # Token expiration time
# Database (Optional)
USE_MOCK_DATA=true # Use mock data instead of MongoDB
MONGODB_URI=mongodb://localhost:27017/airbnb-cloneThe frontend uses Vite for configuration. Edit frontend/vite.config.ts:
export default defineConfig({
plugins: [react()],
server: {
port: 5174,
proxy: {
'/api': {
target: 'http://localhost:5000',
changeOrigin: true,
},
},
},
});The application comes with pre-configured demo users:
| Password | Role | Description | |
|---|---|---|---|
lambdatestadmin@email.com |
password123 |
Host/Admin | LambdaTest admin account |
abhishekkumar@lambdatest.com |
password123 |
Host | Developer account |
demo@lambdatest.com |
password123 |
Host | Demo account |
sarah.johnson@email.com |
password123 |
Host | Sample host |
emma.davis@email.com |
password123 |
Guest | Sample guest |
See DEMO_CREDENTIALS.md for complete list.
Terminal 1 - Backend:
cd backend
npm run devTerminal 2 - Frontend:
cd frontend
npm run devBuild Frontend:
cd frontend
npm run buildThis creates an optimized production build in frontend/dist/.
Build Backend:
cd backend
npm run buildThis compiles TypeScript to JavaScript in backend/dist/.
Run Production Server:
cd backend
npm startBackend Tests:
cd backend
npm testFrontend Tests:
cd frontend
npm test- Domain name configured
- SSL certificate for HTTPS
- Server with Node.js installed
- Environment variables configured
- Build the Application:
# Build frontend
cd frontend
npm run build
# Build backend
cd ../backend
npm run build- Set Environment Variables:
export NODE_ENV=production
export JWT_SECRET=your-production-secret
export FRONTEND_URL=https://demo.lambdatestinternal.com- Start the Server:
cd backend
npm start- Serve Frontend:
Use a web server like Nginx to serve the
frontend/dist/directory.
Example Nginx Configuration:
server {
listen 80;
server_name demo.lambdatestinternal.com;
root /path/to/frontend/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}This repository includes GitHub Actions workflows in .github/workflows/:
- build-and-deploy.yml: Automatically builds and deploys on push to main branch
- Integrates with LambdaTest for automated testing
Error:
Error: listen EADDRINUSE: address already in use :::5174
Solution:
# Find and kill the process using the port
lsof -ti:5174 | xargs kill -9 # Frontend
lsof -ti:5000 | xargs kill -9 # BackendError:
Access to fetch at 'http://localhost:5000/api/listings' from origin 'http://localhost:5174' has been blocked by CORS policy
Solution:
- Check that backend is running on port 5000
- Verify
FRONTEND_URLin backend.envmatches your frontend port - Clear browser cache and reload
Solution:
- Verify backend server is running
- Check browser console for errors
- Ensure
USE_MOCK_DATA=truein backend.env - Restart both frontend and backend servers
Solution:
npm install --legacy-peer-depsSolution:
- Verify
.lambdatest/config.yamlexists and is committed - Check that you have admin access to the repository
- Ensure LambdaTest app is installed for your repository
- Try re-commenting with
@LambdaTest Generate test cases - Check LambdaTest dashboard for any error messages
Solution:
# Clean and rebuild
rm -rf node_modules
rm package-lock.json
npm install
npm run buildAbhishek-Github-App-Demo/
├── .github/
│ └── workflows/ # GitHub Actions CI/CD
│ └── build-and-deploy.yml
├── .lambdatest/
│ └── config.yaml # LambdaTest configuration
├── backend/
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── data/ # Mock data
│ │ ├── middleware/ # Express middleware
│ │ ├── models/ # Data models
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ └── index.ts # Server entry point
│ ├── package.json
│ └── tsconfig.json
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ ├── store/ # State management
│ │ ├── styles/ # CSS styles
│ │ ├── types/ # TypeScript types
│ │ └── App.tsx # Main app component
│ ├── package.json
│ ├── vite.config.ts
│ └── tsconfig.json
├── DEMO_CREDENTIALS.md # Demo user credentials
├── INSTALLATION.md # This file
├── README.md # Project overview
└── package.json
- Demo Credentials - All demo user accounts
- README.md - Project overview and features
- Architecture Documentation - Detailed architecture guide
- LambdaTest Documentation
- LambdaTest GitHub App
- React Documentation
- Vite Documentation
- Express.js Documentation
- TypeScript Documentation
- GitHub Issues: Report a bug
- LambdaTest Support: support@lambdatest.com
- Project Maintainer: Abhishek Kumar
This project is for demonstration purposes. Please check the repository for license details.
We welcome contributions! Please follow these steps:
- 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
- Add
@LambdaTest Generate test casesto trigger automated testing
Last Updated: October 27, 2024