- Overview
- System Requirements
- Prerequisites and Configuration
- Installation & Execution
- API Details: PDF Generation
- Frontend Interface (Vue 3 + Vuetify)
This project enables users to generate comprehensive PDF reports of all their YAM v1 transactions on the Gnosis blockchain.
This project consists of 2 modules:
- PDF Generation API (Python) – Provides an API endpoint to generate and download PDF reports.
- Frontend Interface (Vue.js + Vuetify) – A minimal UI that allows the user to enter their parameters and download the PDF.
- Python 3.11+
- Node.js 18+
- Docker & Docker Compose (optional but recommended)
This project cannot function on its own. It depends on an external postgres database generated and maintained by the YAM Indexing project. The YAM Indexing application must be installed and running on its own.
For more information, see the yam-indexing project.
An example configuration file is provided: .env.example.
Copy it to .env and update the values with your own secrets.
REALTOKENS_API_URL=https://api.realtoken.community/v1/token
API_PORT_INTERNAL=5000
# Allow any app from realtoken.community (*.realtoken.community)
CORS_ORIGIN_REGEX=^https?://([a-z0-9-]+\.)*realtoken\.community$
# or allow any origin
#CORS_ORIGIN_REGEX=.*
# Postgres DB
POSTGRES_DB=yam_events
POSTGRES_HOST=host.docker.internal
POSTGRES_PORT=5432
POSTGRES_READER_USER_NAME=yam-indexing-reader
POSTGRES_READER_USER_PASSWORD=
# Telegram alerts [optional]
TELEGRAM_ALERT_BOT_TOKEN=
TELEGRAM_ALERT_GROUP_ID=Note:
For alerts, you can configure a Telegram bot and a Telegram group: the bot (usingTELEGRAM_ALERT_BOT_TOKEN) must be added to the telegram chat group (TELEGRAM_ALERT_GROUP_ID) to receive automatic notifications about critical events such as failures or application stops.
The project includes a ready-to-use Docker integration.
From the project root directory (where docker-compose.yml is located), build
(or rebuild) and start the service with:
docker compose up --build -dThis single command:
- Rebuilds the image if the source code changed
- Recreates the existing container without duplication
- Starts the service from a clean state
To stop the service:
docker compose stopFor detailed information about what is happening inside the Docker container, see the section below.
# Optional but recommended: create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txt# Change directory to the 'UI' folder (where the frontend code is)
cd UI
# Install all dependencies listed in package.json and build the UI
npm install
npm run buildWhen not using the recommended Docker setup, the different application instances must be managed independently. This includes running the Python-based API as a dedicated process, as well as building the frontend assets and serving them through a web server of choice. Each instance must be started, configured, and maintained separately.
The API can be started in different ways depending on the operating system and execution context. Below are the supported commands.
# Linux (Production-like setup)
gunicorn -w 1 --threads 1 -b 0.0.0.0:5000 API.core.app:create_app()
# Windows (Production)
waitress-serve --listen=0.0.0.0:5000 --threads=1 --call "API.core.app:create_app"
# Windows (dev mode)
python -m API.core.dev_run_apiOnce the API is running, its availability can be checked using the health endpoint:
http://<your-domain>:<public-api-port>/api/health
Note on port Configuration and Environment Variables The API and the frontend rely on different environment variables to determine which ports are used internally and which are exposed publicly.
API internal port
The port on which the API process listens is defined in the.envfile using theAPI_PORT_INTERANLvariable.Public API port (used by the frontend)
The port used by the frontend (UI) to reach the API is defined byVITE_API_PORT:In production, this is set in
.env.productionIn development, this is set in
.env.developmentFor standard configurations, this value can be set to
80or443, allowing API calls without explicitly specifying a port in the URL.
- Development vs Production behavior
In development,VITE_API_PORTusually matchesAPI_PORT_INTERANLsince no reverse proxy is involved (for example, both set to5000).
In production, these values often differ: the API may listen internally on a port such as5000, while a reverse proxy (e.g. Nginx) exposes the API publicly on port443and forwards traffic to the internal port.
The frontend is built as static files located in the UI/dist directory after running npm run build.
Deploy these static files using your existing web server infrastructure (Nginx, Apache, IIS, etc.) or cloud hosting service. The specific deployment method depends on your infrastructure setup and is outside the scope of this guide.
Note: The built application in UI/dist contains standard static HTML, CSS, and JavaScript files that can be served by any web server.
This module provides a RESTful API (using flask python library) to generate PDF reports. The PDF is generated using the reportlab library and includes detailed transaction data over a given date range.
/health– Simple health check endpoint to verify the API is alive/generate-report– Main endpoint to generate and download a PDF report
- Method:
GET - Returns: JSON object with current status and timestamp.
- Method:
POST - Content-Type:
application/json - Returns: A generated PDF file (
application/pdf) containing transaction summaries based on the input filters.
{
"start_date": "2024-09-01T00:00:00Z",
"end_date": "2024-09-30T23:59:59Z",
"event_type": ["buy", "sell", "exchange"],
"user_addresses": ["0x123...", "0xabc..."],
"display_tx_column": true
}-
start_dateandend_datemust be valid ISO 8601 UTC strings (e.g.,"2024-09-01T00:00:00Z"). -
event_typemust be a list containing one or more of the following values:"buy","sell", and/or"exchange". -
user_addressesmust be a list of valid Ethereum addresses. Checksum casing is not required; addresses will be converted automatically. -
display_tx_column(boolean): whether to display the transaction hash column in the final PDF.
Note: the module can be run in dev mode using the following command:
python3 -m api.core.dev_run_api
This is the front-end module for the YAM transaction PDF generator. It provides a modern, mobile-friendly interface allowing users to select wallet addresses, date ranges, transaction types, and other display options. The UI then submits these parameters to the backend API and downloads a customized PDF report.
- Vue 3 with Composition API
- Vuetify 3 for material design components
- Custom styling for a gradient hero section and elegant glassmorphic UI
- Add one or more Ethereum wallet addresses
- Pick a start and end date (with validation)
- Choose one or more transaction types:
Buy,Sell,Exchange - Optional transaction URL column (Gnosisscan link)
- Instant validation for wallet addresses and dates
- Clear UI feedback messages (e.g., errors, success, loading states)