DEV Community

Obinna Justice
Obinna Justice

Posted on

Building a Simple Wallet API From Scratch

I'm starting something new.

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.

The goal is simple:

Build it. Understand it. Explain it. Share it.

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.

The Stack

For this project, I'm using:

  • Node.js
  • TypeScript
  • Express
  • PostgreSQL
  • Prisma

We'll eventually add features like wallet funding, withdrawals, transfers, and transaction history.

But before any of that, we need a server.

Setting Up the Project

I started by creating a new Node.js project:

mkdir wallet
cd wallet
npm init -y
Enter fullscreen mode Exit fullscreen mode

Then I installed Express and the TypeScript development dependencies.

The first version of the project is intentionally simple:

wallet/
├── src/
│   └── server.ts
├── package.json
└── tsconfig.json
Enter fullscreen mode Exit fullscreen mode

Creating the Server

The first thing I created was a basic Express server:

import express from "express";

const app = express();

app.use(express.json());

app.get("/", (_req, res) => {
  res.json({
    message: "Simple Wallet API is running"
  });
});

const PORT = 8000;

app.listen(PORT, () => {
  console.log(`Server running on http://localhost:${PORT}`);
});
Enter fullscreen mode Exit fullscreen mode

There isn't anything complicated here yet.

The important thing is that we now have a working backend that we can build on.

The express() call creates our application.

express.json() allows the server to understand JSON request bodies.

Then we created a simple GET route at /.

Finally, we started the server on port 8000.

Why Start This Simple?

Because the goal isn't to write hundreds of lines of code on day one.

The goal is to build the wallet one piece at a time.

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.

Every feature will be something I can explain and test.

What's Next?

Now that the server is running, the next step is connecting it to a real database.

That's where we'll introduce PostgreSQL and Prisma and start designing the actual wallet data model.

This is just the beginning.

Top comments (0)