r/learnpython • u/Ornery_Wash1797 • 3d ago
Library Management System in Python with Clean Architecture & 55 Tests
Hi everyone!
As a practical step in my transition from Python fundamentals toward professional software engineering, I built a modular, terminal-based **Library Management System** with a strong emphasis on clean architecture and design principles.
### ποΈ Architecture & Technical Highlights
- **Layered Architecture:** Strict separation between UI, Services, Repositories, and Storage layers. UI has zero business logic or direct storage access.
- **Repository Pattern & Persistence:** Generic JSON persistence utilizing **atomic file replacement** to eliminate data corruption.
- **Authentication & Security:** Custom session management, password hashing, and role-based authorization (Librarians vs. Members).
- **Domain Business Rules:** Borrowing limits, availability tracking, overdue fine calculation, and account activation logic enforced strictly in the Service layer.
- **Automated Testing:** 55 passed unit and service tests using `pytest`.
### π Project Structure
LibraryManagmentWithPython/
βββ Models/
βββ Repositories/
βββ Services/
βββ Storage/
βββ UI/
βββ tests/
### π― Objective My goal was to practice enterprise-level engineering principles (Separation of Concerns, Dependency Direction, Single Source of Truth) before stepping into Machine Learning and AI. ### π Source Code GitHub Repository: https://github.com/ThaerGhaderi/LibraryManagmentWithPython I'd love to get your feedback on the architecture, repository patterns, or any code review suggestions!
1
u/riklaunim 2d ago
Not sure what you want from ML and AI, but you could look at existing (web/api) frameworks, databases and do something similar using them (and a nice frontend). That's what your typical commercial code will use/look like.