How i solved a backend issue relating to Super apps(Miniapps) and prisma
Published: 2024-06-30 13:06:30

**When you journey into software development and decide to move into the backend aspect if the web, your debugging, understanding and problem solving skills must be off the charts.**

In this short article/blog i would be discussing how i solved one of the pressing issues i faced while developing a super app with miniapps and storefronts integrated into it.

I followed this exact steps below.

**1. Finding the root cause of the problem**: The first way to go about testing codes, if for example no test is written, for example with JEST or the likes. We make use of **Console.log** to get the log of the potential error and then we can proceed. After logging to the console, i found out that i had issues with request not handling concurrently and issues with prisma not synchronizing data correctly.

2. One of the first thought that came to mind is to check if my promises are well defined, on my check i found out that some functions needed to change from Synchronous to Asynchronous functions so that it can handle multiple requests without any drawback. i also added Error handling in the main root of my code, any branch of the main code has an error class assigned to it. Any error faced are handled gracefully thanks to that.

3. Read PRISMA documentation and read several articles on how to fix migration failures on POSTGRES. A very important aspect of finding out root cause of errors and trying to debug, is to check if an individual has been faced with this issue before. With that you can easily follow the steps shown in the article or documentations to fix the issue associated in your code.  

4. To improve and fix issues with storefront not added properly i made use of a data caching feature called Redis, this reduces the load on database and made retrieving data from the database a lot faster.

5. Indexing: took a while before i could understand this, but i fixed this by adding appropriate indexes to the storefronts data and also making sure i added relations between the table i created and the one i want to assign to a new table.


After implementing this changes the performance and the ease of access improved greatly, the data retrieval was way faster, i could handle concurrent request and finally my code started working as it should.

This experience like all other experience trying to figure the root cause of an issue with my code assisted me to get better and become a much better problem solver and in general a better developer.


In pursuit of further ways to get better and to interact with people of all nations and tribes and people, i came across HNG. An intensive and competitive Software development program; in this program i intend to learn a lot by working on real life and comprehensive projects, showing the difference between a personal project and a real life project, also networking with individuals with a high skill level and industry professionals learning from their experiences and ways of solving and resolving issues relating to the codebase.

To join HNG and to move out of your comfort zone to become a better developer you can use this links below to join

https://hng.tech/internship 
https://hng.tech/hire

Goodluck and success as you journey ahead to become the best.