Skip to content

Part of coursework of my Web Application Technologies course at my university. Inspired by Airbnb.

License

Notifications You must be signed in to change notification settings

constantinosgeorgiou/breezebnb

Repository files navigation

Status GitHub milestones GitHub milestone License

Logo

Breezebnb

Project inspired by airbnb. Made as part of coursework of my Web Application Technologies course at my university 🎓
📖 Explore the docs »

View Demo · Report Bug · Request Feature

Table of contents

About the project

BreezeBnB Homepage

This was a project we made during our Web Application Technologies course at my university. As you might have guessed from the name it's similar to airbnb. That means that it has the following features:

  • Search for listings as a guest or anonymous user
  • Create a guest account, in order to book listings
  • View and book listings as a guest
  • Apply to become a host
  • Post / edit / delete your listings as a host
  • Edit / delete your account

Technologies

Server

  • Node.js - version 10.x
  • PostgreSQL - version 12.4
  • Express - version 4.17.1
  • JWT

Client

  • React - version 16.13.1

Prerequisites

You need to have pre-installed Node.js, npm and PostgreSQL.

Download links

Node.js package manager or npm is installed as part of node

Setup

If you don't want to set up a local enviroment of the propject, you can simply view it live.

To set up a local enviroment simply clone the repository

# To clone the repository

git clone https://github.com/constantinosgeorgiou/breezebnb.git

Server

Install the dependencies of the server

# To install the dependencies of the server

cd server/ && npm install

Create enviroment variables file or .env

touch server/.env

Define enviroment variables of the server

# Your server/.env file should look similar to this:

PORT = 5000

DATABASE_URI = "postgres://<database_user>:<database_user password>@localhost:5432/<database>"

JWT_SECRET = "< 256 bit random string >"

You need to replace everyting inside < and > with your own values

Client

Install the dependencies of the client

# To install the dependencies of the client

cd client/ && npm install

Create enviroment variables file or .env

touch client/.env

Define enviroment variables of the client

# Your client/.env file should look similar to this:

You need to replace everyting inside < and > with your own values

Database

This is probably where you're gonna have some difficulty setting up a local enviroment of the project.

Install PostgresQL

For the database section of the web app we need to create a dedicated database and a dedicated database user.

Luckily things don't have to be difficult. The following article helped me create a new database as well as a new database user, responsible for the database

How to install and use PostgresQL

Also, while we were setting up the database user we got the following error, of which there's a link to the fix we applied.

Fix for error: "psql: FATAL: Peer authentication failed for user"

Configure database

Once you have created the new database and its' user we need to configure it.

Connect to postgres as root and enter the root password (of postgres not your machines')

# To connect to postgres as root

psql -U postgres

Connect to the new database

-- To connect to the new database

\c <database name>

Create UUID extension for the new database

-- To create the UUID extension

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

We do not concern our selves with the creation of UUIDs from the server with an npm package like uuid. We let postgres handle the UUIDs for us.

There are two ENUM types avaiable within the database.

  • PROPERTY_TYPE: Defines the property type of each listing
  • USER_ROLE: Defines the role of the user within the application

Create the ENUM types

-- To create the USER_ROLE enum type

CREATE TYPE USER_ROLE AS ENUM
(
    'admin',
    'guest',
    'host',
);

-- To create the PROPERTY_TYPE enum type

CREATE TYPE PROPERTY_TYPE AS ENUM
(
    'House',
    'Apartment',
    'Bed and Breakfast',
    'Hostel',
    'Hotel',
    'Villa'
);

After that is done, we need to create the tables of our database.

# To create all the tables that the application needs simply run

cat server/database/create-all-tables.sql | psql -d <database_of_application> -U <user_of_database>

You need to replace everyting inside < and > with your own values

And finally the set up is done! [insert gif here]

If you don't want to set up a local enviroment of the propject, you can simply view it live.

Start everything up

Now that the set up is all done, let's run the application.

To start the server

# To start the server

cd server
npm start

To start the client

# To start the client

cd client
npm start

Low and behold a tab on your browser should open with the client running.

Features

List of features

  • Search for listings as a guest or anonymous user
  • Create a guest account, in order to book listings
  • View and book listings as a guest
  • Apply to become a host
  • Post / edit / delete your listings as a host
  • Edit / delete your account

See the open issues for a list of future features (and known issues).

Status

Project is: in progress.

We are working on a complete re-work of the front end, for both functional and aesthetic reasons. We are replacing bootstrap with Material-UI and re-doing the way we used the React Context API, as well as they way we handled user data.

There's an open milestone to view the progress of said re-work.

Inspiration

Project inspired by airbnb

Created by

License

MIT License