How bcat95/shopee-aff works
1. This repository is primarily a reference and demo workspace for Shopee Affiliate APIs, not a full production application. The root README.md is the canonical architecture/documentation entry point and explains the official Shopee Open API and GraphQL surfaces this repo targets.
2. The repo has two documentation domains:
- README.md for the official Shopee Affiliate API.
- product-data-api.md for the non-official Product Data API.
This is an important boundary: the repo intentionally separates “official integration” from “unofficial scraping/data extraction” material.
3. The main external dependency is the Shopee Affiliate platform itself:
- REST/OpenAPI endpoints for product lookups.
- GraphQL queries/mutations for offer lists, affiliate link generation, and conversion/validated reports.
The architecture is therefore an API consumer toolkit around Shopee, with no internal persistence layer shown in the tree.
4. Code/ contains runnable sample clients for the official API in two runtimes:
- Code/nodejs/ for Node.js.
- Code/php/ for PHP.
Both have .env.example files, which indicates secrets and credentials are expected to be injected externally rather than committed.
5. The Node.js sample is the most “application-like” part of the repo:
- index.js is the execution entry point.
- index.test.js shows there is at least some automated validation.
- package.json defines the runtime and dependencies.
Architecturally, this sample likely wraps Shopee request signing/authentication and demonstrates one or more API calls end to end.
6. The PHP sample under Code/php/ is the parallel implementation of the same idea:
- index.php is the entry point.
- .env.example suggests it also relies on credential/config injection.
This gives the repo a language-agnostic integration pattern for Shopee API access.
7. Postman/ is a manual testing and exploration layer:
- Shopee-Product-Data.postman_collection.json
- Shopee-Product-Data.postman_environment.json
These artifacts are for reproducing requests, experimenting with parameters, and validating responses without writing code.
8. bc-custom-link/ is a separate PHP-based utility/demo app with its own mini front-end:
- index.php, link.php, conn.php, func.php
- assets/javascript and assets/stylesheets/custom.css
This looks like a small web tool for generating or managing affiliate/custom links, with a lightweight server-side PHP backend and browser UI assets.
9. The data flow across the repo is consistent:
developer or end user inputs Shopee credentials/config → sample code or custom-link UI builds authenticated requests → requests go to Shopee Affiliate Open API / GraphQL → responses are displayed, tested, or used to create affiliate links / inspect conversions.
There is no evidence of a local database, message queue, or background worker architecture.
10. The important functional boundaries are by API capability, not by service tier:
- Product data retrieval.
- Offer discovery.
- Affiliate link generation.
- Conversion/validated reporting.
These are mapped directly in the docs and likely mirrored in the sample code and Postman collection.
11. From an architecture-diagram perspective, the repo should be drawn as a tooling and documentation hub centered on Shopee APIs, with three consumer surfaces:
- scripted API clients (Code/)
- manual API client artifacts (Postman/)
- a browser-based PHP helper app (bc-custom-link/)
All of them depend on the same external Shopee Affiliate API platform.
12. The repo’s operational assumptions are important:
- credentials/signatures/tokens are required,
- rate limits and cursor expiry matter,
- GraphQL and REST coexist,
- affiliate link creation and conversion reporting are the key business flows.
These constraints shape the implementation, but they are enforced by the Shopee platform rather than by internal infrastructure in this repo.
Main entry points: index.js Node sample · index.php PHP sample · link.php Link builder · Shopee-Product-Data.postman_collection.json Postman collection
Components 17
Documentation
Repository guidance and API references
- README · Canonical entry point for the official Shopee Affiliate API
README.md - Product API · Non-official product data API reference and boundary
product-data-api.md
Code Samples
Runnable client implementations
- Code README · Overview for runnable code samples
Code/README.md - Node sample · Executable Node.js Shopee API client
Code/nodejs/index.js - Node tests · Automated checks for the Node sample
Code/nodejs/index.test.js - Node config · Node.js package and dependency definition
Code/nodejs/package.json - PHP sample · Executable PHP Shopee API client
Code/php/index.php
Manual Testing
Postman artifacts for request exploration
- Postman collection · Saved requests for product data exploration
Postman/Shopee-Product-Data.postman_collection.json - Postman env · Local environment values for Postman runs
Postman/Shopee-Product-Data.postman_environment.json
Custom Link Tool
PHP utility for affiliate link workflows
- Link tool · Browser-based PHP utility for custom affiliate links
bc-custom-link/index.php - Link builder · Server-side link generation and request handling
bc-custom-link/link.php - Connection · Backend connection and API setup logic
bc-custom-link/conn.php - Helpers · Shared PHP helper functions for the custom link tool
bc-custom-link/func.php
Shopee Platform
External API surfaces and business capabilities
- Shopee API · External Shopee Affiliate platform
- REST/OpenAPI · Official REST endpoints for product data
- GraphQL · Official GraphQL queries and mutations for affiliate workflows
- Affiliate flows · Offer discovery, link generation, and conversion reporting
Connections 21
- README → Shopee API: documents · Explains the official platform and supported API surfaces
- Product API → Shopee API: references · Covers the non-official product data API boundary
- Code README → Node sample: guides · Introduces the runnable Node.js sample
- Code README → PHP sample: guides · Introduces the runnable PHP sample
- Node sample → Node config: uses · Depends on package and runtime configuration
- Node sample → Node tests: validated by · Has a companion test file
- Node sample → REST/OpenAPI: calls · Demonstrates REST/OpenAPI product requests
- Node sample → GraphQL: calls · Demonstrates GraphQL affiliate requests
- PHP sample → GraphQL: calls · Parallel PHP integration against Shopee GraphQL
- PHP sample → REST/OpenAPI: calls · Parallel PHP integration against Shopee REST
- Postman collection → REST/OpenAPI: exercises · Saved requests for manual API exploration
- Postman collection → GraphQL: exercises · Can reproduce GraphQL affiliate queries
- Postman env → Postman collection: configures · Provides environment variables for runs
- Link tool → Link builder: drives · UI submits link-generation actions
- Link builder → Connection: uses · Delegates backend connectivity and auth setup
- Link builder → Helpers: uses · Shares helper routines for link processing
- Connection → GraphQL: calls · Backend talks to Shopee affiliate APIs
- Affiliate flows → GraphQL: implemented by · Key affiliate workflows are exposed through GraphQL
- Affiliate flows → REST/OpenAPI: supported by · Product lookup flows use REST/OpenAPI
- Shopee API → REST/OpenAPI: includes · External platform exposes REST product endpoints
- Shopee API → GraphQL: includes · External platform exposes GraphQL affiliate operations