A professional web application for library management built with Flask and Vue.js, featuring a modular architecture and comprehensive test coverage.
Development Status: π§ Under Active Development
- Framework: Flask 2.3.3 with Blueprints
- Database: PostgreSQL with SQLAlchemy ORM
- Caching: Function-level caching for performance
- API: RESTful with proper error handling
- Testing: pytest with coverage reporting
- Framework: Vue.js 3 + Bootstrap 5
- UI Components: Reactive components with state management
- Error Handling: Comprehensive client-side validation
- Loading States: Visual feedback for async operations
- AJAX: Fetch API with proper error handling
- Database indexing for frequent queries
- Caching for dashboard statistics
- Optimized database relationships
- Compressed static assets
- CRUD operations with validation
- Real-time search functionality
- Stock quantity tracking
- Preventing deletion of books with active loans
- Member registration with email validation
- Debt tracking and limit enforcement
- Transaction history viewing
- Interactive member editing
- Book issue/return with error checking
- Automatic fee calculation
- Debt limit enforcement (KES 500)
- Transaction history tracking
- Real-time statistics
- Revenue tracking
- Stock monitoring
- Active loans overview
- Implement user authentication system
- Add role-based access control (Admin, Librarian, Member)
- Add OAuth2 support for social login
- Session management and security enhancements
- Implement database connection pooling optimization
- Add database query caching layer
- Implement async database operations for heavy tasks
- Add full-text search capabilities for books
- Add dark mode support
- Implement responsive design for mobile devices
- Add book cover image upload functionality
- Implement real-time notifications for due dates
- Complete API documentation using OpenAPI/Swagger
- Implement API versioning
- Add rate limiting for all endpoints
- Implement webhook notifications for events
- Add structured logging
- Implement error tracking and reporting
- Add performance monitoring
- Create admin dashboard for system metrics
- Add integration tests for all API endpoints
- Implement end-to-end testing
- Add load testing scripts
- Set up CI/CD pipeline
- Add Docker containerization
- Implement automated backup system
- Add environment-specific configuration management
- Service layer for business logic
- Repository pattern for data access
- Modular Blueprint-based structure
- Separation of concerns
# Run test suite with coverage
pytest tests/ --cov=app
# Current coverage: 90%+ for core functionality
- Comprehensive error catching
- User-friendly error messages
- Transaction rollbacks
- Validation at all levels
- Clone and setup:
git clone https://github.com/yourusername/library-management-app.git
cd library-management-app
python -m venv venv
source venv/bin/activate # Linux/Mac
pip install -r requirements.txt
- Configure environment:
cp .env.example .env
# Edit .env with your settings:
# - Generate a secure SECRET_KEY
# - Update DATABASE_URL with your PostgreSQL credentials
# - Configure email settings if needed
# - Adjust other settings as required
- Initialize database:
createdb library_db
flask db upgrade
- Run development server:
flask run
You can verify the database contents using psql:
The screenshot shows:
- Proper table structure creation
- Data integrity verification
- Database connectivity confirmation
The application is configured for PythonAnywhere deployment:
- Initial setup:
# Clone repository on PythonAnywhere
cd ~
git clone https://github.com/yourusername/library-management-app.git
python3.9 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Configure environment:
# Set up MySQL database in PythonAnywhere
# Add environment variables in Web tab
FLASK_APP=run.py
SECRET_KEY=your-secure-key
PYTHONPATH=/home/yourusername/library-management-app
- Initialize database:
flask db upgrade
python scripts/sample_data.py # Optional: for sample data
- Configure static files:
# In the Web tab, set the path for static files
STATIC_ROOT=/home/yourusername/library-management-app/app/static
- Database indexes for common queries
- Caching for frequently accessed data
- Optimized database queries
- Efficient front-end rendering
- Compressed static assets
- Rate limiting on API endpoints
- CORS protection
- SQL injection prevention
- XSS protection
- CSRF protection
- Secure session handling
library-management-app/
βββ app/ # Application package
β βββ static/ # Static files
β β βββ css/ # CSS stylesheets
β β β βββ style.css # Custom styles
β β βββ js/ # JavaScript files
β β βββ main.js # Main JavaScript
β β βββ vue-components.js # Vue.js components
β βββ templates/ # Jinja2 templates
β β βββ base.html # Base template
β β βββ index.html # Dashboard template
β β βββ books.html # Books management
β β βββ members.html # Members management
β β βββ transactions.html # Transactions management
β βββ __init__.py # App factory
β βββ models.py # Database models
β βββ routes.py # Route handlers
β βββ services.py # Business logic layer
βββ tests/ # Test suite
β βββ __init__.py
β βββ test_models.py # Model tests
β βββ test_routes.py # Route tests
β βββ test_services.py # Service tests
βββ .env # Environment variables
βββ .gitignore # Git ignore rules
βββ app.json # Heroku app config
βββ config.py # App configuration
βββ Procfile # Heroku deployment
βββ README.md # Documentation
βββ requirements.txt # Dependencies
βββ runtime.txt # Python version
βββ run.py # Application entry
- static/: Frontend assets
- CSS and JavaScript files
- Vue.js components for reactive UI
- templates/: HTML templates
- Modular template structure
- Component-based organization
- models.py: Database schema
- SQLAlchemy models
- Database relationships
- services.py: Business logic
- Transaction handling
- Data validation
- routes.py: API endpoints
- RESTful routes
- Request handling
- Unit tests for models
- Integration tests for routes
- Service layer tests
- Test fixtures and utilities
- Environment-based settings
- Database configurations
- Security parameters
- Deployment settings
- Heroku configuration
- Production settings
- Database migrations
- Server specifications
The main dashboard showing:
- Statistics overview with cards
The book management interfaces show:
- Complete book catalog with search functionality
- Add/Edit/Delete book operations
The member section displays:
- Member registration and profiles
- Debt tracking and history
- Active loans monitoring
The transaction interface includes:
- Active loans overview
- Book checkout process
- Return processing
- Fee calculations
This structure follows:
- Separation of concerns
- Modular design patterns
- Testing best practices
- Clear dependency management
- Deployment readiness