Personal · TypeScript practice · 2025Learning project
ATM API
A small bank-host simulator in TypeScript. An ATM posts a card number, PIN and transaction type; the server checks the PIN with bcrypt and approves a balance inquiry or a withdrawal.
Who wrote whatI used an AI tutor to explain concepts while learning; I wrote the code.
- ATM posts card, PIN, type
- Validate the message (400 if bad)
- Find the card, compare PIN with bcrypt
- Balance inquiry, or withdrawal with a balance check
- Approved or declined
The part I like
Transaction types are a union, and the switch ends in a never check. Add a new type and the compiler refuses to build until it's handled.
What's not real yet
Accounts live in memory, the PIN “encryption” is a placeholder, and declines come back as 401 when they should have their own status. Next: SQLite for accounts, idempotent withdrawals and proper response codes.