<?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: Obinna Justice</title>
    <description>The latest articles on DEV Community by Obinna Justice (@obinna_justice).</description>
    <link>https://dev.to/obinna_justice</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4078339%2F26ddcd06-799e-4a6b-8c08-d0e28ce3a260.jpg</url>
      <title>DEV Community: Obinna Justice</title>
      <link>https://dev.to/obinna_justice</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/obinna_justice"/>
    <language>en</language>
    <item>
      <title>The Stack</title>
      <dc:creator>Obinna Justice</dc:creator>
      <pubDate>Mon, 24 Aug 2026 03:31:14 +0000</pubDate>
      <link>https://dev.to/obinna_justice/the-stack-3nfn</link>
      <guid>https://dev.to/obinna_justice/the-stack-3nfn</guid>
      <description>&lt;p&gt;For this project, I'm using:&lt;/p&gt;

&lt;p&gt;Node.js&lt;br&gt;
TypeScript&lt;br&gt;
Express&lt;br&gt;
PostgreSQL&lt;br&gt;
Prisma&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Build it. Understand it. Explain it. Share it.</title>
      <dc:creator>Obinna Justice</dc:creator>
      <pubDate>Sat, 22 Aug 2026 02:03:01 +0000</pubDate>
      <link>https://dev.to/obinna_justice/build-it-understand-it-explain-it-share-it-jaa</link>
      <guid>https://dev.to/obinna_justice/build-it-understand-it-explain-it-share-it-jaa</guid>
      <description>&lt;p&gt;Build it. Understand it. Explain it. Share it.&lt;/p&gt;

&lt;p&gt;For the first version, I'm keeping the project intentionally small. I want the codebase to be simple enough that I can explain what every part does while still using patterns that make sense in a real backend application.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Simple Wallet API From Scratch</title>
      <dc:creator>Obinna Justice</dc:creator>
      <pubDate>Tue, 18 Aug 2026 03:48:24 +0000</pubDate>
      <link>https://dev.to/obinna_justice/building-a-simple-wallet-api-from-scratch-2j3c</link>
      <guid>https://dev.to/obinna_justice/building-a-simple-wallet-api-from-scratch-2j3c</guid>
      <description>&lt;p&gt;I'm starting something new.&lt;/p&gt;

&lt;p&gt;Instead of building another project and only showing the final result, I want to document the entire process of building a wallet application from the ground up.&lt;/p&gt;

&lt;p&gt;The goal is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build it. Understand it. Explain it. Share it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For the first version, I'm keeping the project intentionally small. I want the codebase to be simple enough that I can explain what every part does while still using patterns that make sense in a real backend application.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;p&gt;For this project, I'm using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;Express&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;Prisma&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We'll eventually add features like wallet funding, withdrawals, transfers, and transaction history.&lt;/p&gt;

&lt;p&gt;But before any of that, we need a server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up the Project
&lt;/h2&gt;

&lt;p&gt;I started by creating a new Node.js project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;wallet
&lt;span class="nb"&gt;cd &lt;/span&gt;wallet
npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I installed Express and the TypeScript development dependencies.&lt;/p&gt;

&lt;p&gt;The first version of the project is intentionally simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wallet/
├── src/
│   └── server.ts
├── package.json
└── tsconfig.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating the Server
&lt;/h2&gt;

&lt;p&gt;The first thing I created was a basic Express server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Simple Wallet API is running&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Server running on http://localhost:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There isn't anything complicated here yet.&lt;/p&gt;

&lt;p&gt;The important thing is that we now have a working backend that we can build on.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;express()&lt;/code&gt; call creates our application.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;express.json()&lt;/code&gt; allows the server to understand JSON request bodies.&lt;/p&gt;

&lt;p&gt;Then we created a simple &lt;code&gt;GET&lt;/code&gt; route at &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, we started the server on port &lt;code&gt;8000&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Start This Simple?
&lt;/h2&gt;

&lt;p&gt;Because the goal isn't to write hundreds of lines of code on day one.&lt;/p&gt;

&lt;p&gt;The goal is to build the wallet one piece at a time.&lt;/p&gt;

&lt;p&gt;From this point, we'll gradually introduce the database, users, wallets, transactions, funding, transfers, and the other pieces required to make the system more realistic.&lt;/p&gt;

&lt;p&gt;Every feature will be something I can explain and test.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;Now that the server is running, the next step is connecting it to a real database.&lt;/p&gt;

&lt;p&gt;That's where we'll introduce PostgreSQL and Prisma and start designing the actual wallet data model.&lt;/p&gt;

&lt;p&gt;This is just the beginning.&lt;/p&gt;

</description>
      <category>api</category>
      <category>backend</category>
      <category>node</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Node.js function that handles a wallet funding. Notice the atomic transaction</title>
      <dc:creator>Obinna Justice</dc:creator>
      <pubDate>Sun, 16 Aug 2026 11:54:18 +0000</pubDate>
      <link>https://dev.to/obinna_justice/nodejs-function-that-handles-a-wallet-funding-notice-the-atomic-transaction-4mm4</link>
      <guid>https://dev.to/obinna_justice/nodejs-function-that-handles-a-wallet-funding-notice-the-atomic-transaction-4mm4</guid>
      <description>&lt;p&gt;`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`async function fundWallet(userId: string, amount: Decimal, reference: string) {&lt;/p&gt;

&lt;p&gt;return await prisma.$transaction(async (tx) =&amp;gt; {&lt;/p&gt;

&lt;p&gt;// 1. Check for duplicate&lt;/p&gt;

&lt;p&gt;const existing = await tx.transaction.findUnique({ where: { reference } });&lt;/p&gt;

&lt;p&gt;if (existing) return existing;&lt;/p&gt;

&lt;p&gt;// 2. Lock wallet row (prevents race conditions)&lt;/p&gt;

&lt;p&gt;const wallet = await tx.wallet.findUnique({&lt;/p&gt;

&lt;p&gt;where: { userId },&lt;/p&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;if (!wallet || wallet.status !== 'ACTIVE') {&lt;/p&gt;

&lt;p&gt;throw new Error('Wallet not available');&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;// 3. Create transaction record first&lt;/p&gt;

&lt;p&gt;const newBalance = wallet.balance.plus(amount);&lt;/p&gt;

&lt;p&gt;const transaction = await tx.transaction.create({&lt;/p&gt;

&lt;p&gt;data: {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;walletId: wallet.id,

type: 'CREDIT',

amount,

balanceAfter: newBalance,

reference,

status: 'COMPLETED',

description: 'Wallet funding via Paystack',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;},&lt;/p&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;// 4. Update wallet balance&lt;/p&gt;

&lt;p&gt;await tx.wallet.update({&lt;/p&gt;

&lt;p&gt;where: { id: wallet.id },&lt;/p&gt;

&lt;p&gt;data: { balance: newBalance },&lt;/p&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;return transaction;&lt;/p&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;}&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
