> For the complete documentation index, see [llms.txt](https://enappd.gitbook.io/ionic-4-carpool-app-starter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enappd.gitbook.io/ionic-4-carpool-app-starter/how-to-use-this-template-1/integrating-back-end.md).

# Integrating Back-end

How to integrate back-end in this template

## **Data Structure**

In  `environment.ts`, there is data file placed to mimic the behavior of a back-end.&#x20;

E.g. Following images shows the data and its structure for songs on the home page. The data is in JSON format.

![](https://1109726588-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqjTu_FacKM9vIF7shQ%2F-MB4Kz7nWgLzBcJFA73Z%2F-MB4M15KNXJw5GmkgvGu%2FScreen%20Shot%202020-06-30%20at%206.43.01%20PM.png?alt=media\&token=3843051c-e374-4834-9811-2fc771e4399d)

## **Services**

* **Location Service** - Located in `app/services/location.service.ts` This service caters to all functions related to&#x20;
  * Finding geolocation
  * Geocoding
  * Reverse-geocoding
  * Handling pickup and drop-off address
  * Location permission in Android
  * Auto turn-on GPS in Android
* **Util Service** - Located in `app/services/util.service.ts` This service takes care of utility functions like&#x20;
  * Create a modal
  * Create a toast
  * Create an alert
  * Create loader
  * Create ActionSheet
* **Data Service** - Located in `app/services/data.service.ts` This service keeps the in-app variables which are common through multiple pages.&#x20;

## **Back-end options**

To make the app fully operational you will need to attach a back-end to the app. This will require several additions and you will need the assistance of a back-end developer.

We will provide a glimpse into the things you will require

### **Step 1 — Choose a back-end Technology**

There are several options when it comes to back-end. Some of the major ones are

1. Node.js custom back-end
2. Firebase back-end (node.js) ([Read intro blog here](https://enappd.com/blog/firebase-with-ionic-4-hosting-auth-and-db-connection/58))
3. Django custom back-end
4. Ruby-on-rails custom back-end
5. GO back-end

We recommend starting out with Firebase, if you want quick turn-around of features. Firebase is a BaaS platform and comes with a bunch of ready-made functionality, like

* Storage
* Database
* Analytics
* [Push notifications](https://enappd.com/blog/implement-ionic-4-firebase-push/34)
* In-app messages
* [Real-time database and much more](https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23)
* [Anonymous login](https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37)
* [Email login](https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38)

### **Step 2 — Connect the back-end to the app**

As explained in the section above, you will need to replace the Data coming in form individual JSON files with the data coming in from APIs (from your back-end).

To manage the data efficiently, you will need to arrange all API calls, and data manipulation in a single location. You can manage API calls with HttpClient services or [firebase functions.](https://enappd.com/blog/firebase-cloud-functions-in-ionic-4-complete-guide/32)
