Gateway API Online (Sub-ms Cache)

Gadget SaaS API & SDK Architecture

Production-grade REST engine for building next-generation E-commerce Web Stores (Next.js) and Mobile Applications (Flutter & React Native). Access unified single-fetch hardware specifications, Cinebench/Geekbench benchmarks, multi-currency price guides (BDT, INR, USD), and dual-tier Bunny CDN WebP graphics (1080x1080 master & 300x300 ultra-fast thumbnails).

System Topology

Three-Tier Hybrid SaaS Architecture

Domain-Gated Server-to-Server Protocol
ZONE 1 Master Cloud

Pixahunt Central Engine

Maintains comprehensive hardware templates, raw technical specs, highlights, and vector category SVGs.

gadget_saas_categories
icon_svg_url (Bunny CDN) & raw SVG
gadget_saas_products
specs, benchmarks, pricing (BDT/INR/USD), CDN WebP (1080p & 300p)
ZONE 2 Domain Gate

Security & Caching Gateway

Enforces registered domain whitelist and delivers single-fetch specifications in sub-millisecond latency.

X-CLIENT-DOMAIN Gate
  • • Origin & domain security enforcement
  • • Zero API key leaks to browser source code
  • • Microsecond Redis response caching
ZONE 3 Client Apps

Client Web & Mobile Apps

Client database stores only local pricing, inventory, and cart data. Hardware specs are merged dynamically.

Client Local DB
Stores: price, stock, custom_discount, overrides
Client Storefront (Next.js / Flutter)
Hybrid Merged Product & Category Icons

Category Vector SVG Engine & Client Override Logic

Every hardware category (RAM, CPU, Monitor, Power, Phone) comes with an official, high-resolution vector SVG icon hosted on Bunny CDN. Clients can use Pixahunt's SVGs directly with zero design overhead, or override them with custom SVGs in their local database.

1. Default Vector SVGs via Bunny CDN

The Category API returns both a CDN direct link (icon_svg_url) and inline vector markup (icon_svg_raw). This ensures sharp display on high-DPI smartphone displays (Retina, AMOLED) and responsive desktop monitors without pixelation.

"icon_svg_url": "https://cdn.pixahunt.com/gadget/categories/1791...-ram.svg",
"icon_svg_raw": "<svg xmlns='...' viewBox='0 0 24 24'>...</svg>"

2. Client Database Override Pattern

In your client database, add an optional custom_icon_svg column. In your frontend, resolve the icon with a fallback operator:

const categoryIcon = clientCategory.custom_icon_svg || pixahuntCategory.icon_svg_url;

• Default: Uses Pixahunt CDN SVG automatically.
• Customized: Uses client's own SVG if provided.

Production SDK Boilerplates

Full Application Implementation Code

Production-ready templates for your target platform. Copy, paste, and run.

1. Environment Setup (.env.local)

Kept server-side (never exposed to client browser)
# .env.local
PIXAHUNT_API_URL="https://pixahunt.com/api/v1/gadgets"
PIXAHUNT_API_KEY="pk_gadget_your_api_key_here"
PIXAHUNT_CLIENT_DOMAIN="yourstore.com"

2. Next.js Server Route Handler (app/api/gadget/[model]/route.ts)

Proxies requests through your Next.js server to prevent key leaks and enforce your registered domain.

import { NextResponse } from 'next/server';

export async function GET(
  request: Request,
  { params }: { params: { model: string } }
) {
  try {
    const res = await fetch(
      `${process.env.PIXAHUNT_API_URL}/product?model=${encodeURIComponent(params.model)}`,
      {
        headers: {
          'X-API-KEY': process.env.PIXAHUNT_API_KEY!,
          'X-CLIENT-DOMAIN': process.env.PIXAHUNT_CLIENT_DOMAIN!,
        },
        next: { revalidate: 86400 }, // Cache on Next.js edge for 24 hours
      }
    );

    const payload = await res.json();
    if (payload.status !== 'success') {
      return NextResponse.json({ error: payload.message }, { status: 404 });
    }

    return NextResponse.json(payload.data);
  } catch (error: any) {
    return NextResponse.json({ error: error.message }, { status: 500 });
  }
}

3. Hybrid SSR Product Page with Category SVG (app/products/[slug]/page.tsx)

Merges your local database price & inventory with Pixahunt's master specs and default vector category SVG.

import Image from 'next/image';
import { notFound } from 'next/navigation';

export default async function ProductDetailPage({ params }: { params: { slug: string } }) {
  // 1. Fetch your local store data (Price, Stock) from Prisma / MySQL / Drizzle
  const localProduct = {
    model_name: 'Corsair Vengeance RGB DDR5',
    client_price: 129.99,
    stock_count: 18,
    custom_badge: 'Flash Sale'
  };

  // 2. Fetch master technical specs from Pixahunt Gateway (Server-to-Server)
  const res = await fetch(
    `${process.env.PIXAHUNT_API_URL}/product?model=${encodeURIComponent(localProduct.model_name)}`,
    {
      headers: {
        'X-API-KEY': process.env.PIXAHUNT_API_KEY!,
        'X-CLIENT-DOMAIN': process.env.PIXAHUNT_CLIENT_DOMAIN!,
      },
      next: { revalidate: 86400 } // 24h ISR Cache
    }
  );

  const json = await res.json();
  if (json.status !== 'success') return notFound();
  const gadget = json.data;

  return (
    <div className="max-w-6xl mx-auto px-4 py-12 text-white">
      {/* Category with Official Vector SVG */}
      <div className="flex items-center gap-2 text-sm text-blue-400 mb-4">
        {gadget.category?.icon_svg_url && (
          <img src={gadget.category.icon_svg_url} alt="" className="w-5 h-5 object-contain" />
        )}
        <span>{gadget.category?.name}</span>
        <span className="text-gray-600">/</span>
        <span className="text-gray-400">{gadget.brand?.name}</span>
      </div>

      <div className="grid grid-cols-1 lg:grid-cols-2 gap-10">
        {/* Gallery / Thumbnail */}
        <div className="bg-gray-900/60 p-6 rounded-3xl border border-gray-800">
          <img src={gadget.thumbnail_url} alt={gadget.model_name} className="w-full h-80 object-contain mx-auto" />
        </div>

        {/* Pricing & Actions */}
        <div className="space-y-6">
          <h1 className="text-3xl font-extrabold text-white">{gadget.official_title}</h1>

          <div className="flex items-baseline gap-4">
            <span className="text-4xl font-black text-orange-500">${localProduct.client_price}</span>
            <span className="text-xs px-2.5 py-1 rounded-full bg-emerald-500/20 text-emerald-400 font-semibold">
              {localProduct.stock_count > 0 ? `In Stock (${localProduct.stock_count})` : 'Out of Stock'}
            </span>
          </div>

          {/* Key Highlights */}
          <div className="p-5 rounded-2xl bg-white/5 border border-white/10 space-y-2">
            <h3 className="text-xs font-bold uppercase tracking-wider text-orange-400">Key Features</h3>
            <ul className="space-y-1.5 text-sm text-gray-300">
              {gadget.highlights?.map((h: string, i: number) => (
                <li key={i} className="flex items-center gap-2">
                  <span className="text-emerald-400 font-bold">&#10003;</span> {h}
                </li>
              ))}
            </ul>
          </div>

          <button className="w-full py-4 rounded-2xl bg-orange-500 hover:bg-orange-600 text-white font-bold text-base transition shadow-xl shadow-orange-500/25">
            Add to Shopping Cart
          </button>
        </div>
      </div>

      {/* Specifications Matrix */}
      <div className="mt-16 space-y-8">
        <h2 className="text-2xl font-bold text-white border-b border-gray-800 pb-4">Full Technical Specifications</h2>
        {Object.entries(gadget.specs || {}).map(([section, items]: [string, any]) => (
          <div key={section} className="bg-gray-900/40 border border-gray-800 rounded-2xl overflow-hidden">
            <div className="bg-blue-950/30 px-5 py-3 text-xs font-bold uppercase tracking-wider text-blue-400 border-b border-gray-800">
              {section}
            </div>
            <table className="w-full text-sm">
              <tbody className="divide-y divide-gray-800">
                {Object.entries(items).map(([specKey, specVal]: [string, any]) => (
                  <tr key={specKey} className="hover:bg-white/5">
                    <td className="px-5 py-3 text-gray-400 w-1/3">{specKey}</td>
                    <td className="px-5 py-3 text-white font-medium">{String(specVal)}</td>
                  </tr>
                ))}
              </tbody>
            </table>
          </div>
        ))}
      </div>
    </div>
  );
}

1. Flutter API Service (lib/services/gadget_api_service.dart)

Requires http and flutter_svg packages
import 'dart:convert';
import 'package:http/http.dart' as http;

class GadgetApiService {
  static const String baseUrl = 'https://pixahunt.com/api/v1/gadgets';
  static const String apiKey = 'pk_gadget_your_client_key_here';
  static const String clientDomain = 'your-mobile-app.com';

  static Map<String, String> get _headers => {
    'X-API-KEY': apiKey,
    'X-CLIENT-DOMAIN': clientDomain,
    'Accept': 'application/json',
  };

  /// Fetch unified product specifications
  static Future<Map<String, dynamic>?> getProduct(String modelName) async {
    final uri = Uri.parse('$baseUrl/product?model=${Uri.encodeComponent(modelName)}');
    final response = await http.get(uri, headers: _headers);

    if (response.statusCode == 200) {
      final json = jsonDecode(response.body);
      return json['data'];
    }
    return null;
  }

  /// Fetch all categories with vector SVG URLs
  static Future<List<dynamic>> getCategories() async {
    final uri = Uri.parse('$baseUrl/categories');
    final response = await http.get(uri, headers: _headers);

    if (response.statusCode == 200) {
      final json = jsonDecode(response.body);
      return json['data'] ?? [];
    }
    return [];
  }
}

2. Flutter Category Widget with Official Vector SVG (lib/widgets/category_icon.dart)

Renders the official vector SVG using flutter_svg with fallback to local assets if overridden.

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class GadgetCategoryChip extends StatelessWidget {
  final String categoryName;
  final String? iconSvgUrl;
  final String? localOverrideSvg;

  const GadgetCategoryChip({
    Key? key,
    required this.categoryName,
    this.iconSvgUrl,
    this.localOverrideSvg,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // 1. If client store overrides the SVG locally, use it
    if (localOverrideSvg != null && localOverrideSvg!.isNotEmpty) {
      return Chip(
        avatar: SvgPicture.asset(localOverrideSvg!, width: 18, height: 18),
        label: Text(categoryName),
      );
    }

    // 2. Otherwise default to Pixahunt Bunny CDN Vector SVG
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
      decoration: BoxDecoration(
        color: const Color(0xFF151A7B).withOpacity(0.2),
        borderRadius: BorderRadius.circular(12),
        border: Border.all(color: const Color(0xFF223BC9).withOpacity(0.3)),
      ),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          if (iconSvgUrl != null)
            SvgPicture.network(
              iconSvgUrl!,
              width: 18,
              height: 18,
              placeholderBuilder: (_) => const SizedBox(width: 18, height: 18),
            ),
          const SizedBox(width: 8),
          Text(
            categoryName,
            style: const TextStyle(color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold),
          ),
        ],
      ),
    );
  }
}

React Native / Expo Custom Hook (useGadget.ts)

Leverages react-native-svg to render sharp category icons on mobile screens.

import { useState, useEffect } from 'react';

const API_BASE = 'https://pixahunt.com/api/v1/gadgets';
const API_KEY = 'pk_gadget_your_key_here';
const CLIENT_DOMAIN = 'yourapp.com';

export function useGadgetProduct(modelName: string) {
  const [data, setData] = useState<any>(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState<string | null>(null);

  useEffect(() => {
    let isMounted = true;
    setLoading(true);

    fetch(`${API_BASE}/product?model=${encodeURIComponent(modelName)}`, {
      headers: {
        'X-API-KEY': API_KEY,
        'X-CLIENT-DOMAIN': CLIENT_DOMAIN,
      },
    })
      .then((res) => res.json())
      .then((json) => {
        if (isMounted) {
          if (json.status === 'success') setData(json.data);
          else setError(json.message);
          setLoading(false);
        }
      })
      .catch((err) => {
        if (isMounted) {
          setError(err.message);
          setLoading(false);
        }
      });

    return () => { isMounted = false; };
  }, [modelName]);

  return { data, loading, error };
}

Python / FastAPI Integration Script

import requests

PIXAHUNT_API_URL = "https://pixahunt.com/api/v1/gadgets"
API_KEY = "pk_gadget_your_api_key_here"
CLIENT_DOMAIN = "yourserver.com"

headers = {
    "X-API-KEY": API_KEY,
    "X-CLIENT-DOMAIN": CLIENT_DOMAIN,
}

def get_gadget_specs(model: str):
    response = requests.get(
        f"{PIXAHUNT_API_URL}/product",
        params={"model": model},
        headers=headers,
        timeout=5.0
    )
    if response.status_code == 200:
        return response.json().get("data")
    return None

# Example invocation
if __name__ == "__main__":
    specs = get_gadget_specs("Corsair Vengeance RGB DDR5")
    print(f"Product: {specs['official_title']}")
    print(f"Category SVG: {specs['category']['icon_svg_url']}")

cURL Direct Terminal Execution

Single Product by Model Name (Specs, Benchmarks & Pricing):
curl -X GET "https://pixahunt.com/api/v1/gadgets/product?model=i3-550" \
  -H "X-API-KEY: pk_gadget_demo_test_key_pixahunt_saas_2026" \
  -H "X-CLIENT-DOMAIN: localhost"
Product Images & High-Speed CDN Media (1080p & 300p WebP):
curl -X GET "https://pixahunt.com/api/v1/gadgets/product/images?model=i3-550" \
  -H "X-API-KEY: pk_gadget_demo_test_key_pixahunt_saas_2026" \
  -H "X-CLIENT-DOMAIN: localhost"
Products Catalog Directory (Paginated with Category/Brand filters):
curl -X GET "https://pixahunt.com/api/v1/gadgets/products?limit=10" \
  -H "X-API-KEY: pk_gadget_demo_test_key_pixahunt_saas_2026" \
  -H "X-CLIENT-DOMAIN: localhost"
Categories Tree & Bunny CDN Vector SVGs:
curl -X GET "https://pixahunt.com/api/v1/gadgets/categories" \
  -H "X-API-KEY: pk_gadget_demo_test_key_pixahunt_saas_2026" \
  -H "X-CLIENT-DOMAIN: localhost"
Autocomplete Live Search:
curl -X GET "https://pixahunt.com/api/v1/gadgets/search?q=Intel&limit=10" \
  -H "X-API-KEY: pk_gadget_demo_test_key_pixahunt_saas_2026" \
  -H "X-CLIENT-DOMAIN: localhost"

REST API Endpoints Specification

High-performance HTTP endpoints with zero-loop queries, multi-currency pricing, and dual-tier Bunny CDN media.

GET /api/v1/gadgets/product?model={model_name}
Single Unified Query

Primary single-fetch endpoint returning complete hardware specifications, Cinebench & Geekbench scores, 3-currency reference pricing (bdt, inr, usd), highlights, brand, category with Bunny CDN SVG, and variants. Also supports ?slug={slug} or ?id={id}. Clean alias: /api/v1/products/item.

Required Headers: X-API-KEY: <key>, X-CLIENT-DOMAIN: <domain>
GET /api/v1/gadgets/product/images?model={model_name}
Media CDN (1080p & 300p)

Dedicated high-speed endpoint delivering dual-tier product graphics hosted on Bunny CDN. Returns master 1080x1080 WebP (thumbnail_url) for zoom & detail views, ultra-fast 300x300 WebP (thumbnail_small_url) for mobile & catalog grids, and full multi-angle gallery_images array. Clean alias: /api/v1/products/images.

Query Parameters: model={model} (e.g. i3-550), slug={slug}, or id={id}
GET /api/v1/gadgets/products?category={slug}&brand={slug}&limit=20
Paginated Catalog

Paginated products directory with filter capabilities by category slug, brand slug, or keyword search. Returns product summary cards with 300x300 fast thumbnail, pricing preview, and core highlights. Clean alias: /api/v1/products.

Pagination: total, per_page, current_page, last_page
GET /api/v1/gadgets/categories
Vector SVGs Included

Returns complete hierarchical categories (PC Components, Monitors, Power, Laptops) with active product counts, icon_svg_url (Bunny CDN), and icon_svg_raw.

GET /api/v1/gadgets/search?q={query}&category={slug}&limit=15
Loop-Free Eager Count

Ultra-fast search for autocomplete dropdowns in client web & mobile apps. Uses eager loaded variant counts to ensure zero N+1 database queries.

GET /api/v1/brands/info?brand={slug}
Brand Profile

Returns official manufacturer identities, founding year, founders, headquarters location, website, and CDN logos. Related endpoints: /api/v1/brands/branches (Service hubs) and /api/v1/brands/ceos (Executive leadership).

Client Store DB Recommendation

Client Database Schema (Zero Duplicate Specs)

Keep your client database lean. You only need to store transactional e-commerce columns.

Table: client_products

CREATE TABLE client_products (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  model_name VARCHAR(255) NOT NULL, -- Matched with Pixahunt API
  custom_title VARCHAR(255) NULL,   -- Client specific marketing title
  price DECIMAL(10, 2) NOT NULL,    -- Client store selling price
  stock INT NOT NULL DEFAULT 0,     -- Client warehouse inventory
  status ENUM('active', 'inactive') DEFAULT 'active',
  created_at TIMESTAMP NULL,
  updated_at TIMESTAMP NULL
);

Table: client_categories (Optional SVG Override)

CREATE TABLE client_categories (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  pixahunt_slug VARCHAR(255) NOT NULL, -- e.g. 'ram', 'processor'
  custom_name VARCHAR(255) NULL,
  custom_icon_svg_url VARCHAR(500) NULL, -- Optional override
  created_at TIMESTAMP NULL
);
-- If custom_icon_svg_url is NULL,
-- app falls back to Pixahunt Bunny CDN SVG automatically!

Live Interactive API Sandbox

Test real-time JSON responses across Product Specs, High-Speed CDN Images, and Brands.

Presets: