OAT is an Android-based template mobile app for developers to advance their knowledge in popular UI framework flutter and laravel Backend framework . It is designed to facilitate the development and deployment of e-commerce mobile app (similar to Jumia or Aliexpress) by providing very useful code snippets to facilitate the devOps pipeline process. The basic features allows users to register and log into a mobile client, place orders, and complete payment for their orders. It also consists of unique features like live-stock availability and push sales that help a salesman to boost sales exponentially.
The project is split into two parts:
- Frontend - Mobile application built with Flutter Framework
- Backend RESTful API - Laravel application
tip: it's recommended that you start with getting the backend API running since the frontend mobile application depends on the API.
- The Backend depends on the PHP Package Manager (Composer). You will need to download and install Composer from https://getcomposer.org/download/. This will allow you to be able to run
composer
commands to install laravel [composer global require "laravel/installer=~1.1"]. Note: Composer runs using php engine. Install a standalone php (preferably 7.0.0 -- <8.0.0) engine or xampp (with php version ^7.1.3). - Environment variables will need to be set. These environment variables include database connection details that should not be hard-coded into the application code.
A file named .env
has been prepared as an optional tool to help you configure these variables on your local development environment.
We do not want your credentials to be stored in git. After pulling this starter
project, run the following command to tell git to stop tracking the script in git but keep it stored locally. This way, you can use the script for your convenience and reduce risk of exposing your credentials.
git rm --cached .env
Afterwards, we can prevent the file from being included in your solution by adding the file to our .gitignore
file.
Create a SQL database either locally or on AWS RDS. For local, use Xampp https://www.apachefriends.org/ which provides Apache Web server, MySql database server and phpmyAdmin program for managing databases via a GUI.
- We will need to use password authentication for this project. This means that a username and password is needed to authenticate and access the database.
- The port number will need to be set as
3306
. This is the typical port that is used by MYSQL so it is usually set to this port by default.
Once your database is set up, set the config values for environment variables prefixed with DB_
in .env
.
- If you set up a local database, your
DB_HOST
is most likelylocalhost
- If you set up an RDS database, your
DB_HOST
is most likely in the following format:***.****.us-west-1.rds.amazonaws.com
. You can find this value in the AWS console's RDS dashboard. - Set
DB_DATABASE
- Set
DB_USERNAME
andDB_PASSWORD
with the database user credentials created. For instance, to create a new user in phpMyAdmin, go to priviledges >add user account
- Login to your database and populate it with tables and dummy data by the running the commands below respectively
php artisan migrate php artisan db::seed
But first, all dependencies have to be installed
Launch the backend API locally. The API is the application's interface to the database.
-
To download/update all the package dependencies in the vendor folder, run the command from the directory
laravel_application/
:composer install
-
To run the application locally using the in-built artisan webserver, run:
php artisan key:generate php artisan serve
You can visit
http://localhost:8000
in your web browser to verify that the application is running. Feel free to play around with Postman to test the API's. -
To run the application locally using the XAMPP's apaches webserver:
copy the laravel application folder containing all installed dependencies into the htdocs directory of xampp visit the url `https://localhost/laravel_application/server.php`
Launch the frontend app locally.
-
Download android studio, and open the directory
flutter_application/
: -
Download flutter sdk
-
Set the sdk path of the project to the unzipped flutter sdk directory.
-
Run the application by clicking the
run
button in android studio.