Project

SaveLend

This project is a modern web application designed for managing savings and loans, built with Next.js, TypeScript, and Tailwind CSS. It leverages Drizzle ORM for database interactions and TanStack Query for data fetching, providing a responsive and scalable platform. The architecture emphasizes modularity, with a clear separation of concerns between UI components, server actions, and database schemas. Overall, it offers a robust foundation for financial management tailored to small teams or organizations.

April 2026

About

This application provides a comprehensive platform for managing savings, loans, and related financial activities within teams or organizations. Its modular architecture ensures maintainability and scalability, making it suitable for small to medium-sized financial operations.

Purpose

It addresses the need for an integrated solution to track member contributions, loan disbursements, repayments, and ledger events. Key features include user authentication, team management, member profiles, savings deposits and withdrawals, loan management, and detailed ledger tracking.

Technical Deep Dive

A notable architectural choice is the use of Drizzle ORM for database schema management and queries, which offers type safety and seamless integration with TypeScript. The codebase employs a self-referencing relation in the loan table to handle loan renewals, enabling complex relational queries like fetching parent and child loans efficiently. Additionally, the authentication system is built with better-auth, configured with social providers and custom session handling, which enriches user sessions with team data. This combination of ORM, relational design, and flexible authentication demonstrates a thoughtful approach to building a scalable, secure backend.

Lessons Learned

One challenge was designing the self-referential relationships in the loan table to accurately track renewals without introducing circular dependencies. Balancing relational integrity with query performance required careful schema design and relation naming. This experience underscored the importance of explicit relation definitions and clear naming conventions in complex relational schemas.