Building business logic in Noodl
As you've seen in the previous chapters in these guides, two main parts of your App are the Data stored in your database and the UI that displays the data and let the user interact with it. The third part of your App us the Business Logic. This what ties your App together. Business logic can be many different things, for example
- Data processing that compiles and re-shapes data from the database into something easy to interact with for the user, or vice versa, restructuring data from the UI to make it easy to store in the database.
- Conditional logic that decides what the next step is for the user depending on user input, for example which page to navigate to.
- Triggering of third party APIs, for example sending an email using an email server or processing a payment with a payment system.
Client Side vs Cloud Side Business Logic
On a high level your business logic can either execute on the client, i.e. in the browser or App, or in the cloud. Most of the time, it's pretty clear where business logic should execute. Conditional navigation or formatting of data to fit the UI controls is often best performed on the client, while operations requiring lots of database request are better performed in the cloud, to avoid sending huge amounts of data back and forth to the client.
Client side business logic
You use the Noodl editor to build the business logic on the client. You typically do it using nodes such as Expression, Condition, Switch and States in combination with data processing nodes such as Insert Object Into Array or Set Object Properties and navigation nodes.
If you know a little Javascript it's often a good idea to use Javascript directly to implement business logic, using the Function or Script nodes. Especially for more complex data processing, Javascript is most often the best way to go.
You can read more about how to create such logic in these guides:
Business Logic in UI Components
More complex UI components need business logic on its own to keep track of its interal states and data. This logic need to be properly encapsulated into the component so the component can be re-used without risking affecting other parts of the App. You can read more about how to do this in the Custom UI Components guide.
Cloud side business logic
Business logic happening on the cloud side works in a different way. You don't build it in the Noodl editor, although you can invoke it, for example using the Cloud Function node.
There are three typical ways of building cloud side logic
- Implementing cloud functions and database triggers directly in the Parse Backend using the Parse Platform SDK. For this to work, you'll have to host your own external backend and database. How you connect to an external backend is described in this guide. This requires good Javascript knowledge since Parse is based on Node.js.
- Trigger Zaps in Zapier. Noodl is connected to the no code tool Zapier and its echo system with thousands of integrations. It enables you to integrate with many different 3rd party services, such as email and messaging services. Learn how to use Zapier from Noodl in this guide.
- Webhooks. This enables Noodl to integrate with more or less any cloud service that can communicate through webhooks. This method is described in detail in the Webhooks Guide.