@meterapp/vehicle-db 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -14
- package/dist/data.d.ts +14 -0
- package/dist/data.js +1 -1
- package/dist/index.d.ts +66 -0
- package/dist/index.js +121 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# @meterapp/vehicle-db
|
|
2
2
|
|
|
3
|
-
An offline, international vehicle make/model catalog for Node.js and TypeScript. The package combines U.S. model-year data, the UK registered fleet, Asian-origin vehicles registered in New Zealand, Malaysian registration transactions, and an Indian manufacturer catalog into one small, zero-dependency API. It never makes runtime network requests.
|
|
3
|
+
An offline, international vehicle make/model catalog for Node.js and TypeScript. The package combines U.S. model-year data, the UK registered fleet, the European Union's new car and van registration register, the daily-updated Dutch vehicle register, Asian-origin vehicles registered in New Zealand, Malaysian registration transactions, and an Indian manufacturer catalog into one small, zero-dependency API. It never makes runtime network requests.
|
|
4
4
|
|
|
5
|
-
The current snapshot spans **1990–
|
|
5
|
+
The current snapshot spans **1990–2027** and includes **1,580 makes**, **36,870 model names**, and **207,953 deduplicated model-year entries** from **7 data sources**.
|
|
6
6
|
|
|
7
|
-
The catalog covers seven vehicle types: **Motorcycle**, **Passenger Car**, **Truck**, **Bus**, **Multipurpose Passenger Vehicle (MPV)**, **Auto Rickshaw**, and **Other Vehicle**. The Asia-Pacific sources add Japanese domestic and kei models, Chinese EVs, Indian and Korean vehicles, Southeast Asian makes such as Perodua and Proton, and additional motorcycles and commercial vehicles.
|
|
7
|
+
The catalog covers seven vehicle types: **Motorcycle**, **Passenger Car**, **Truck**, **Bus**, **Multipurpose Passenger Vehicle (MPV)**, **Auto Rickshaw**, and **Other Vehicle**. The European source adds continental models from Dacia, Cupra, DS, Lynk & Co, Alpine, and the Chinese brands entering Europe such as BYD, MG, Omoda, Xpeng, and Nio, as sold in the EU rather than the UK or U.S. The Dutch register keeps that coverage current: vehicles first registered this year appear within days, so 2026 models such as the BYD Atto 2 and Renault 5 E-Tech are already listed. The Asia-Pacific sources add Japanese domestic and kei models, Chinese EVs, Indian and Korean vehicles, Southeast Asian makes such as Perodua and Proton, and additional motorcycles and commercial vehicles.
|
|
8
8
|
|
|
9
9
|
## Demo and playground
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This catalog is the backbone of the [Car Image API](https://car-imgs.vercel.app) — an AI-native API that renders studio-quality, transparent-background images of every vehicle listed here (six camera angles, 15 colors, PNG/WebP/JPG, $1 per 1,000 images). Explore the data in the [interactive playground](https://car-imgs.vercel.app/playground) or browse vehicles at [car-imgs.vercel.app/cars](https://car-imgs.vercel.app/cars).
|
|
12
|
+
|
|
13
|
+
**Missing a vehicle?** Add it here and it becomes renderable in the API on the next release — see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
12
14
|
|
|
13
15
|
## Install
|
|
14
16
|
|
|
@@ -27,6 +29,10 @@ import {
|
|
|
27
29
|
getMakes,
|
|
28
30
|
getModels,
|
|
29
31
|
getAvailableYears,
|
|
32
|
+
getAvailableYearRanges,
|
|
33
|
+
getModelAppearanceRanges,
|
|
34
|
+
getModelRenderGroups,
|
|
35
|
+
getRepresentativeYear,
|
|
30
36
|
} from "@meterapp/vehicle-db";
|
|
31
37
|
|
|
32
38
|
// Inspect provenance and coverage before querying.
|
|
@@ -78,6 +84,25 @@ const malaysiaMakes = getMakes({
|
|
|
78
84
|
sourceId: "malaysia-jpj-registrations",
|
|
79
85
|
});
|
|
80
86
|
|
|
87
|
+
// Models registered as new in the EU, Iceland, and Norway, e.g. BYD Seal U.
|
|
88
|
+
const euMakes = getMakes({ year: 2024, sourceId: "eea-co2-monitoring" });
|
|
89
|
+
const bydEu = euMakes.find((make) => make.makeName === "BYD");
|
|
90
|
+
const bydEuModels = getModels({
|
|
91
|
+
makeId: bydEu!.makeId,
|
|
92
|
+
year: 2024,
|
|
93
|
+
sourceId: "eea-co2-monitoring",
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Current-year European registrations from the Dutch register, e.g. BYD Atto 2.
|
|
97
|
+
const bydNl = getMakes({ year: 2026, sourceId: "rdw-nl-vehicle-register" }).find(
|
|
98
|
+
(make) => make.makeName === "BYD",
|
|
99
|
+
);
|
|
100
|
+
const bydNlModels = getModels({
|
|
101
|
+
makeId: bydNl!.makeId,
|
|
102
|
+
year: 2026,
|
|
103
|
+
sourceId: "rdw-nl-vehicle-register",
|
|
104
|
+
});
|
|
105
|
+
|
|
81
106
|
// Existing queries remain valid.
|
|
82
107
|
const toyota = getMakes({ year: 2024 }).find((make) => make.makeName === "TOYOTA");
|
|
83
108
|
const toyotaModels = getModels({ makeId: toyota!.makeId, year: 2024 });
|
|
@@ -86,6 +111,55 @@ const years = getAvailableYears({
|
|
|
86
111
|
vehicleTypeId: 2,
|
|
87
112
|
sourceId: "nhtsa-vpic",
|
|
88
113
|
});
|
|
114
|
+
|
|
115
|
+
// Availability and exterior equivalence are intentionally separate.
|
|
116
|
+
const availability = getAvailableYearRanges({ makeId: toyota!.makeId });
|
|
117
|
+
const arteonAppearances = getModelAppearanceRanges({
|
|
118
|
+
makeId: getMakes().find((make) => make.makeName === "VOLKSWAGEN")!.makeId,
|
|
119
|
+
modelName: "Arteon",
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Safe cache identity: verified ranges share a representative year; unknown
|
|
123
|
+
// and overlapping transition years return the requested year unchanged.
|
|
124
|
+
const renderYear = getRepresentativeYear({
|
|
125
|
+
makeId: arteonAppearances[0].makeId,
|
|
126
|
+
modelName: "Arteon",
|
|
127
|
+
year: 2018,
|
|
128
|
+
}); // 2019
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Appearance ranges and image reuse
|
|
132
|
+
|
|
133
|
+
A model being available in consecutive years does **not** prove that its exterior stayed the
|
|
134
|
+
same. `getAvailableYearRanges()` only compresses catalog availability for display. Sourced
|
|
135
|
+
generation/facelift facts live in `data/appearance-ranges.json` and are returned by
|
|
136
|
+
`getModelAppearanceRanges()` with their body style, market, and evidence URL.
|
|
137
|
+
|
|
138
|
+
`getModelRenderGroups()` turns those facts into a complete cache plan. It groups a year only when
|
|
139
|
+
exactly one verified appearance range covers it. Years with no evidence, and transition years
|
|
140
|
+
covered by two overlapping ranges, remain singleton exact-year groups. `getRepresentativeYear()`
|
|
141
|
+
is the convenience lookup for storage/cache keys and has the same fail-closed behavior.
|
|
142
|
+
|
|
143
|
+
This split is deliberate. NHTSA vPIC provides model-year and body-class data but no global
|
|
144
|
+
generation identifier; Wikidata is CC0 but generation and facelift coverage is sparse. Broad
|
|
145
|
+
third-party generation dumps commonly carry restrictive or share-alike terms and overlapping
|
|
146
|
+
records, so they are useful for research but are not imported automatically. Verified ranges are
|
|
147
|
+
small, reviewable facts linked to first-party or equivalently authoritative public evidence.
|
|
148
|
+
|
|
149
|
+
NHTSA wheelbase, dimensions, doors, series, and truck cab/bed fields can rank possible body-family
|
|
150
|
+
matches. They are candidate evidence only: related platforms and trims can still have visibly
|
|
151
|
+
different bodywork. `appearanceId` is intentionally stricter than a derived `body_family_id` and
|
|
152
|
+
is the only grouping allowed to drive render reuse. See CONTRIBUTING for the review criteria.
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
const volkswagen = getMakes().find((make) => make.makeName === "VOLKSWAGEN")!;
|
|
156
|
+
|
|
157
|
+
getModelAppearanceRanges({ makeId: volkswagen.makeId, modelName: "Arteon" });
|
|
158
|
+
// Original Arteon: 2017–2020, Fastback, with Volkswagen evidence
|
|
159
|
+
// Updated Arteon: 2020–2026, Fastback, with Volkswagen evidence
|
|
160
|
+
|
|
161
|
+
getModelRenderGroups({ makeId: volkswagen.makeId, modelName: "Arteon" });
|
|
162
|
+
// 2017–2019 share one render; overlapping 2020 stays exact; 2021–2026 share one render.
|
|
89
163
|
```
|
|
90
164
|
|
|
91
165
|
## Driver search and autocomplete
|
|
@@ -212,6 +286,17 @@ getAvailableYears({ makeId: 448, vehicleTypeId: 2, sourceId: "nhtsa-vpic" });
|
|
|
212
286
|
getAvailableYears({ modelId: 2469, sourceId: "nhtsa-vpic" });
|
|
213
287
|
```
|
|
214
288
|
|
|
289
|
+
### Appearance and year-range APIs
|
|
290
|
+
|
|
291
|
+
- `getAvailableYearRanges(options?): VehicleYearRange[]` compresses consecutive availability
|
|
292
|
+
years; it makes no exterior-equivalence claim.
|
|
293
|
+
- `getModelAppearanceRanges({ makeId, modelName, year? }): VehicleAppearanceRange[]` returns
|
|
294
|
+
verified generation/facelift periods and evidence. Overlap is preserved.
|
|
295
|
+
- `getModelRenderGroups({ makeId, modelName, vehicleTypeId?, sourceId? }): VehicleRenderGroup[]`
|
|
296
|
+
returns safe, non-overlapping cache groups for every available year.
|
|
297
|
+
- `getRepresentativeYear({ makeId, modelName, year, ... }): number` returns the canonical cache
|
|
298
|
+
year for an unambiguous verified group, otherwise the requested year.
|
|
299
|
+
|
|
215
300
|
### `searchVehicles(query, options?): VehicleSearchResult[]`
|
|
216
301
|
|
|
217
302
|
Import from `@meterapp/vehicle-db/search`. Returns deterministic make and grouped model candidates for free-form input. Options include `year`, `vehicleTypeId`, `sourceId`, `limit` (default 10, maximum 100), and `fuzzy` (default `true`).
|
|
@@ -222,18 +307,24 @@ Model results contain `years` and a year-specific `variants` array. Make results
|
|
|
222
307
|
|
|
223
308
|
| Source | Coverage in this snapshot | Terms |
|
|
224
309
|
|---|---|---|
|
|
225
|
-
| [NHTSA vPIC](https://vpic.nhtsa.dot.gov/api/) | U.S. passenger cars, trucks, and MPVs; model years 1990–
|
|
310
|
+
| [NHTSA vPIC](https://vpic.nhtsa.dot.gov/api/) | U.S. passenger cars, trucks, and MPVs; model years 1990–2027 | U.S. government public data |
|
|
226
311
|
| [UK DfT/DVLA vehicle licensing statistics](https://www.gov.uk/government/statistical-data-sets/vehicle-licensing-statistics-data-files) | 701 normalized makes across cars, motorcycles, goods vehicles, buses and coaches, and other vehicles; manufacture years 1990–2025 | [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) |
|
|
227
312
|
| [Atul Auto product catalog](https://atulauto.co.in/products/) | Current Indian passenger and cargo auto-rickshaw range; catalog years 2024–2026 | Source attribution; factual product names only |
|
|
228
313
|
| [NZTA Motor Vehicle Register](https://www.nzta.govt.nz/resources/new-zealand-motor-vehicle-register-statistics/new-zealand-vehicle-fleet-open-data-sets) | 30,374 Asian-origin car, truck, bus, motorcycle, and moped model-year records from 12 countries of origin; vehicle years 1990–2026 | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) |
|
|
229
314
|
| [Malaysia JPJ registration transactions](https://data.gov.my/data-catalogue/registration_transactions_car) | 1,756 passenger car, MPV, jeep, pickup, and window-van model/registration-year records; 2024–2026 | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) |
|
|
315
|
+
| [EEA CO2 monitoring of new passenger cars and vans](https://www.eea.europa.eu/en/datahub/datahubitem-view/fa8b1229-3db6-495d-b18e-9c9b3267c02b) | 29,939 passenger car (M1) and van (N1) model/registration-year records from 235 makes reported by EU member states, Iceland, and Norway; 2010–2025 | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) |
|
|
316
|
+
| [Netherlands RDW vehicle register](https://opendata.rdw.nl/Voertuigen/Open-Data-RDW-Gekentekende_voertuigen/m9d7-ebf2) | 73,190 passenger car, commercial vehicle, bus, and motorcycle model/first-admission-year records from 624 makes licensed in the Netherlands; 1990–2026 | [Public domain (RDW Open Data)](https://opendata.rdw.nl/) |
|
|
230
317
|
|
|
231
|
-
Year means the source’s model year for NHTSA, year of manufacture for DfT/DVLA (falling back to year of first use when manufacture year is unavailable), catalog year for Atul Auto, vehicle year for NZTA, and registration year for
|
|
318
|
+
Year means the source’s model year for NHTSA, year of manufacture for DfT/DVLA (falling back to year of first use when manufacture year is unavailable), catalog year for Atul Auto, vehicle year for NZTA, registration year for Malaysia JPJ, the reporting (registration) year for the EEA register, and the year of first admission (first registration anywhere, so imported used vehicles keep their original year) for the Dutch RDW register. From 2007 onward, NZTA vehicle year means the year of first registration in New Zealand or overseas. Registration sources are evidence that a make/model was present in that market and do not guarantee a factory model-year designation. Source filters let applications choose the semantics appropriate for their workflow.
|
|
232
319
|
|
|
233
320
|
UK source attribution: Contains public sector information licensed under the Open Government Licence v3.0. Source: Department for Transport and Driver and Vehicle Licensing Agency.
|
|
234
321
|
|
|
235
322
|
NZTA and Malaysia source attribution: Licensed under Creative Commons Attribution 4.0 International. Sources: New Zealand Transport Agency Waka Kotahi and Malaysia Road Transport Department/data.gov.my.
|
|
236
323
|
|
|
324
|
+
EEA source attribution: Licensed under Creative Commons Attribution 4.0 International. Source: European Environment Agency, *Monitoring of CO2 emissions from passenger cars* and *Monitoring of CO2 emissions from vans*, Regulation (EU) 2019/631. Member states report the make and commercial name inconsistently (multi-brand strings, legal entities, and trim-level names), so the importer merges brand spellings, drops engine and gearbox suffixes, keeps a make/model/year only when at least two countries report it or one country reports it more than 1,000 times, and uses the most reported spelling of each model name. The latest year is provisional data. EU vehicle categories map to the catalog as M1/M1G → Passenger Car and N1/N1G/N2 → Truck.
|
|
325
|
+
|
|
326
|
+
RDW source attribution: Open Data RDW (Dienst Wegverkeer), public domain. The register only contains vehicles currently licensed in the Netherlands, is republished daily, and is the freshest European source in the catalog. The same brand and model-name normalization as the EEA source is applied, plus a minimum of three vehicles per make/model/year to drop typos; RDW vehicle kinds map as Personenauto → Passenger Car, Bedrijfsauto → Truck, Bus → Bus, and Motorfiets → Motorcycle.
|
|
327
|
+
|
|
237
328
|
## Factory colors
|
|
238
329
|
|
|
239
330
|
Factory paint availability is not included. The NZTA and Malaysia records contain the observed basic color of each registered vehicle, not the manufacturer’s stock colors for a make/model/year. Treating those fields as factory availability would produce false positives from repaints, imports, and broad color categories, so the importers intentionally omit them. A future color API should require manufacturer-backed paint options with explicit market and model-year provenance.
|
|
@@ -242,13 +333,13 @@ Factory paint availability is not included. The NZTA and Malaysia records contai
|
|
|
242
333
|
|
|
243
334
|
| | |
|
|
244
335
|
|---|---:|
|
|
245
|
-
| Years | 1990–
|
|
246
|
-
| Sources |
|
|
336
|
+
| Years | 1990–2027 |
|
|
337
|
+
| Sources | 7 |
|
|
247
338
|
| Vehicle types | 7 |
|
|
248
|
-
| Makes | 1,
|
|
249
|
-
| Model names |
|
|
250
|
-
| Deduplicated model-year entries |
|
|
251
|
-
| Bundled TypeScript data |
|
|
339
|
+
| Makes | 1,580 |
|
|
340
|
+
| Model names | 36,870 |
|
|
341
|
+
| Deduplicated model-year entries | 207,953 |
|
|
342
|
+
| Bundled TypeScript data | 7.17 MB |
|
|
252
343
|
|
|
253
344
|
## Refreshing and rebuilding
|
|
254
345
|
|
|
@@ -265,13 +356,15 @@ Refresh either network source independently, then rebuild the combined catalog:
|
|
|
265
356
|
|
|
266
357
|
```bash
|
|
267
358
|
npm run refresh:uk-dft
|
|
268
|
-
npm run refresh:nhtsa -- --start-year 1990 --end-year
|
|
359
|
+
npm run refresh:nhtsa -- --start-year 1990 --end-year 2027
|
|
269
360
|
npm run refresh:nzta-asia-pacific -- --start-year 1990 --end-year 2026
|
|
270
361
|
npm run refresh:malaysia-jpj -- --start-year 2024 --end-year 2026
|
|
362
|
+
npm run refresh:eea-co2 -- --start-year 2010 --end-year 2026
|
|
363
|
+
npm run refresh:rdw-nl -- --start-year 1990 --end-year 2026
|
|
271
364
|
npm run build:data
|
|
272
365
|
```
|
|
273
366
|
|
|
274
|
-
The NHTSA API rate-limits aggressively, so a full NHTSA refresh can take
|
|
367
|
+
The NHTSA API rate-limits aggressively, so a full NHTSA refresh can take hours; to add a new model year, fetch only that year and merge it into the existing snapshot with `npm run refresh:nhtsa -- --start-year 2027 --end-year 2027 --merge`. The UK importer downloads the two official VEH0124 CSV files. The NZTA importer discovers the current official ArcGIS service and requests distinct records for supported vehicle types and Asian countries of origin. The Malaysia importer downloads annual JPJ CSVs and aggregates individual transactions into unique model/registration-year records. The EEA importer discovers the current final and provisional register tables from the EEA DiscoData catalogue and asks its public SQL endpoint for make/commercial-name counts grouped by reporting country and year, so it never downloads the individual registration records; `--min-countries` and `--min-count` tune the noise filter. The RDW importer asks the Socrata API for make/commercial-name counts per year of first admission, one request per year, so a refresh takes about ten minutes and can be run any day to pick up the latest registrations. Importers assign deterministic numeric IDs, write normalized snapshots, and discard temporary raw downloads.
|
|
275
368
|
|
|
276
369
|
## License
|
|
277
370
|
|
package/dist/data.d.ts
CHANGED
|
@@ -24,6 +24,20 @@ interface CompactData {
|
|
|
24
24
|
}[];
|
|
25
25
|
modelNames: string[];
|
|
26
26
|
models: [number, number, number, number, number, number][];
|
|
27
|
+
appearanceRanges: {
|
|
28
|
+
id: string;
|
|
29
|
+
make_id: number;
|
|
30
|
+
make_name: string;
|
|
31
|
+
model_name: string;
|
|
32
|
+
label: string;
|
|
33
|
+
body_style: string;
|
|
34
|
+
year_from: number;
|
|
35
|
+
year_to: number;
|
|
36
|
+
representative_year: number;
|
|
37
|
+
regions: string[];
|
|
38
|
+
source_name: string;
|
|
39
|
+
source_url: string;
|
|
40
|
+
}[];
|
|
27
41
|
}
|
|
28
42
|
declare const data: CompactData;
|
|
29
43
|
export default data;
|