Have you ever heard "Haiku"? Haiku is a short form of Japanese poetry that is well-known for its rule of 5/7/5: five syllables in the first line, seven in the second, and five again in the third. Haiku today are written by authors worldwide with their own style and syllables. Today we want to make a web application to make haiku lovers all over the world share and communicate what they want without any language barrier.
First of all, let me introduce my team. We are salesforce developers based in Japan consisting of people who come from different countries. We got this project idea from a member from his experience of foreign language learning. One day, there was classwork of translating lyrics of his favorite native language song which make him feel it was really difficult to translate in a different language, and also on the other hand it feels really interesting.
We want to share that fun with a popular short Japanese poetry called Haiku. It is not a situation where we can easily visit other countries these days. It would be great to share beautiful things and feeling around us with people all over the world.
What it does
Let's Haiku bring people who love haiku together join forces to create a new haiku for fun or find like-minded people. You can start a new one by creating the first phrase and then waiting for people to fill it up or looking for the phrase you like and fill it up. If you don't find it interested to write, you can also look for what other people write and then vote for the one you like and you are also welcome to discuss a specific Haiku you like. Don't speak Japanese?! Don't worry! We help you translate to your language. Let's break the language barrier and have fun.
Features: 1. Each part of the three-line poem can be created by different people.
- The phrase translates to English and save to the database with both languages. (Considering the extension to multiple languages in the future)
- Show the created phrase in a different language
- Vote for the phrase you like
- Post a comment and discuss the poem.
How we built it
The UI of this application is built using salesforce Lightning web component on experience cloud with google translate API, Postgres DB, and integrating using mulesoft. We start building with simple logic and a simple database and want to find out the advantage of mulesoft along with the system growth.
API Implementation As the diagram shows above, APIs are implemented by using API-led connectivity as an integration strategy. This makes us find out more advantages of API-led connectivity throughout the process of implementation.
Haiku Ex API （Experience API） API directly interacts with the user interface. The setting response matches with the web component on salesforce experience cloud without direct access to the database. Due to time constraints, we use the experience cloud as the interface. It is also easy to change the response of API if we want to change the interface to a mobile app or other web apps without making any change to process and system API.
Haiku P API (Process API) Translate the phrase from experience API and then create the record to the database using system API. The API calls to google translate API aim to reduce by saving translated data to the database. Currently, the translated data was directly saved to the database in string format. For the extension of translatable language, a JSON format of language key and translated phrase value pair are planned to use. Cache scope is also considered to be one of the most important functions for reducing API calls. For Authentication of Google translate API, API key (as shown in the above picture) seems to be much easier than getting access token from the credential from service Account credential. For more about API key of Google API
Haiku DB API （Sytem API） DB API is an API to unlock data from Postgres DB. We are conscious of making it as versatile as possible so that it can be reused. In this project, we put all of our data in one database, so we do table combination in DB API with sql statement. In real world project with data form different database, then the table combination process must be implement in process api layer.
Challenges we ran into
At the state of API design, we find it really difficult to find out the right grained API. We keep reusability as our biggest goal this time and lack of discussion in maintainability, scalability, etc, and lack of time to look into the deeper layer of API architecture like managing API on API manager, the architecture around load balancer, and so on. We still have many works to do to have a better architecture but we still learn a lot with the implementation this time.
What's next for Let's work together to make a Haiku
The login page of this application currently is the simplest version and has no session control and security consideration. Currently only English to Japanese and vice is available. There are many languages available in Google translate API. Therefore making more language available is one of our future goals. One of our biggest goals is to upgrade our architecture perspective and find out our best practice for api management ,testing using munit and CI/CD implementation. Although these will be affected by many difference factor in real world project, having a best practive template is also like having a great asset like "system api" that we should only create the required "process api" for addition needs.