[PHP] Breadly - The missing backend for App Inventor apps (beta)

Hello everyone,

I’ve been working on something (secretly :grin:) for the past couple of months, and I’d like you guys to take a look at it:

Meet Breadly - The missing backend for App Inventor / Thunkable apps

It’s basically a PHP script which you install on your website, similarly as you would install Wordpress to create a blog… but this is not a blog, this is a database management system with WEB api to access/manage database. Also, the web and API are using same authentication system so anyone who registers on your app can log in to your website (and vice versa) and all data available to the API is also available to the website :slight_smile:

Some features:

  • extremely robust & flexible (based on Laravel 5.5)
  • multiple DB drivers: mysql, postgre, sqlite, …
  • web based admin panel to manage database structure and data (Browse, Read, Edit, Add, Delete)
  • simple HTTP API (in JSON format) to use from within your App Inventor apps (with ordinary Web component)
  • hide DB table columns from the API
  • validate each table column on insert/update with wide set of validation rules
  • user registration system with roles and permissions out-of-the-box (JWT token)
  • file uploads from your app to your server or S3 storage
  • image uploads with automatic resizing
  • file upload limits by file size and/or image dimensions

Here’s a couple of screenshots:


Managing of DB tables from within the app (tasks is app specific table, I’ve created it additionally)


Custom field validation for the API


Image upload configuration


Managing custom DB table from web admin panel


Testing API from Postman

I want to give back to the community by releasing this as a completely free / open source application; and I’ve already published it on GitHub, you can find it here:

But I must say this is not a beginner-level application. You will need to have some knowledge about relational databases because you’ll have to create your database tables manually. The app is so flexible that it gives you only user and roles system, everything else is up to you (in the terms of organizing your data). Apart from that, it’s a Laravel application so installing it requires installation of dependencies, setting up environment variables, migrating and seeding your database, etc… it is not a no-brainer like Wordpress, but once set up, it should work without many problems. I’m also eager to help anyone who wants to test it on their own host, just make sure you have PHP 7.1 and SSH or FTP access (SSH is preferred). And a relational database to manage, of course.

I’ve also set up an online demo as a Heroku app here, so you can test it instantly: http://breadly-test.herokuapp.com/admin

E-mail: [email protected]
Password: password

:exclamation: please do not change login credentials :exclamation: (it will be reverted to “password” every couple of minutes)

Postman collection for the API: https://documenter.getpostman.com/view/3216191/collection/RVnPJida
Very poor documentation: https://github.com/avramovic/breadly/wiki

Breadly supports file uploads too, either to local server or to the s3 storage. I did not bother to set up S3 storage as this is only a demo.

Sample app: BreadlyTest.aia (223.2 KB) | BreadlyTest.apk (2.7 MB)

The sample app supports login/register/forgot-password actions (all actions share the same email/password fields) and the management of a to-do list (tasks table). Token is saved into tinyDB so you’re logged in automatically next time the app is run. You should use real email address when registering as an activation email is sent to the email and you can’t login without activating your account. You can turn email activation off in the Settings page of the admin panel. Also note that activation email can get into your spam inbox as this is a new web app. If you have two devices you can register with one device and add a couple of tasks, then log in with another device and you’ll see your tasks :slight_smile:

As you will see, the API can be consumed using the Web component only, but you need to know what you’re doing. If someone could make an extension for this (basically just a Web component wrapper) that would be awesome! It would be much easier to use this :slight_smile: any extension devs around?

I need couple of guys who like to explore new things and are willing to help me build this as a well documented and stable piece of software. Current documentation is poor (we devs do not like to write documentation for the code we just wrote) so you’ll have to explore and/or ask for help in this thread.

Even if you don’t own a website you can test it with this online demo I’ve set up. Only thing you need is a Web component which already exists in Thunkable! Please do not delete tables other people have created. I will completely reset the demo from time to time.

Let me know if you have any questions.

18 Likes

Someone already created one table but didn’t follow the convention (snake_case, all-lowercase, english plural) so I had to delete it

Good:

tasks
products
images
user_photos
properties
categories
locations

Bad:

user_info
Location
AccountPermissions
product_table
user_photo
informazione
podaci

5 Likes

great @Avram , does this app was feature complete ?

Well it is, there is a basic BREAD system (browse/read/edit/add/delete) in the API + web admin panel to manage your database, but I received virtually no response from the community so I moved on to other projects.

It is completely functional though, and it’s open source so anyone can improve it.

2 Likes

sorry to hear that nobody seems interested, altough your project will have great impact for AppInventor based IDE, does its possible if i can sponsored development of this , just so you could get improved and fix ( if there’s any ) bug ,

1 Like

To be honest, I’m pretty busy with my job and offline life, so I’m not sure how much time I can commit to this. When I was making it, I worked on it only on weekends… so I’m not sure I could accept anything long-term. If you have an idea of a feature that would benefit to Breadly and its (zero :smiley:) users, make a suggestion and I’ll consider it. If you find a bug please open an issue at github and I’ll give my best to fix it.

If you intend to use Breadly in one of your projects and you need custom development specific to your app, send me a private message with your idea and we can start from there.

4 Likes

after login, im interested in how spohisticated BREADly are…, beautifull interfaces, and we can alse manage database from there…, i try to install it to my hosting but i have difficulities, i use ordinary shared hosting with cpanel, does it needs VPS / shell access to use it ?

It is a Laravel-based project, so yes, you need a shell access in order to install it, mainly because you need composer to pull in the dependencies of the project, and to use it’s Artisan command line interface to set up and/or configure it.

But it can be installed without shell access too - by, for example, installing dependencies locally and then uploading everything using FTP. But it’s annoying (you need to have PHP installed locally) and slow (your upload speed is probably slower than your server’s download speed).

Another problem is that root folder of Laravel projects (hence the root folder of Breadly) is not your web root folder, the public folder is the web root. This is Laravel’s way to secure your project a little bit - no code is located in the publicly available folder, only public/index.php is publicly visible (which further loads other code as needed). But on cPanel-based hosting your web root is in /home/USERNAME/public_html, meaning you can install Breadly in /home/USERNAME and copy everything from public folder to public_html and you should be good to go. It can also be installed in /home/USERNAME/public_html (as you would install e.g. Wordpress) but it requires some fiddling around with the files and the code.

I know all of this sounds complicated, but once you get familiar with the process you can set up a new Breadly installation in under 10 minutes, instead of (possibly) hour of uploading a gazillion of small files over FTP :slight_smile:

I can help you set it up on your hosting. I suggest that you first ask your web hosting provider to enable SSH for your cPanel account and ensure they have composer installed on the server. I know it is possible to enable SSH for single account as I have been maintaining several WHM/cPanel servers over the years. But they can also refuse to do so and then we have to fall back to FTP. Then send me a private message with your website URL and cPanel or FTP login details (you can change your password once the setup is done).

1 Like

yesterday i bought special shared web hosting with git and composer installed, can you help me install ?

Sure, just send me a message with your website URL and ssh access and I’ll set it up for you. Or I can guide you through the process :slight_smile:

@Avram can you please tell me via pm that how to set it up

You need the following tools to set it up:

  • web server with PHP 7.1+
  • git (optional but highly recommended)
  • composer
  • a mysql database to manage

To set it up do the following steps:

  1. clone git repository (or download it and put it in your web site document root*)
  2. execute a composer install command in the project folder to install dependencies
  3. copy file .env.example to .env and set up your DB connection info in there
  4. execute a php artisan key:generate command (in the project folder) to generate app encryption key
  5. execute a php artisan package:discover command (in the project folder) to discover installed packages
  6. execute a php artisan migrate --seed command (in the project folder) to set up the DB and admin user

Let me know if you need additional help.

* - Your web site document root should be public subfolder of the project folder. There are multiple ways to achieve this.

I want to set up on xammp

This is solved


getting this error

cd breadly (to enter the project folder), then composer install

btw. I’m not sure it’ll work correctly when put in a subfolder. With XAMPP and the way you set it up, it’ll probably be accessible on http://localhost/ai2/breadly/public/admin, but some assets may fail to load. You will probably want to set up a virtualhost to have it accessible on http://breadly.test/admin or similar URL.

1 Like

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
got above error when composer install

and also
Then set up environment variables, either by copying and modifying .env.example file into .env or by adding them to your ENV.
how to do this

You already have .env.example file in the project folder. Copy it to .env and fill the database info, then run the following commands:

php artisan key:generate
php artisan package:discover
php artisan migrate --seed

I forgot about the package discover command :S

wow it worked you are grate brother
as you said it can be customize so now i am gone try to customize it
again thanks for making it

2 Likes