An AI powered CPP port of the chrs-cms-retro project
A C++ web application built with the Drogon framework that provides a Content Management System (CMS) for managing a library catalog with AI-powered book/magazine recognition capabilities.
- RESTful API endpoints for managing library entries
- OpenAI Vision API integration for automatic book/magazine metadata extraction
- Image processing with automatic resizing and optimization
- SQLite database for data persistence
- JSON-based API responses
- Web-based user interface
Before you begin, ensure you have the following installed on your system:
- C++ compiler with C++17 support (GCC 7+ or Clang 5+)
- CMake (3.14 or higher)
- OpenCV (4.0 or higher)
- SQLite3
- JsonCpp
- Drogon framework
# Install system dependencies
sudo apt update
sudo apt install -y \
build-essential \
cmake \
git \
libssl-dev \
libsqlite3-dev \
libjsoncpp-dev \
libopencv-dev \
uuid-dev \
zlib1g-dev
# Install Drogon
git clone https://github.com/drogonframework/drogon
cd drogon
git submodule update --init
mkdir build
cd build
cmake ..
make && sudo make install# Install dependencies using Homebrew
brew install \
cmake \
openssl \
sqlite \
jsoncpp \
opencv \
ossp-uuid \
drogon- Clone the repository:
git clone https://github.com/jasonsperske/chrs-cms-cpp
cd chrs-cms-cpp- Create a
.envfile in the project root:
OPENAI_API_KEY=your_openai_api_key_here- Build the project:
mkdir build
cd build
cmake ..
make- Initialize the database:
sqlite3 library.sqlite < ../sql/schema.sql- Run the application:
./library-cmsThe application will be available at http://localhost:3000
library-cms/
├── CMakeLists.txt
├── README.md
├── .env
├── src/
│ ├── main.cpp
│ ├── controllers/
│ │ ├── EntryController.cpp
│ │ ├── EntryController.h
│ │ ├── VisionController.cpp
│ │ └── VisionController.h
│ └── models/
│ ├── Entry.cpp
│ ├── Entry.h
│ ├── Library.cpp
│ └── Library.h
├── templates/
│ ├── layout.csp
│ └── index.csp
└── sql/
└── schema.sql
Returns the main web interface for the library CMS.
Returns metadata for a specific library entry.
Response Format:
{
"success": true,
"response": {
"id": 1,
"title": "Book Title",
"author": "Author Name"
// ... additional metadata
}
}Analyzes images of books or magazines using OpenAI's Vision API to extract metadata.
Request Body:
files: Array of image files (multipart/form-data)
Response Format:
{
"success": true,
"response": {
"mediaType": "book",
"title": "Detected Title",
"author": "Detected Author"
// ... additional metadata
}
}The application uses SQLite with the following basic schema (expand as needed):
CREATE TABLE IF NOT EXISTS library (
id INTEGER PRIMARY KEY AUTOINCREMENT,
mediaType TEXT NOT NULL,
title TEXT NOT NULL,
author TEXT,
publishedBy TEXT,
publishedLocation TEXT,
edition TEXT,
editionYear TEXT,
publishedOn TEXT,
serialNumber TEXT,
catalogNumber TEXT,
section TEXT
);- Create header and implementation files in
src/controllers/ - Register the new controller in
main.cpp - Update CMakeLists.txt if needed
- Create header and implementation files in
src/models/ - Update the database schema if needed
- Update CMakeLists.txt if needed
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.