How tteletubie/bookworm works
Purpose and entry point
BookWorm is a Python command-line library manager. main.py is the application entry point and coordinates user interaction with domain and persistence modules. The primary runtime is Python with dependencies declared in requirements.txt.
CLI presentation boundary
Console-facing rendering and prompts are separated into ui/visuals.py. main.py should use this layer to present menus, status messages, and workflow choices rather than coupling display behavior to book or user persistence.
Paths: main.py, ui/visuals.py
Book management domain
Book-oriented operations are encapsulated in library/books.py. This is the core domain boundary for catalog actions such as listing, creating, updating, searching, or lending-related book state, with persistence delegated below it.
Paths: library/books.py, database/database.py, database/database.json
User and authentication domain
User records and user-facing library actions are represented separately from books. library/users.py owns library-user behavior, while auth/credentials.py provides the authentication/credential boundary used to identify or validate users before protected workflows proceed.
Paths: library/users.py, auth/credentials.py, database/database.py
Persistence and initial data
database/database.py is the repository’s storage access layer. Its persisted local datastore is database/database.json, making this a file-backed application rather than a networked service. Seed scripts establish initial catalog and user data, likely for first-run setup or reset workflows.
Paths: database/database.py, database/database.json, database/seed_books.py
Application control flow
The expected flow is: launch main.py; initialize or access file-backed data through database/database.py; authenticate through auth/credentials.py when needed; route selected commands to library/books.py or library/users.py; render results through ui/visuals.py; persist mutations back to database/database.json.
Supporting information and environment
about/about.py contains application or team metadata for an informational CLI path. The repository supports local virtual-environment execution and GitHub Codespaces development through .devcontainer/.
Paths: about/about.py, .devcontainer/devcontainer.json, .devcontainer/post-create.sh
Components 11
CLI application
- CLI entry point · Coordinates command workflows.
main.py - Console UI · Renders menus, prompts, and status messages.
ui/visuals.py
Domain and auth
- Book management · Handles catalog and lending-related book actions.
library/books.py - Library users · Handles user-facing library behavior.
library/users.py - Credentials · Identifies or validates users for protected workflows.
auth/credentials.py
File persistence
- Storage access · Reads and writes the local datastore.
database/database.py - Local datastore · File-backed persisted catalog and user data.
database/database.json - Book seed script · Establishes initial catalog data.
database/seed_books.py
Setup and information
- About information · Provides an informational CLI path.
about/about.py - Development environment · Supports local virtual-environment and Codespaces development.
.devcontainer/devcontainer.json - Post-create setup
.devcontainer/post-create.sh
Connections 12
- CLI entry point → Console UI: renders via
- CLI entry point → Credentials: authenticates
- CLI entry point → Book management: routes book commands
- CLI entry point → Library users: routes user commands
- CLI entry point → About information: shows about path
- CLI entry point → Storage access: initializes/accesses
- Book management → Storage access: persists through
- Library users → Storage access: persists through
- Credentials → Storage access: validates against
- Storage access → Local datastore: reads and writes
- Book seed script → Storage access: seeds through
- Post-create setup → Development environment: runs after creation