Case studies/Crypto & DeFi
NFT lending · backend and frontend

Astaria

2022 - 2023 startup wound down, site offline

NFT-collateralized lending protocol: borrow ETH against NFTs instantly, lend into vaults, buy discounted NFTs from liquidated loans.

Overview

Astaria was an NFT-collateralized lending protocol on Ethereum, pitched on its site as instant liquidity for NFTs. Holders of NFTs from select collections could borrow ETH against them, lenders deposited ETH into vaults to earn yield on other people's loans, and NFTs from liquidated loans went to auction, where buyers could pick up blue chip pieces at a discount.

Data Subsystems worked on both sides of the platform, alongside Astaria's in-house engineers. The infrastructure was built on AWS: a load balancer, ECS, EC2, SQS, S3, Lambda, Database Migration Service, API Gateway and Amazon MSK, with on-chain data indexed through a Subgraph and StreamingFast Substreams and some tasks built on NestJS REST and GraphQL APIs. On the frontend, the team contributed to the Next.js 13 lending app.

By April 2023 the app covered borrowing, lending vaults, vault creation for strategists, auctions and liquidations, strategist profiles and a dashboard, running on Ethereum mainnet in production and the Goerli testnet in staging. Astaria has since wound down and its site is offline, so the screenshot comes from the Wayback Machine, January 2024.

What was built

Stack

Frontend

Next.js 13
Framework for the lending app: borrow, lend, auction and strategist pages plus a few API routes
Mantine 5
Component library and theming, including the collateral, transaction and terms modals
React Query
Fetching and caching loan data on the borrow screens, with a persisted query cache
Zustand
Cart-style stores for the NFTs picked as collateral and the transactions queued in the borrow flow
Recharts
Line charts in the borrow, lend and auction summaries on the dashboard

Backend

NestJS REST / GraphQL
REST and GraphQL APIs used for part of the backend work

Data

Subgraph
Indexing on-chain protocol data so the platform could query it
StreamingFast Substreams
Blockchain data streaming and indexing, used alongside the Subgraph

Infrastructure & DevOps

AWS ECS, EC2, ALB
Container services and instances behind an application load balancer
AWS Lambda, API Gateway
Serverless functions and API endpoints within the platform's AWS infrastructure
AWS SQS, MSK
Message queues and managed Kafka for moving data through the backend
AWS S3, DMS
Object storage and the Database Migration Service in the same AWS setup
Vercel
Frontend hosting, configured with HSTS and other security response headers
GitHub Actions
Lint, production build and Jest tests on pushes and pull requests to staging and master
Sentry
Error monitoring on client and server, with breadcrumbs recording each transaction's creation, success or failure

Integrations & Payments

Center API
Looking up the NFTs a wallet owns and their token metadata for the borrow screens
Etherscan API
Block explorer data requested through a server-side Next.js API route

Web3

wagmi
React hooks for wallet accounts and contract writes, including vault deployment
ethers v5
Providers, BigNumber math and raw contract calls throughout the app
ConnectKit
Themed wallet connection modal wrapped around the wagmi client
Astaria SDK
The protocol's TypeScript SDK: router and vault contract factories and collateral id generation
TypeChain
Typed bindings for the vault and withdraw-proxy display-data helper contracts
Mainnet, Goerli, Hardhat
Ethereum mainnet in production, Goerli for staging and a local Hardhat chain for development

Tooling & QA

TypeScript
Typed codebase across pages, hooks and contract bindings, with a separate typecheck script
Jest + Testing Library
Component and snapshot tests, run before commits and in CI
Storybook
Isolated development of components such as the charts, with a dark-mode addon
Husky + commitlint
Git hooks running tests and lint-staged, and enforcing Conventional Commit messages

Engineering highlights

Vault listings merge an off-chain vaults API with on-chain figures read in a single eth_call: a display-data helper contract is executed from its constructor without ever being deployed, returning data for many vaults at once.

Contract access leans on Astaria's own TypeScript SDK (router and vault contract factories, the offer router) plus TypeChain bindings for the display-data helper contracts.

Quality gates on commit and in CI: tests and lint-staged before each commit, Conventional Commit checks on every message, and lint, build and tests in GitHub Actions for staging and master.

The backend combined on-chain indexing (Subgraph, StreamingFast Substreams) with AWS queueing and streaming through SQS and Amazon MSK.