Tools: 🚀 Building My First Backend Project: Expense Tracker API
Source: Dev.to
As part of my journey into backend development, I recently built my first REST API — an Expense Tracker API.
The goal of the project was simple: create a backend system that allows users to track expenses, organize them by category, and manage financial records through an API.
This project helped me understand how real backend systems are structured, from database design to API architecture.
💡 Project Overview
The Expense Tracker API is a RESTful backend service that allows users to:
Create and manage expense categories
Add and track expenses
Organize expenses by category
Perform CRUD operations through API endpoints
It acts as the backend engine that could power a mobile app, web dashboard, or financial management system.
⚙️ Tech Stack
For this project, I used the following technologies:
Node.js – Runtime environment
Express.js – Web framework for building the API
PostgreSQL – Relational database
Sequelize ORM – Database modeling and migrations
Docker – Containerized development environment
TablePlus – Database management
These tools helped me learn how modern backend systems are structured and deployed.
🗂️ Database Design
The API is built around two main entities:
Categories
Categories help organize expenses into groups such as:
Food
Transportation
Utilities
Entertainment
Each category contains:
id
name
createdAt
updatedAt
Expenses
Expenses represent individual financial records.
Each expense contains:
id
title
amount
categoryId
createdAt
updatedAt
The categoryId acts as a foreign key that connects each expense to a category.
This relationship ensures that expenses are properly categorized.
🔗 API Endpoints
The API provides standard REST endpoints.
Categories
POST /categories
GET /categories
GET /categories/:id
PUT /categories/:id
DELETE /categories/:id
Expenses
POST /expenses
GET /expenses
GET /expenses/:id
PUT /expenses/:id
DELETE /expenses/:id
These endpoints allow full CRUD functionality for managing financial data.
🛠️ Key Things I Learned
Building this project helped me understand several important backend concepts.
1️⃣ Database Migrations
Using Sequelize migrations helped me version control my database structure.
Instead of manually creating tables, migrations allowed me to define schemas programmatically and run them using CLI commands.
2️⃣ Model Relationships
One challenge I faced was linking Expenses to Categories using a foreign key.
This helped me understand how relational databases maintain data integrity between tables.
3️⃣ API Architecture
I learned how to structure a backend project using:
Routes
Controllers
Models
Migrations
This separation keeps the codebase clean and maintainable.
4️⃣ Error Handling
While building the API, I encountered several common backend issues like:
Migration order errors
Database connection problems
Incorrect model references
Debugging these problems improved my understanding of how backend systems behave.
🐳 Using Docker for Development
I also experimented with Docker to standardize the development environment.
Using Docker ensures that the application runs consistently across different systems by packaging the runtime, dependencies, and configuration together.
📌 Future Improvements
This project is just the beginning. Some improvements I plan to add include:
User authentication (JWT) (Done already)
Expense filtering by date
Pagination for large datasets
Expense analytics endpoints
API documentation with Swagger Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse