CoolLib — Distributed Library Core API
A high-performance backend ecosystem engineered with Clean Architecture. It implements a strict separation between JPA Entities and DTOs, serving as the central orchestration hub for both Android (Kotlin) and iOS (SwiftUI) clients.
Project Overview
CoolLib Backend is a robust RESTful service built with Spring Boot and Kotlin. Beyond standard CRUD operations, it manages complex business logic layers to ensure data consistency, security, and seamless synchronization across the mobile ecosystem.
Key Technical Wins
Layered Architecture
Strictly follows the Controller-Service-Repository pattern, ensuring complete decoupling between business logic and data access layers.
Secure Sessions
Integrated Spring Security with JWT (JSON Web Tokens) to provide a stateless authentication mechanism tailored for mobile clients.
Persistence Layer
Leverages PostgreSQL and Spring Data JPA, ensuring the atomicity of borrowing operations through @Transactional services.
Cloud-Native Deployment
Containerized with Docker Compose and secured via Cloudflare Tunnel, utilizing Nginx as a reverse proxy for robust, Zero-Trust external access.
System Architecture
*The backend follows a strict Stateless pattern.*
Authentication Flow
*The security layer uses a OncePerRequestFilter to intercept and validate JWTs.*
Tech Stack
- Core Framework: Spring Boot, Kotlin, Gradle
- Security: JWT, Spring Security, BCrypt Password Hashing
- Data Management: PostgreSQL, Spring Data JPA, Hibernate ORM
- Standards & DevOps: RESTful Design, Docker, Docker Compose, Nginx, Cloudflare Tunnel
Core Features
Identity Management
Advanced Search
Transaction Logic
Deployment Stack
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/v1/auth/login |
Verify credentials and issue a JWT Access Token. | |
| POST | /api/v1/borrow/scan |
Process borrowing via Barcode/ISBN scan. In Dev | |
| GET | /api/v1/stats/loans |
Fetch aggregate data of active loans and trends. Planned | |
| GET | /api/v1/users/profile |
Retrieve identity claims from the decrypted JWT payload. | |
| GET | /api/v1/auth/validate |
Check if the current token is expired or blacklisted. |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/v1/books/search |
Multi-criteria filtering by Title, Author, Publisher, and Year. | |
| GET | /api/v1/books/fuzzy |
Fuzzy search using Levenshtein Distance or partial matching logic. In Dev | |
| GET | /api/v1/books/recommend |
Content-based filtering using User Borrowing History. Planned | |
| GET | /api/v1/books/isbn/{isbn} |
Direct lookup via 10 or 13-digit International Standard Book Number. |
Transaction Processing Pipeline
ACID SECUREuserId & roles from JWT claims.SELECT FOR UPDATE to prevent race conditions.Persist LoanRecord & update Inventory.
Managed by Spring @Transactional logic.
Production-Ready Infrastructure
DOCKERIZEDMobile Connectivity
Both Android and iOS clients interact with this backend through standard REST endpoints.
Authorization: Bearer <token>
Developed with passion by Ryan Su © 2026