@vindecodervehicle/browser
v1.0.0
Published
Official browser JavaScript SDK for the VIN Decoder Vehicle API
Downloads
110
Maintainers
Readme
VIN Decoder Vehicle — JavaScript SDK (Browser)
Official browser JavaScript SDK for the VIN Decoder Vehicle API.
Works in modern browsers, React, Vue, Angular, and any bundler that supports ES modules.
Features
- Zero dependencies
- Pure ES modules
- Native
fetch - All API endpoints supported
- Works with Vite, Webpack, Parcel, etc.
Installation
npm install @vindecodervehicle/browserOr import directly in the browser (if CORS is enabled):
<script type="module">
import { VinDecoderClient } from 'https://esm.sh/@vindecodervehicle/browser';
</script>Note: Browser requests may require CORS support on the API or a backend proxy to protect your API key.
Quick Start
import { VinDecoderClient, getVehicleFullName } from '@vindecodervehicle/browser';
const client = VinDecoderClient.create('YOUR_USER', 'YOUR_API_KEY');
const vehicle = await client.decodeVin('WF0GXXGAJ69C71882');
console.log(getVehicleFullName(vehicle)); // BMW 3 Coupe (E92) 316 iAPI Reference
VIN
const vehicle = await client.decodeVin('WF0GXXGAJ69C71882');
const vehicles = await client.decodeVinAll('WF0GXXGAJ69C71882');
const engines = await client.getEngines('WF0GXXGAJ69C71882');Vehicle by carId
const vehicle = await client.getVehicle(55565);
const fluids = await client.getFluidCapacities(55565);
const parts = await client.getOemParts(55565);
const repairs = await client.getRepairTimes(55565);Catalog
const brands = await client.listBrands();
const models = await client.listModels('bmw');
const variants = await client.listVariants('bmw', '3-series');Recommended: use a backend proxy
For production browser apps, proxy API calls through your server to keep credentials secret:
// Frontend calls your backend
const response = await fetch('/api/decode-vin?vin=WF0GXXGAJ69C71882');
const vehicle = await response.json();Links
License
MIT
