How taffapereira/shopee-affiliate-ops works
Shopee Affiliate Ops automates affiliate product operations: Shopee collection and offer normalization, product ranking, channel-specific content and tracked-link generation, then video creation and multi-channel publishing, with analytics and conversion attribution. The API exposes product, content, link, and analytics workflows; persistent product, content, link, and metric records support them. The README documents the daily pipeline and optional N8N orchestration. Some branches are included from documented capabilities and the source tree; unsampled implementations and their internal call relationships are not asserted.
Main entry points: products.py Product endpoints · main.py FastAPI application · content.py Content endpoints · generator.py Content generation
Components 34
API workflows
- FastAPI application
src/api/main.py - Product endpoints
src/api/routes/products.py - Content endpoints
src/api/routes/content.py - Link endpoints
src/api/routes/links.py - Analytics endpoints
src/api/routes/analytics.py
Product discovery
- Offer collection
src/collectors/shopee_api.py - Offer normalization
src/collectors/offer_parser.py - Product ranking
src/ranking/scorer.py - Product selection
src/ranking/selector.py - DeepSeek ranking client
src/llm/deepseek_client.py
Content and links
- Content generation
src/content/generator.py - Audience personas
src/content/personas.py - TikTok templates
src/content/templates/tiktok.py - Telegram templates
src/content/templates/grupo.py - Hashtag utilities
src/utils/hashtags.py - GPT copywriting client
src/llm/gpt_client.py - Tracked link creation
src/links/shortener.py - SubId construction
src/links/subid_builder.py - LLM routing
src/llm/router.py
Media and publishing
- Video generation
src/video/veo_generator.py - Voice generation
src/video/nanobana_tts.py - Video storage
src/video/storage.py - Channel publishing
src/publishers/buffer_client.py - Telegram publishing
src/publishers/telegram_bot.py - Publishing schedule
src/scheduling/scheduler.py
Analytics and state
- Shopee report fetch
src/analytics/report_fetcher.py - Conversion attribution
src/analytics/attribution.py - Performance metrics
src/analytics/metrics.py - Operational database
src/database/connection.py - Product and activity models
src/database/models.py - Data repository
src/database/repository.py - Structured logging
src/utils/logger.py
Other components
- Affiliate operator
- Shopee Affiliate API
Connections 43
- Affiliate operator → FastAPI application: uses
README.md - FastAPI application → Product endpoints: routes to
src/api/main.py - FastAPI application → Content endpoints: routes to
src/api/main.py - FastAPI application → Link endpoints: routes to
src/api/main.py - FastAPI application → Analytics endpoints: routes to
src/api/main.py - FastAPI application → Operational database: initializes
src/api/main.py - Product endpoints → Offer collection: requests offers
src/api/routes/products.py - Offer collection → Shopee Affiliate API: fetches offers
src/collectors/shopee_api.py - Product endpoints → Offer normalization: normalizes offers
src/api/routes/products.py - Product endpoints → Product selection: selects products
src/api/routes/products.py - Product endpoints → Product ranking: scores products
src/api/routes/products.py - Product selection → Product ranking: uses scorer
src/ranking/selector.py - Product endpoints → Data repository: stores products
src/api/routes/products.py - Content endpoints → Content generation: generates content
src/api/routes/content.py - Content endpoints → LLM routing: requests LLM
src/api/routes/content.py - Content endpoints → Data repository: reads and saves
src/api/routes/content.py - Content generation → Audience personas: loads persona
src/content/generator.py - Content generation → TikTok templates: renders TikTok
src/content/generator.py - Content generation → Telegram templates: renders Telegram
src/content/generator.py - Telegram templates → Hashtag utilities: uses hashtags
src/content/templates/grupo.py - LLM routing → GPT copywriting client: dispatches copy
src/llm/router.py - LLM routing → DeepSeek ranking client: dispatches ranking
src/llm/router.py - Link endpoints → Tracked link creation: creates links
src/api/routes/links.py - Tracked link creation → SubId construction: builds tracking IDs
src/links/shortener.py - Tracked link creation → Shopee Affiliate API: requests affiliate URL
src/links/shortener.py - Link endpoints → Data repository: stores link records
src/api/routes/links.py - Analytics endpoints → Performance metrics: calculates metrics
src/api/routes/analytics.py - Analytics endpoints → Data repository: reads analytics
src/api/routes/analytics.py - Data repository → Operational database: queries and writes
src/database/repository.py - Operational database → Product and activity models: creates tables
src/database/connection.py - Shopee report fetch → Shopee Affiliate API: fetches reports
src/analytics/report_fetcher.py - Shopee report fetch → Offer collection: uses API client
src/analytics/report_fetcher.py - Analytics endpoints → Conversion attribution: supports attribution
- Performance metrics → Conversion attribution: informs attribution
- Content generation → Video generation: feeds video pipeline
- Video generation → Voice generation: adds narration
- Video generation → Video storage: stores media
- Publishing schedule → Telegram publishing: schedules posts
- Publishing schedule → Channel publishing: schedules posts
- Channel publishing → Affiliate operator: publishes channels
- Telegram publishing → Affiliate operator: publishes Telegram
- Product endpoints → Structured logging: logs activity
src/api/routes/products.py - Content endpoints → Structured logging: logs activity
src/api/routes/content.py