Rev
notion image

Short Explanation

IOG e-Commerce is a software solution designed to streamline business activities in both Business to Business (B2B) and Business to Customer (B2C) sales environments. It encompasses a comprehensive system that includes features such as product catalog management, seller and buyer administration, order management, shipping logistics, invoice generation, payment processing, and a data analytics dashboard - all accessible through a user-friendly single gateway website.
By implementing this system, our aim is to optimize compliance with SKK MIGAS regulations in the operational procurement of oil and natural gas. This platform enables operators across Indonesia to efficiently purchase goods through authorized vendors under the supervision of SKK MIGAS, facilitating exploration activities in a compliant and streamlined manner.

Project Goals

OG e-Commerce is a software solution designed to support business activities in product sales. It caters to various user roles, ensuring a seamless experience for all:
  1. Administrator: Take charge of user management, validating KKKS and vendor accounts. Access insightful analytics through a comprehensive dashboard, providing transaction insights and vendor performance metrics.
  1. Vendors: Boost promotional efforts with control over vendor landing page. Effortlessly manage product data by adding new items, updating listings, organizing categories, and refining product specifications.
  1. KKKS: Simplify a purchasing journey with easy-to-use features. Manage a shopping cart, access a convenient checkout page, and effortlessly manage shipping addresses. Seamlessly make payments, receive invoices for transactions, and provide ratings after receiving the purchased goods.

Tech Stack Used

This project utilizes React with Next.js, Redux for state management, React Query to handle data fetching and caching, Mantine for some components, React Toastify for toast components, Formik and Yup to streamline form handling and validation, and Tailwind CSS for styling.

Spotlight

Handling a big project, especially one originating from a government institution, was a significant milestone for me. While I am unable to disclose extensive details due to the constraints of non-disclosure agreements (NDAs), the experience gained from working on such a project has been invaluable. This project is the highlight of my career so far. It's the best thing I've done because it was a big task that needed a lot of careful thinking, planning, and working together with others.

The Problems and How I Solved It

I joined the project in the middle of its development and was disappointed to find that the codebase was quite messy, making it difficult to read and maintain. The presence of unnecessary re-renders added to the complexity, and it became apparent that the project structure needed significant improvements.
To address these issues and enhance the overall developer experience, I proposed several improvements to my front-end lead. Here are the key suggestions I made:
  • Adoption of TypeScript: I recommended incorporating TypeScript into the project. By introducing static typing, we could improve code quality, catch errors early during development, and enhance collaboration within the team. TypeScript would bring a level of clarity and safety to the codebase, making it easier to understand and maintain in the long run.
  • To improve form handling and validation, I propose using Zod and React Hook Form instead of Yup and Formik. Zod's versatility in validating API data responses and providing robust type inference for TypeScript offers several advantages. Adopting Zod and React Hook Form would not only improve the overall developer experience but also promote consistency and reliability in our form handling and API data validation processes. This enhancement aligns with our goal of creating a cleaner and more maintainable codebase while leveraging the benefits of TypeScript's strong typing throughout the project.
  • Restructuring the project: I emphasized the importance of reevaluating the project's structure. With the current messy codebase, refactoring and organizing the files, folders, and components would greatly enhance maintainability and scalability.
  • Improvement in use of React Query: with React Query, we didn't need to use native react hooks like useState and useEffect anymore as it was already handled by them. Take a look at this code, and yes I took it from this project codebase.
    • const cartKey = 'cart'; const getCart = async () => { const response = await authorizedClient.get('cart/get'); return response.data; }; export const useGetCart = () => { return useQuery([cartKey, 1], async () => await getCart()); };
      const [getCarts, setGetCarts] = useState([]); const getCart = useGetCart(); useEffect(() => { if (getCart.isSuccess) { setGetCarts(getCart.data.data); } }, [getCart?.data?.data, getCart.isSuccess]); useEffect(() => { if ( getCart && getCart.data && getCart.data.data && getCart.data.data.length > 0 ) { setGetCarts(getCart.data.data); } }, [getCart]);
      I fix it into this
      const { data, isLoading } = useGetCart();
      const cartKey = 'cart'; const getCart = async () => { const response = await httpClient.get('cart/get'); return getCartSchema.parse(response.data.data); //parsing response with Zod }; export const useGetCart = () => { const { data, isLoading } = useQuery({ queryKey: [cartKey], queryFn: async () => await getCart(), }); return { data, isLoading }; };

Lesson Learned

Working on this project has been an enriching learning experience, and it has provided me with valuable lessons. Among the key takeaways, I've realized the significance of effective time management. Given the project's demanding timeline, it was crucial for our team to remain organized and focused to meet the client's expectations promptly.
We're still working on the project, and I'm excited to see how it progresses. We have set goals to achieve, and with each milestone we reach, we're getting closer to the final outcome. I have full confidence that the project will be a success.
Edit: We're done! The project was a huge success, I guess. I also attended the launching event in Nusa Dua, Bali.