TrendRadarDocsA PROJECT BYsansansansan's personal projects and softwaresandev.cc
HomeDocumentationCommunityPartnershipsIndividual SupportCredits
  • Start here
    • Choose a deployment
    • No server: GitHub Actions
    • Server / NAS: Docker
    • Try locally: Run with uv
    • Configure content & delivery
  • Data Sources
    • Platform Configuration
    • Self-hosted sources (AI)
    • RSS Feed Configuration
  • Content Filtering
    • Keyword Configuration
    • AI Smart Filtering
  • Push Notifications
    • Push Channels
    • Push Modes
    • Scheduling
  • AI Enhancement
    • AI Analysis & Push
    • AI Translation
    • MCP Chat Analysis
    • MCP Query Guide
  • Data & Operations
    • Storage Configuration
    • Config Editor
    • Publish web reports
    • Architecture
  • More
    • FAQ
  1. Docs
  2. /
  3. Data & Operations
  4. /
  5. Storage Configuration
PreviousMCP Query GuideNextConfig Editor
© TrendRadar·GPL-3.0 License·Website·GitHub·by sansan

Storage Configuration

TrendRadar automatically picks a suitable storage backend based on how you deploy it. In most cases you don't need to configure anything manually — only GitHub Actions deployments require additional cloud storage setup.

Automatic storage backend selection

Deployment environmentStorage locationDescription
Docker / local deploymentLocal diskData is stored in the output/ directory — works out of the box
GitHub ActionsCloud storageThe Actions runtime is destroyed after each run, so you must configure cloud storage to persist data

Local storage (SQLite)

Docker and local deployments use local SQLite storage by default. Data is saved in the output/ directory, with no additional configuration required.

output directory structure

The files in the output/ directory serve different purposes:
  • SQLite database: stores news data, ranking trajectories, RSS entries, AI analysis results, and other core runtime data
  • HTML reports: visual report files used for email push and web viewing
  • TXT snapshots: plain-text data snapshots used for debugging and troubleshooting
When this applies
If you deploy TrendRadar with Docker or locally, data is saved to local disk automatically, and you can skip this part. The cloud storage configuration below applies only to GitHub Actions users.

Remote S3 storage (GitHub Actions users)

The GitHub Actions runtime is destroyed after each run, so you need to configure S3-compatible cloud storage to persist data. We recommend Cloudflare R2 — its free tier is more than enough.

Secrets to configure

In your GitHub repository, go to Settings > Secrets and variables > Actions, and add the following Secrets:
Secret nameValue to enterRequiredDescription
STORAGE_BACKENDremoteRequiredStorage backend type — just set it to remote
S3_BUCKET_NAMEyour bucket nameRequiredFor example, trendradar-data
S3_ACCESS_KEY_IDyour Access Key IDRequiredObtained when you create the API Token
S3_SECRET_ACCESS_KEYyour Secret Access KeyRequiredObtained when you create the API Token (shown only once)
S3_ENDPOINT_URLyour R2 endpoint URLRequiredFormat: https://[account-id].r2.cloudflarestorage.com
S3_REGIONautoOptionalOptional; defaults to "auto" and usually needs no change

Cloudflare R2 setup guide

About R2 charges
Cloudflare R2 requires you to add a payment method (for identity verification only — you won't be charged). It supports dual-currency credit cards or PayPal. R2's free tier provides 10GB of storage per month, which is more than enough for the TrendRadar project.
1
Sign in to the Cloudflare Dashboard
Sign in to your Cloudflare account, then find and click R2 Object Storage in the left-hand menu.
2
Create a bucket
Click Overview > Create Bucket, enter a bucket name (for example, trendradar-data), then click create.
3
Get the endpoint URL
Go back to the Overview page, scroll down to the Account Details section, and find the S3 API address. This address is your S3_ENDPOINT_URL:
https://[your-account-id].r2.cloudflarestorage.com
4
Create an API Token
In the Account Details area, click Manage (R2 API Tokens) to open the token management page. Click Create Account API Token:
  • Give the token a name (for example, trendradar)
  • Permissions: Admin Read and Write
  • Specify bucket: select the bucket you just created
  • Click Create
5
Save the keys
Copy and store them safely right away
After creation, the page shows your Access Key ID and Secret Access Key. These two values are shown only once at creation time and cannot be viewed again after you close the page. If you forget to save them, your only option is to delete the old token and create a new one.

Other S3-compatible providers

In addition to Cloudflare R2, TrendRadar supports other S3-compatible storage services. Below are the endpoint URL formats for common providers:
ProviderS3_ENDPOINT_URL formatNotes
Cloudflare R2https://<account-id>.r2.cloudflarestorage.comRecommended; generous free tier
Alibaba Cloud OSShttps://oss-cn-<region>.aliyuncs.comReplace <region> with the actual region, e.g. hangzhou, shanghai
Tencent Cloud COShttps://cos.ap-<region>.myqcloud.comReplace <region> with the actual region, e.g. guangzhou, beijing
AWS S3https://s3.<region>.amazonaws.comReplace <region> with the actual region, e.g. us-east-1

Data retention policy

You can configure how many days to keep local and cloud data in config/config.yaml:
storage:
  local:
    retention_days: 0     # Retention days (default 0, i.e. keep forever. Set to 30 to keep only the last 30 days)
  remote:
    retention_days: 0     # Retention days (default 0, i.e. keep forever)
About the retention policy
Data older than the retention period is cleaned up automatically on the next run. If you want to keep all data forever, set retention_days to 0 (this is also the default). For cloud storage, set the retention days sensibly based on your free tier to avoid exceeding the storage limit.

Data pull (MCP Server scenario)

If you use the MCP Server to interact with remote data locally, you can configure automatic data sync from remote to local on startup:
storage:
  pull:
    enabled: false    # Enable auto-pull on startup (true=enable, false=disable)
    days: 7           # Pull data from the last N days
Use case
This feature is mainly for the MCP Server scenario: remote data is automatically pulled to local on startup for local analysis and queries. Disabled by default — enable it as needed.

Timezone settings

Data timestamps depend on the timezone setting. You can adjust the timezone in config/config.yaml:
app:
  timezone: "Asia/Shanghai"  # China time by default
If you use it in another timezone, just change it to the corresponding timezone identifier (for example, America/New_York, Europe/London, etc.).