<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Babacar Mboup</title>
    <description>The latest articles on DEV Community by Babacar Mboup (@babader08).</description>
    <link>https://dev.to/babader08</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3955404%2F16d2cfc2-27fa-4063-85bd-136db5e0eed5.jpg</url>
      <title>DEV Community: Babacar Mboup</title>
      <link>https://dev.to/babader08</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/babader08"/>
    <language>en</language>
    <item>
      <title>🚀 Finish-Up-A-Thon: Building StorePro – A Production-Ready Go &amp; React Inventory System</title>
      <dc:creator>Babacar Mboup</dc:creator>
      <pubDate>Thu, 28 May 2026 01:22:56 +0000</pubDate>
      <link>https://dev.to/babader08/finish-up-a-thon-building-storepro-a-production-ready-go-react-inventory-system-3ol3</link>
      <guid>https://dev.to/babader08/finish-up-a-thon-building-storepro-a-production-ready-go-react-inventory-system-3ol3</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github-2026-05-21"&gt;GitHub Finish-Up-A-Thon Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ## My Project
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;StorePro&lt;/strong&gt; is a comprehensive web application for inventory and product management. It enables users to seamlessly manage their own product catalogs: adding items with images, tracking stock levels, filtering and searching through products, and visualizing key financial metrics (estimated expenses, estimated revenue, total stock) via an interactive dashboard with dynamic charts.&lt;/p&gt;

&lt;p&gt;This project was born out of a concrete, real-world need: providing small businesses with a simple yet professional management tool. What originally started as a personal learning exercise to master Go and React has become, through this challenge, an application I am deeply proud to showcase.&lt;/p&gt;

&lt;p&gt;The project is structured as a monorepo consisting of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A Go Backend&lt;/strong&gt;: REST API, PostgreSQL, JWT authentication with token rotation, Cloudinary for image management, and Resend for transactional emails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A React Frontend&lt;/strong&gt;: Built with Vite, TanStack React Query, Tailwind CSS + DaisyUI, and Recharts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository&lt;/strong&gt;: &lt;a href="https://github.com/babader08/app-gestion-stock" rel="noopener noreferrer"&gt;https://github.com/babader08/app-gestion-stock&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend (Hugging Face Spaces)&lt;/strong&gt;: &lt;a href="https://babamboup697-app-gestion-stock.hf.space" rel="noopener noreferrer"&gt;https://babamboup697-app-gestion-stock.hf.space&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend (Vercel)&lt;/strong&gt;: &lt;a href="https://app-gestion-stock-opal.vercel.app" rel="noopener noreferrer"&gt;https://app-gestion-stock-opal.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;The live dashboard displays real-time statistics, a product list equipped with infinite scroll, and revenue/expense charts.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Comeback Story
&lt;/h2&gt;

&lt;p&gt;When I picked this project back up for the challenge, the core features were functional, but several serious underlying issues needed to be addressed before it could be considered a truly professional-grade application.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Cleaned It Up / Polished It
&lt;/h2&gt;

&lt;p&gt;Here is everything I fixed, hardened, and added during this hackathon:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Fixing Real Bugs in HTTP Handlers
&lt;/h3&gt;

&lt;p&gt;While reviewing the codebase, I identified and resolved 4 critical bugs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Missing return statement after a Cloudinary upload error&lt;/strong&gt;: This could have led to a nil-pointer panic runtime crash.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incorrect HTTP Status Code&lt;/strong&gt;: The API was returning a &lt;code&gt;401 Unauthorized&lt;/code&gt; status code for invalid incoming JSON payloads instead of a proper &lt;code&gt;400 Bad Request&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unsafe Type Assertion&lt;/strong&gt;: A type assertion without an &lt;code&gt;ok&lt;/code&gt; check inside a handler was fixed to eliminate potential production crashes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dead Code Removal&lt;/strong&gt;: Fixed a redundant &lt;code&gt;product&lt;/code&gt; variable allocation that was immediately overwritten.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Securing the Upload Route
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;/api/upload&lt;/code&gt; route was previously public, meaning anyone could upload arbitrary files to my Cloudinary account without authentication. I successfully moved this endpoint behind the secure &lt;code&gt;requireAuth&lt;/code&gt; middleware layer.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Replacing Fragile Error Comparisons
&lt;/h3&gt;

&lt;p&gt;One of my handlers was comparing database errors using a brittle string check (&lt;code&gt;err.Error() == "..."&lt;/code&gt;), which would break upon any slight message change. I refactored this by introducing a sentinel error &lt;code&gt;repository.ErrProductNotFound&lt;/code&gt; and switching to Go's robust &lt;code&gt;errors.Is&lt;/code&gt; mechanism.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Writing 48 Unit Tests Across Two Layers
&lt;/h3&gt;

&lt;p&gt;I designed and executed a comprehensive testing suite with zero external dependencies and no live database connections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;34 tests&lt;/strong&gt; covering the service layer business logic (auth + products).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;14 tests&lt;/strong&gt; covering the handler layer (performing real HTTP requests testing using the native &lt;code&gt;httptest&lt;/code&gt; package).&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
go
func TestRefreshAccessToken_InvalidToken(t *testing.T) {  
      repo := &amp;amp;mockAuthRepo{  
          getUserIDByTokenFn: func(tokenHash []byte, scope string) (int, error) {  
              return 0, errors.New("token invalide")  
          },  
      }  
      svc := newTestAuthService(repo, &amp;amp;mockMailer{})  

      _, _, err := svc.RefreshAccessToken(context.Background(), "bad-token")  
      if !errors.Is(err, ErrInvalidToken) {  
          t.Errorf("expected ErrInvalidToken, got %v", err)  
      }  
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
    </item>
  </channel>
</rss>
