A regulatory compliant banking API built with Unit.co.
Motivation
I have a deep interest in software-as-service (SaaS) companies that can completely streamline an industry down to an API call; Unit.co does exactly that, but for the banking industry.
When I saw their API documentation, everything seemed too good to be true. There was no way that I, an undergraduate student, could create a fully operational bank, right? I challenged myself to try.
Goal
- Build a bank using Unit.co’s API
- Deploy my API to Heroku
Tech Stack
- TypeScript - programming language
- Nest.js - an opinionated framework for writing backend applications in JavaScript/TypeScript
- MongoDB Atlas - free NoSQL which is where data is stored
- Heroku - hosts the API server
- Github - tracks code changes, pushes the latest change to Heroku, which then goes live on racks.michaelpalladino.io.
Challenges
- Data Validation
- I discovered Nest.js has subpar support for data validation using MongoDB in comparison to its SQL-based counterparts. I eventually had to create my own ValidationPipe, which intercepts incoming requests and validates the data using class-validator.
- Data Relationships
- Many-to-one, one-to-many, etc in MongoDB can be represented by adding ObjectID references to their respective schemas.
- Example: UserSchema has a reference to a BankAccountSchema, BankAccountSchema has a reference to DebitCardSchema, etc.
- Nest.js supports MongoDB via mongoose (a wrapper framework designed to make interacting with MongoDB easier). However, Nest.js encourages (and mostly only supports) class decorators to model schemas. As a result, this made relationship modeling and data validation much more challenging. I got everything working and modeled correctly with the use of mongoose’s .populate() feature and a custom ValidationPipe.
Team
- Michael Palladino