# COS498 HW3: PDF Document Management System This is Homework 3 for **COS498: Server Side Programming Languages** that demonstrates a PDF document management system with custom routing. ## Project Overview This project implements a PDF document management system with the following features: - **Frontend**: Nginx serving static files and Handlebars templates - **Backend**: Node.js/Express server with custom routing - **JSON Metadata**: Book and chapter metadata stored as JSON files - **Containerization**: Docker containers orchestrated with Docker Compose ## Features ### PDF Document Management - **Custom Routing**: Dedicated routing module for book and chapter navigation - **JSON Metadata**: Book and chapter information stored in JSON format - **File Serving**: Direct access to PDF files through designated routes ### User Interface - **Book Browser**: Navigate through available books and chapters - **PDF Viewer**: Embedded PDF viewing with iframe integration - **Responsive Design**: Mobile-friendly layout with consistent styling - **Navigation**: Breadcrumb navigation and book/chapter selection ## Prerequisites Before running this project, ensure you have the following installed: - [Docker](https://docs.docker.com/get-docker/) - [Docker Compose](https://docs.docker.com/compose/install/) ## Project Structure ``` COS498-HW3/ ├── docker-compose.yml # Docker Compose configuration ├── README.md # This file ├── .git/ # Git repository metadata ├── .gitmodules # Git submodules configuration ├── backend/ │ ├── Dockerfile # Backend container configuration │ ├── package.json # Node.js dependencies and scripts │ ├── package-lock.json # Locked dependency versions │ ├── server.js # Node.js Express server │ ├── database/ │ │ └── backend.schema # Database schema definition │ └── modules/ │ ├── RoutingManager.js # Custom routing module │ ├── PDFValidationManager.js # PDF validation module │ └── PDFDatabaseManager.js # Database management module └── frontend/ ├── Dockerfile # Frontend container configuration ├── default.conf # Nginx configuration ├── views/ # Handlebars templates │ ├── index.hbs # Main application template │ └── layout.hbs # Base layout template ├── partials/ # Reusable template components │ ├── books.hbs # Book listing partial │ └── chapters.hbs # Chapter listing partial └── public/ # Static assets and PDF files ├── books/ # PDF document storage │ └── WaysOfTheWorld-Strayer/ # Sample textbook (git submodule) │ ├── README.md # Book information │ ├── .git # Submodule repository metadata │ ├── bookMetadata.json # Book metadata │ ├── chapter1-23.json # Chapter metadata files │ └── chapter1-23.pdf # 23 chapter PDF files └── styles/ └── main.css # Application stylesheet ``` ## Setup Instructions ### Prerequisites Before running the application, you'll need to download the PDF books which are stored as git submodules. 1. **Clone the repository and navigate to the project directory:** ```bash git clone cd /home/npease/COS498-HW3 ``` 2. **Initialize and download git submodules (required for PDF books):** ```bash git submodule init git submodule update ``` Or in one command: ```bash git submodule update --init --recursive ``` **Note**: The PDF books (e.g., WaysOfTheWorld-Strayer) are stored as git submodules and must be downloaded separately. Without this step, the PDF files will not be available. ## How to Start the PDF Management System ### Using Docker Compose (Recommended) 2. **Start all services:** ```bash docker compose up --build ``` 3. **Access the application:** - **Main Application**: http://localhost The application will automatically display available books and chapters for browsing and PDF viewing. 4. **Stop the services:** ```bash docker compose down ``` ## Author Nicholas Pease COS498: Server Side Programming Languages Homework 3: PDF Document Management System