Week6

Week 6 #

Specify all the necessary links to your resources:

CategoryLink
🌐 Deploymentlibnet
πŸ“š API DocsFastAPI
🎨 DesignFigma
▢️ DemoVideo
πŸ“¦ RepositoryGitHub

Final deliverables #

Project overview #

Problem Statement #

LibNet addresses three core challenges in library management systems:

  1. Fragmented book search across multiple libraries
  2. Outdated interfaces with poor user experience
  3. Difficulties in obtaining books simplified the search and booking of books

Key Implemented Features #

For Readers #

  • πŸ” Unified book search across all partner libraries
  • πŸ“… Online reservation system with status tracking
  • ❀️ Favorites list for saved books
  • πŸ“± Responsive design for devices

For Library Staff #

  • πŸ“Š Manager dashboard for reservations
  • πŸ“š Book inventory management
  • 🏒 Multi-library support

Technical Highlights #

  • ⚑ FastAPI backend with JWT authentication
  • 🎨 React frontend with Vite optimization
  • πŸ“Š Grafana/Loki monitoring stack
  • πŸ”„ Automated database migration (Ollama)
  • πŸ›‘οΈ Role-based access control

Impact #

  • Fast book discovery for users
  • Centralized management for library networks

Features #

For All Users #

  • Book Search & Discovery

    • Unified catalog across multiple libraries
    • Advanced filters (author, genre, year, availability)
    • β€œNothing found” handling with suggestions
    • Book details with cover images
  • User Management

    • Registration with email validation
    • Login/Logout functionality
    • Password reset/change flow
    • Profile editing

For Readers #

  • Reservation System

    • Book reservation with status tracking
    • Booking cancellation
    • Favorites list (like/unlike books)
    • Order history
  • UI/UX

    • Responsive design (mobile/desktop)
    • Loading skeletons
    • Accessible navigation

For Library Staff #

  • Manager Tools

    • Library-specific dashboard
    • Booking management (approve/reject)
    • Book inventory CRUD operations
    • Library working days configuration
    • Manager assignment system
  • Admin Features

    • Multi-library management
    • User role administration
    • System monitoring access
    • Self-deletion protection

Technical Features #

  • Security

    • JWT authentication
    • Role-based access control
    • DDOS protection
    • HTTPS enforcement
  • Infrastructure

    • Dockerized deployment
    • Grafana/Loki monitoring
    • CI/CD pipelines
    • Automated database migrations

Tech stack #

Backend #

Python

  • Simple syntax with extensive libraries
  • Rapid development capabilities

FastAPI

  • High-performance async framework
  • Seamless PostgreSQL integration
  • Automatic OpenAPI documentation

Frontend #

React

  • Component-based architecture
  • Reusable UI elements (book cards, forms)
  • Future-proof scalability

Vite

  • Lightning-fast build tool
  • Hot module replacement

Database #

PostgreSQL

  • Relational structure for complex queries
  • Built-in JSON support
  • Easy schema migrations

Monitoring & Analytics #

Grafana + Loki

  • Real-time application monitoring
  • Centralized logging system
  • Performance dashboards

Data Processing #

Ollama

  • Library database migration tool
  • Cross-format parsing (.xls, .csv, .json)
  • Schema mapping automation

DevOps #

Docker

  • Containerized environments
  • Development/production parity

GitHub Actions

  • Automated CI/CD pipelines
  • Pull request testing
  • Zero-downtime deployments

Project Management #

ClickUp

  • Task tracking
  • Sprint planning
  • Team coordination

Setup instructions #

Prerequisites #

  • Docker and Docker Compose installed
  • Google account with 2FA enabled
  • Git installed

Deployment Steps #

  1. Clone the repository

    git clone https://github.com/IU-Capstone-Project-2025/libnet.git
    cd libnet
    
  2. Configure environment

    cd backend
    nano  .env  # Create environment file
    
  3. Edit .env file:

    DATABASE_URL=database-url
    SECRET_KEY=your-secret-key
    POSTGRES_USER=your_db_user
    POSTGRES_PASSWORD=your_db_password
    POSTGRES_DB=your_db_name
    SMTP_USER=your-email@gmail.com
    SMTP_PASS=your-google-app-password
    
  4. Google SMTP Setup:

    • Enable 2FA on your Google account
    • Get a key for the application via Google
    • Enter the key in SMTP_PASS, SMTP_USER as email
  5. Launch services

    docker-compose up -d --build
    

The project has been launched!

Presentation draft #

Link to the Draft

Production (Bonus Assignment) #

Production Deployment #

For production deployment, we selected a reliable Virtual Dedicated Server (VDS) provider.
At first, we compared several platforms: host-wds, Beget, and Timeweb. We went with Beget, because:

  • It came with a pre-installed Docker service, making environment setup easier.
  • Pricing was attractive.
  • The UX/design was user-friendly.
  • Some competitors offered VDS abroad with latency and performance issues; we preferred speed and chose a server in Russia.

Server configuration:

  • 2 CPU cores (for multiprocessing)
  • 4GB RAM
  • 50GB NVMe SSD (fast SSD connected directly to motherboard)

Production environment setup:

  1. Purchased the server and connected via SSH.

  2. Cloned the repository to the server.

  3. Created a local .env for secrets:

    • DB connection string (includes DB name, user, password)
    • Credentials for a DB user
    • Secret key for password encoding
    • SMTP user/password for sending confirmation codes

    The .env is only on the server; never committed to source control.

  4. Containerization/Orchestration:

    • Used docker-compose.yml to configure and run all containers.
    • Authored Dockerfiles for both backend and frontend.
    • Initially, Nginx was in a separate container; to simplify, later merged Nginx and frontend into one container.
      The frontend Dockerfile has build and production stages.
    • Nginx has its own config for HTTPβ†’HTTPS redirection.
    • Custom loki.yml and prometheus.yml for logging and monitoring setup.
  5. CI/CD Pipeline:

    • docker-compose.test.yml runs backend and test Postgres for CI.
    • GitHub Actions (.github/workflows) was split:
      • One file for CI (triggered on push to main/devops)
      • One file for CD (auto-deploy, on push to main, runs only after CI passes)
    • Secrets (.env) are never in git, only on the server. .dockerignore is set up.
    • For autodeploy:
      • Created a deploy.yml workflow in .github/workflows with commands for deployment.
      • Generated a private SSH key on a different workstation;
        added the public key to ~/.ssh/authorized_keys on the server.
      • Stored the private key in GitHub repo secrets as SSH_PRIVATE_KEY.
      • Other secrets: SSH_HOST, SSH_USER, PROJECT_DIR.
  6. Domain name setup:

    • Registered libnet.site at reg.ru.
    • Configured DNS:
      • A-record @ β†’ 83.222.17.10
      • A-record www β†’ 83.222.17.10

Weekly commitments #

Individual contribution of each participant #

Team MemberCompleted Work
Ivan MurzinCreate FAQ. Add buttons, create new page for user - Libraries with description and contacts. Add info to orders, add cursor pointer to select list in manager navbar. Fix styles for Manager and Admin pages. Add back button to Book.jsx, add dividers to LibraryInfo. Fix slider over login popup issue. Fix styles. library styling. Fix styles for buttons. Fix style for list-item. Profile buttons fix, warning display fix on small screens
Aliya SagdievaUpdated roadmap in the README. Made the report documentation. Recorded a demo.
Alena AverinaUpdated Jinx configuration. Monitored the site’s performance.
Anna SerovaImplemented the following tasks on the frontend: new library adding, adding publisher of books, library and cities filter, cancelling a booking as a user, verification requirement message, verification status update fix, library filter responsive to city, Automatic library filter at manager, protect admins from deleting themselves, unliking a book, search, filters in all account types, β€œnothing found” message + change in loading display principle, orders user info + weekdays styling, display, setting working days of the library by buttons, change filters by authors and genres with search and signs
Artem OstapenkoAdd bookings sorting. Implementation of Enhance city search. Add ability to change books quantity Add get libraries by city. Optimize get_bookings. Add easier way to access filter parameters. Add booking search for managers. Add book quantity logic. Add endpoint for repeating the verification code. Limit endpoints’ access to prevent DDOS. Add alembic migrations. Add email verification via code. Fix library creation.

Plan for Future #

Backend #

  • Recursive deletion of objects to avoid conflicts

Frontend #

  • Fix possible bugs
  • Clean up code from console output

Confirmation of the code’s operability #

We confirm that the code in the main branch:

  • In working condition.
  • Run via docker-compose (or another alternative described in the README.md).