Borrow It is an open-source app designed to facilitate the borrowing of items among community members. It allows users to lend items they don't use daily to others, reducing the need for users to purchase items they may need only occasionally.
The app is primarily designed for mobile use as a Progressive Web App (PWA). The installation process is covered in the Installation section. Additionally, the admin panel, used for managing community users, can be accessed via a standard web browser.
- Manage Items: Insert, update, and delete items you want to lend to other community members.
- Search Items: Search for items to borrow from other community members.
- In-App Messaging: Contact members directly within the app using text messages.
- Community Security: Secure access to the app is restricted and managed by your community admin.
- Cost-Effective: Designed to be as cheap and accessible as possible for your community.
Borrow It is designed to be as affordable and accessible as possible, leveraging the capabilities of a standard shared web hosting plan.
You will need:
- A domain to host the app
- A subdomain to host the backend
- A web server that runs PHP (the app is only tested with php version 8.x and a nginx version 1.26.1)
- A MySQL database to store app data
The app uses React for the frontend and a MySQL database with the Slim PHP framework for the backend.
To set up and modify the app on your machine, you will need Node.js (tested with version 22.4.1), PHP (tested with version 22.4.1), and Composer (tested with version 2.7.7) installed. The app might work with lower versions as well, but is only tested with the versionns mentioned above. For more details on how to run the app locally, referr to the CONTRIBUTING.md.
The app is divided into two parts: the Admin View and the Mobile App View.
-
Admin View: The community admin manages members by adding, updating, and deleting them. Members can only access the app once their admin creates an account. This ensures community protection and allows the admin to handle disputes. The Admin View is best accessed via a web browser on a desktop computer at "yourdomain.com/admin". More details in the Setup and Installation section.
-
Mobile App View: Functions as a PWA and can be installed on community members' smartphones. Once members receive their account from the admin, they can log in and use the app on their devices. Using a PWA makes the app accessible on various devices, regardless of the operating system.
Set up a domain for the PWA and a subdomain for the backend. Example:
- Domain: your-community.com
- Subdomain: backend.your-community.com
- Clone or download this repository and open it with your IDE.
- Navigate to the
frontendfolder and runnpm install. - Create a
.envfile in thefrontendfolder with the following variables:REACT_APP_API_BASEURL=https://backend.yourdomain.com REACT_APP_PUSH_KEY= - Generate push keys with
npx web-push generate-vapid-keysand add the public key toREACT_APP_PUSH_KEY. - Run
npm run buildto generate abuildfolder. - Create a
.htaccessfile in thebuildfolder with the following content:Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [QSA,L] - Upload the
buildfolder to your domain's directory on your web host.
-
Create a new database on your web host and import the
database.sqlfile from the repository. -
Navigate to the
backendfolder and create a.envfile with the following variables:DB_HOST= DB_USER= DB_PASSWORD= DB_NAME= SECRET= PUSH_PRIVATE_KEY= PUSH_PUBLIC_KEY= FRONTEND_URL= -
Fill in the database details and keys. Generate a secret key from this website. Use the generated key from before for the PUSH_PRIVTE_KEY and PUSH_PUBLIC_KEY. Use the URL of your frontend for the FRONTEND_URL variable. This ensures, that only request from your domain are allowed.
-
Create a
.htaccessfile in thebackendfolder with the following content:RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1 -
Upload the
backendfolder to your subdomain's directory on your web host. -
Create a
uploadsfolder in the backend directory if it not already exists. -
Run
composer installon your web host. If not supported, run it locally and upload the folder again.
- Create an admin account by navigating to
your-domain.com/admin/loginin your browser on your desktop. - Add new users from the admin dashboard.
- Users can install the app on their smartphones by navigating to your domain and following the install prompt. For more details, check this guide.
- Contribute: Please read CONTRIBUTING.md for details on the process for submitting pull requests to us.
- Code of Conduct: Please read CODE_OF_CONDUCT.md for details on our code of conduct.
- Questions or Help: Contact me via the information on my GitHub account.
- Share Your Story: I'd love to hear how you use the app in your community. Reach out via my GitHub contact info.
This app is proudly presented by Lukas Weihrauch, as part of his bachelor thesis in media and computer science @hs-harz.