Backend app development 101
This article gives you a very basic introduction to backend app development. You can use Dittofi to implement any of the concepts explained in here.
There are four steps that every app creator should follow to build out their apps backend on Dittofi.
- 1.Define your entities
- 2.Create your tables
- 3.Populate your tables
- 4.Generating endpoints, actions and events
For the purpose of this Backend app development 101 tutorial we will be building a simple directory app to display short term rentals. Each short term rental can be owned by one user and one user can own many short term rentals.
Dittofi app development is all about data. We think about data in terms of entities and their properties.
Every bit of data should be categorized into an entity. An entity is a set of things in the real world. In our example, the entities will be the lists of our short term rentals and the list of our users.
Short term rentals and users entities
Every entity has a set of standard properties; for example, every User would have a id, name, address, phone number, email and password. Similarly every Short Term Rental will have an id, short name, description, headline image and other images, number of bedrooms and bathrooms and other details.
All instances of an entity will have the same types of properties, but with different values.
Finally, entities can be related to each other. In this case, each User can have multiple Short Term Rentals, and each Short Term Rental belongs to one User. You can see this in the diagram above.
You can build up your entities in one of two ways:
- 1.Using Dittofi
- 2.Using a spreadsheet (Excel, Google Sheets, Smartsheet etc.)
Inside Dittofi every entity that you define (Users, Short Term Rentals etc.) is represented by a table. A table is made up of a list of properties that we call "fields".
If you head over to the Data Models tab in Dittofi, you can create a Users table and a Short Term Rentals table in the following way.
In the same way that built out our entities in Dittofi, you can also choose to build out your entities in a spreadsheet and then import them into Dittofi. This can be useful if you already have your data stored in spreadsheets, or you are more familiar with navigating spreadsheets.
Once you have your data in a spreadsheet you must save your spreadsheet as a CSV and import it into Dittofi in the following way.
The third step is to populate your tables inside Dittofi. This can be done in one of two ways:
- 1.Enter data with Dittofi
- 2.Uploading data from a CSV file
To enter data with Dittofi, you can click anywhere in the last row of your table, this will bring up a form popup.
Adding a new record to your table
Next, you can fill in the form that pops up with the details of the data that you want to enter and click "Save". Don't worry if you make a mistake, you can edit this data later on.
This process can be repeated for all of your data, alternatively if you have lots of data you can upload this from a CSV file as shown in the previous step.
As we saw in App architecture 101, all Dittofi apps follow the same high level structure. There is a backend which is deployed to a fully managed, secure and scalable environment hosted inside Amazon Web Services. The backend is made up of endpoints, actions and events.
The frontend of your app (the bit of your app that your users see) will then connect to your backend by connecting to your apps endpoints.
Inside Dittofi we give you the option to automatically generate a basic set endpoints for your app in a single click. This functionality allows your frontend to:
- Fetch data from your tables
- Write new data to your tables
- Update data within your tables
- Delete data from your tables
The following video explains how you can use the API Generator to fetch data from your apps backend and display the data in your apps frontend.
Dittofi gives you some out of the box backends complete with database structure, endpoints, actions and events. You can take these, install them and customize them from within the builder. To review these, check out our templates marketplace.
Next up we are going to look at defining our user experience and building our frontend.