คู่มือสภาพแวดล้อม Sandbox
การพัฒนาในเครื่อง การทดสอบอัตโนมัติ และกระบวนการ CI/CD โดยไม่เสียโควตา
ระบบ Sandbox ของ SmallPict เปิดโอกาสให้นักพัฒนาจำลองกระบวนการทำงานได้เสมือนจริง โดยไม่มีค่าใช้จ่ายและไม่กระทบต่อโควตารายเดือน
คีย์ API สำหรับ Sandbox
สำหรับการทดสอบ ให้ใช้คีย์ที่มีคำนำหน้าว่า sp_test_:
# คีย์สำหรับระบบจริง (หักโควตารายเดือน)sp_live_9a8b7c6d5e4f...
# คีย์ Sandbox สำหรับทดสอบ (ฟรี ไม่หักโควตา)sp_test_1a2b3c4d5e6f...End-to-End Image Processing & Edge CDN Flow
Sub-50ms image optimization lifecycle from client upload to global edge delivery.
- 01
Client Application
WordPress / SDK / API
Uploads raw image binary with HMAC-SHA256 signature and UUID v4 idempotency key.
Origin Request
- 02
smallPict Edge CDN
Global Edge PoPs
Checks global edge cache. On cache HIT, delivers AVIF/WebP in <20ms worldwide.
Cache & Delivery
- 03
SmallPict API Gateway
Authentication & Quotas
Validates HMAC credentials, verifies quota limits, and scopes access to customer_id.
Auth & Scoping
- 04
Optimization Engine
High-Speed Native Encoder
Multi-threaded quantization transcode to AVIF & WebP with no visible quality loss and much smaller files.
Transcoding
- 05
Secure Storage & Sync
Encrypted Cloud Storage
Stores optimized output, invalidates outdated cache tags, and warms the edge cache.
Persistent Sync
Zero Data Interception: End-to-end HMAC validation & SHA256 integrity check
Engine: smallPict
ตัวอย่างการใช้งานบน Node.js / TypeScript
import { SmallPictClient } from "@smallpict/sdk";
const client = new SmallPictClient({ apiKey: process.env.SMALLPICT_TEST_KEY || "sp_test_sandbox_secret_key"});
async function runIntegrationTest() { const result = await client.optimize({ file: "./test-fixtures/large-banner.jpg", format: "avif", quality: 80 });
console.log("สถานะการทดสอบ:", result.status); // "completed" console.log("เปอร์เซ็นต์ที่ประหยัดได้:", result.savingsPercentage); // ~85% console.log("URL สำหรับทดสอบ:", result.url);}
runIntegrationTest();กฎการทำงานของ Sandbox
- ไม่หักโควตา: คำตอบจะส่งส่วนหัว
X-Sandbox-Mode: trueกลับมา - เก็บไฟล์ไว้ 24 ชั่วโมง: ไฟล์ที่สร้างขึ้นในการทดสอบจะถูกลบอัตโนมัติหลังจากครบ 24 ชั่วโมง
- จำกัดอัตราคำขอ: สูงสุด 60 คำขอต่อนาทีต่อหนึ่งหมายเลข IP