Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Basejmp Application Development

Basejmp Application Development

Steps to develop an application with Basejmp

Ganesh Paramasivam

July 24, 2024
Tweet

Transcript

  1. C U S T O M E N T E

    R P R I S E A P P L I C A T I O N S
  2. “Basejmp is a universal cloud-native application that is tailored to

    a speci fi c need by con fi guring and customising the contained application building blocks using the provided development tools” HOW DOES BASEJMP SOLVE THIS
  3. HOW DO YOU USE BASEJMP ? Develop and apply necessary

    configurations and customisations DEPLOY ROLL-OUT CONFIGURE CUSTOM APPLICATIONS
  4. BASEJMP APPLICATION LAYERS Data Storage Data of the application BUSINESS

    LOGIC Functionality of the application API’s How back-end functionality is exposed to front-end and other applications Web UI Front-end of the application
  5. BASEJMP APPLICATION CREATION 1. Data Storage Con fi gure the

    Data Blocks (Database, Table, Columns) 2. BUSINESS LOGIC Implement the Business Logic using either SQLAPI, Lambda, Containers, Hosting and Authentication Pool 3. API’s Configure Domain, Path and Access Rule Blocks to access the Business Logic 4. Web UI Build and implement the front-end using the client blocks
  6. APPLICATION DEVELOPMENT SUMMARY Based on requirement and use cases of

    the application Determine the database schema and configure the Database Blocks - Database, Table, Columns Determine the Business logic requirements and configure SQLAPI, Lambda, Containers, Hosting and Authentication Determine access mechanisms and configure Domain, Path, and Access Rules Design and implement UI using the client blocks
  7. SAMPLE APPLICATION A Todo List Manager ( Manage list of

    todo items) Requirements A Web based application to manage the list of todos Each todo item has a id, title, description and completion status Ability to view list of todo items Ability to add add a new todo item Ability to delete a todo item Ability to mark a todo item as completed
  8. INTERFACE DATABASE LOGIC GATEWAY Need to store a list of

    todos with each todo item having attributes of id, title and description. We create the following • Database: Need a transaction database called main • Table: A table in the main database called todos • Columns in the todos table • Id which is a string • Title which is a string • Description which is a string DATABSE-TABLE- COLUMN
  9. INTERFACE DATABASE LOGIC GATEWAY • We will create the following

    business logic as SQL API’s • Get a list of all todo items • SQLAPI called get_all_todos • select * from todos • Delete a todo item • SQLAPI called delete_todo • delete from todos where id='{{id}}' • Mark a todo item as completed • SQLAPI called mark_completed • update todos set status='closed' where id=‘{{id}}' SQL API
  10. INTERFACE DATABASE LOGIC GATEWAY LAMBDA We will create the following

    business logic as lambda functions • Inserting a todo item • This lambda takes id, title and description as HTTP POST JSON and writes this into the database. • The code for this lambda is generated with the following prompt The handler is called process_post that takes as arguments request_header which is a object and request_body which is a string The handler does the following 1. Parse the request body and store in a object 2. Create a SQL command that inserts into the todos table in main database the columns id, title description and status with values of the same name from the request body 3. Execute the SQL command 4. Create a response header object with a status of 200 and headers object as empty object and set the response header. 5. Create a response body object with a boolean as success 6. If the sql execution is a success set the boolean in response body as true else set it as false 7. Set the response body by converting the response body object as string
  11. INTERFACE 1. DATABASE LOGIC GATEWAY No Hosting block required for

    this application. We can create a test_hosting Hosting block for testing purposes STATIC HOSTING
  12. INTERFACE 1. DATABASE LOGIC GATEWAY No containers needed for this

    application. For testing purposes, create a NGINX container with a shared fi lesystem storage CONTAINERS
  13. INTERFACE DATABASE LOGIC GATEWAY We might need to access control

    the application in future. This would need for a mechanism for a user to login fi rst prior to being able to access the API’s. So we create the following • Authentication Block : main • Authentication Service : main_login that enables a login service for the above authentication block
  14. INTERFACE DATABASE LOGIC GATEWAY Expose all the business logic functionality

    created so far by creating the following • Domain: name main • Paths (Provide appropriate names) • /public_api/get_all_todos_sa that exposes the SQLAPI get_all_todos at this path • /public_api/mark_completed that exposes the SQLAPI mark_completed at this path • /public_api/delete_todo that exposes the SQLAPI delete_todo at this path • /public_api/insert_todo that exposes the Lambda insert_todo at this path • /public_auth/login that exposes the Authentication service login DOMAIN-PATH-PATHGROUP
  15. INTERFACE DATABASE LOGIC GATEWAY AUTHZ For now all API’s are

    public. No access rule to be speci fi ed for now. Try blocking a public_api and then trying to Access it without logging-in Login using the login path and use the obtained token to access the api.
  16. INTERFACE DATABASE LOGIC GATEWAY FRONT-END Global Application State and Reducer

    UI Components Local State Event Handler Thunks Events Dispatch Thunks Thunks call API’s and dispatch actions Reducers modify state based on action State changes causes UI render
  17. INTERFACE DATABASE LOGIC GATEWAY Create the following client Objects •

    Application: web • Component: Home with route as / • Reducer: todo_reduced that handles action called set_todos • Thunk: • get_todos that fetches todos from the /get_todos_sa path and dispatches the set_todos action • insert_todos that inserts a new todo by calling the /insert_todo endpoint and dispatched the get_todos thunk to refresh the list of todos FRONT-END