https://github.com/jmcamposdev/sharelive
ShareLive is DAW's TFG project which is a website for renting apartments for students, where you can publish, view apartments and leave your reviews of your flatmates.
https://github.com/jmcamposdev/sharelive
Last synced: over 1 year ago
JSON representation
ShareLive is DAW's TFG project which is a website for renting apartments for students, where you can publish, view apartments and leave your reviews of your flatmates.
- Host: GitHub
- URL: https://github.com/jmcamposdev/sharelive
- Owner: jmcamposdev
- License: apache-2.0
- Created: 2024-03-18T11:03:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-16T20:00:30.000Z (about 2 years ago)
- Last Synced: 2025-01-23T10:24:31.302Z (over 1 year ago)
- Language: JavaScript
- Size: 22.1 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sharelive TFG

## Project Link π
Access to the website here -> [Sharelive](https://sharelive.jmcampos.dev)

## Table of Contents
* [General Info](#general-info)
* [Technologies](#technologies)
* [Setup](#setup)
* [Project Structure](#project-structure)
* [RESTful API](#restful-api)
* [Key Features](#key-features)
## General Info
Sharelive is a web application oriented to the search and publication of room rental ads. The platform stands out for its intuitive and easy-to-navigate interface, allowing users to filter their searches by various criteria such as price, size, location, among others.
Sharelive's main objective is to help students, workers and anyone who needs to move home to find a room for rent quickly and easily. Sharelive seeks to simplify the process of searching and posting room listings, providing an accessible and efficient platform for both renters and landlords.
### Entity Relationship Diagram

## Technologies
Project is created with:
FRONTEND
BACKEND
TOOLS
## Setup
### Prerequisites
1. Node.js and npm installed
2. MySQL installed and configured
### Steps to Start the Application
To clone and run this applicaion, you'll need [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/en/download) (which comes with [npm](https://www.npmjs.com/)) installed on you computer.
Next you will have to create a **MongoDB Atlas** database and copy the Cluster's URL
This is an example of what the MongoDB URL would look like
- Copy the URL to the ENV file on ```/backend/.env.development```
```
mongodb+srv://:@cluster0.off3wjd.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
```
Clone the repository and start the project
```
# Clone this repository
$ git clone https://github.com/jmcamposdev/sharelive.git
# Go into the repository
$ cd sharelive
# Install dependencies on the Server and Client
$ cd frontend && npm i --force
$ cd ../backend && npm i
# Run the app
$ npm run dev // On the Client and Server
```
## Project Structure
```bash
integralProjectIZV/
β
βββ frontend/
β βββ public/
β β βββ ... (React public files)
β βββ src/
β β βββ assets/
β β β βββ img/
β β β βββ logos/
β β β βββ vectors/
β β β βββ lottifiles/
β β βββ components/
β β β βββ commons/
β β β βββ ... (React components)
β β βββ pages/
β β β βββ ... (React pages)
β β βββ constants/
β β βββ context/ (Custom Context)
β β βββ hooks/ (Custom Hooks)
β β βββ css/
β β βββ data/ (Mock Data)
β β βββ fonts/ (All Fonts)
β β βββ services/ (Backend Connections)
β β βββ utils/ (Global Functions)
β β βββ App.js
β β βββ index.js
β β
β βββ .gitignore
β βββ .env.development
β βββ .env.production
β βββ package.json
β βββ README.md
β
βββ backend/
β βββ database/
β βββ faker/ (Generate Fake Data)
β βββ listeners/
β β βββ ... (Socket.io connections)
β βββ middlewares/
β β βββ ... (Node.js middlewares)
β βββ controllers/
β β βββ ... (Node.js controllers)
β βββ models/
β β βββ ... (Database models)
β βββ routes/
β β βββ ... (Express routes)
β βββ index.js
β β
β βββ .gitignore
β βββ package.json
β βββ README.md
β
βββ .gitignore
βββ package.json
βββ README.md
βββ ...
```
## RESTful API
Welcome to the Sharelive RESTful API. This API provides access to the management of all available resources.
### Base URL
The API will only be accessible from the **web**, access from outside the url [https://sharelive.jmcampos.dev](sharelive.jmcampos.dev) is prohibited for security reasons. In localhost you can make requests from outside the web.
### Authentication
To access certain resources, authentication is required. Be sure to include the `x-access-token` header with a valid token in the relevant requests.
### Endpoints
#### Auth
- `POST /auth/signin`: Sign in a user. Returns a `JSON` object with the user's data and a token. Requires a `JSON` object with the user's data.
- `POST /auth/signup`: Sign up a new user. Returns a `JSON` object with the new user's data and a token. Requires a `JSON` object with the user's data.
#### Message
- `GET /messages/:from/:to`: Get all messages between two users. Returns a `JSON` array of messages sorted by creation date. Each message includes `_id`, `fromSelf` (a boolean indicating if the message is from the requesting user), `message`, and `createdAt`.
- `POST /messages`: Create a new message. Returns a `JSON` object with the new message's data. Requires a `JSON` object with `from` (sender ID), `to` (recipient ID), and `message` (message content).
#### Review
- `GET /reviews/:id`: Get all reviews for a user. Returns a `JSON` array of reviews. Requires the user ID as a URL parameter.
- `POST /reviews`: Create a new review. Returns a `JSON` object with the new review's data. Requires a `JSON` object with `ownerId`, `assignedId`, `reviewRate`, and `reviewContent`.
- `PUT /reviews/:id`: Update a review by ID. Returns a `JSON` object with the updated review's data. Requires a `JSON` object with `ownerId`, `ownerName`, `ownerAvatar`, `reviewRate`, `reviewContent`, `helpful`, and `notHelpful`.
- `DELETE /reviews/:id`: Delete a review by ID. Returns a `JSON` object with a success message. Requires the review ID as a URL parameter.
#### Room
- `GET /rooms`: Get all rooms. Returns a `JSON` array of all rooms.
- `GET /rooms/:id`: Get a room by ID. Returns a `JSON` object with the room's data.
- `POST /rooms`: Create a new room. Returns a `JSON` object with the new room's data. Requires a `JSON` object with the room's data.
- `PUT /rooms/:id`: Update a room by ID. Returns a `JSON` object with the updated room's data. Requires a `JSON` object with the room's data.
- `DELETE /rooms/:id`: Delete a room by ID. Returns a `JSON` object with the deleted room's data.
- `POST /rooms/:id/images`: Upload images for a room. Returns a `JSON` array of the uploaded images' URLs. Requires a `form-data` object with the images.
- `DELETE /rooms/:id/images`: Delete images for a room. Returns a `JSON` object with a success message. Requires a `JSON` object with the images' URLs to delete.
- `GET /rooms/:id/visits`: Increment and get the visit count for a room. Returns a `JSON` object with the updated visit count.
#### User
- `GET /users`: Get all users. Returns a `JSON` array of all users.
- `GET /users/:id`: Get a user by ID. Returns a `JSON` object with the user's data.
- `POST /users`: Create a new user. Returns a `JSON` object with the new user's data. Requires a `JSON` object with the user's data.
- `PUT /users/:id`: Update a user by ID. Returns a `JSON` object with the updated user's data. Requires a `JSON` object with the user's data.
- `DELETE /users/:id`: Delete a user by ID. Returns a `JSON` object with the deleted user's data.
- `POST /users/:id/avatar`: Upload an avatar for a user. Returns a `JSON` object with the user's data, including the new avatar URL. Requires a `form-data` object with the avatar image.
- `PUT /users/:id/password`: Change a user's password. Returns a `JSON` object with the updated user's data. Requires a `JSON` object with the current and new passwords.
- `GET /users/:id/rooms`: Get all rooms created by a user. Returns a `JSON` array of the user's rooms.
- `GET /users/:id/favourite-rooms`: Get all favourite rooms of a user. Returns a `JSON` array of the user's favourite rooms.
- `POST /users/:id/favourite-rooms`: Toggle a favourite room for a user. Returns a `JSON` object with the updated user's data. Requires a `JSON` object with the room ID.
- `GET /users/contacts`: Get the contact list of the current user. Returns a `JSON` array of the user's contacts.
- `POST /users/:id/contacts`: Add a user to the contact list. Returns a `JSON` object with the updated user's data. Requires a `JSON` object with the contact ID.
- `DELETE /users/contacts/:contactId`: Delete a user from the contact list. Returns a `JSON` object with the updated user's data.
#### Statistics
- `GET /statistics/rooms`: Get statistics about rooms. Returns a `JSON` object with the total number of rooms, total visits to rooms, and total number of rooms marked as favorites.
- `GET /statistics/reviews`: Get statistics about reviews. Returns a `JSON` object with the total number of reviews and the average review rate.
- `GET /statistics/weekly`: Get weekly statistics. Returns a `JSON` object with the number of new users, new rooms, and new reviews for the past week.
- `GET /statistics/activities/:limit?`: Get activity logs. Returns a `JSON` array of activity logs, limited by the optional `limit` parameter.
## Key Features
### User Features
- View rooms: Browse through available rooms.
- Filter rooms: Filter rooms by price range, number of bedrooms, bathrooms, structure type, square meters, and amenities such as microwave, refrigerator, dishwasher, etc.
- Sort results: Sort room listings by newest, lowest price, or highest price.
- Change room layout: Switch between grid and list view for room listings.
- View room details: Access detailed information and photos of each room.
- Save favorites: Save favorite rooms for future reference.
- Share rooms: Share room listings via WhatsApp, Facebook, and Twitter.
- Message room owner: Communicate with room owners through the integrated messaging system connected via socket.
- View street scores: Check street scores for walking, driving, and cycling.
- View owner profile: Explore the profile of room owners, including their posted rooms and reviews.
- Message owner: Send messages to room owners directly from their profile.
- View owner's published rooms: Access a list of all rooms published by a specific owner.
- View owner's reviews: Read reviews received by a room owner, and sort them as per preference.
- Write reviews: Write reviews for rooms and vote on existing reviews (requires login).
- Login/Register: Log in or register to access features such as the dashboard, room creation, room management, profile modification, and message viewing.
- Dashboard: Access a personalized dashboard to manage rooms, view reviews, modify profile, and check received messages.
- Dark/Light mode switch: Toggle between light and dark mode for better readability.
### Admin Features
- View rooms: Browse through available rooms.
- Filter rooms: Filter rooms by price range, number of bedrooms, bathrooms, structure type, square meters, and amenities such as microwave, refrigerator, dishwasher, etc.
- Sort results: Sort room listings by newest, lowest price, or highest price.
- Change room layout: Switch between grid and list view for room listings.
- View room details: Access detailed information and photos of each room.
- Save favorites: Save favorite rooms for future reference.
- Share rooms: Share room listings via WhatsApp, Facebook, and Twitter.
- Message room owner: Communicate with room owners through the integrated messaging system connected via socket.
- View street scores: Check street scores for walking, driving, and cycling.
- View owner profile: Explore the profile of room owners, including their posted rooms and reviews.
- Message owner: Send messages to room owners directly from their profile.
- View owner's published rooms: Access a list of all rooms published by a specific owner.
- View owner's reviews: Read reviews received by a room owner, and sort them as per preference.
- Write reviews: Write reviews for rooms and vote on existing reviews (requires login).
- Login/Register: Log in or register to access features such as the dashboard, room creation, room management, profile modification, and message viewing.
- Dashboard: Access a personalized dashboard to manage rooms, view reviews, modify profile, and check received messages.
- Dark/Light mode switch: Toggle between light and dark mode for better readability.
- Manage users: View and administer all users, including changing their role to administrator or user, modifying any user's details, and deleting users.
- Manage rooms: Edit, create, and delete any room listing.
- Edit profile: Modify the admin's profile information.
## License
This project is under the MIT License - see the [LICENSE](LICENSE) file for details.
## Authors
Campos Trujillo, JosΓ© MarΓa - [jmcamposdev](https://github.com/jmcamposdev)
Hernandez Palma ,Carlos - [carloshpdev](https://github.com/carloshpdev)
Bernal Barrionuevo, Carlos - [caberbar](https://github.com/Caberbar)
## Acknowledgments
We appreciate the collaboration of IES ZaidΓn-Vergeles in this project.