Containerized NHTSA vPIC database with a blazing-fast FastAPI wrapper for VIN decoding.
924
A blazing-fast, self-hosted API to validate and decode Vehicle Identification Numbers (VINs) using the official NHTSA vPIC database.
UNNEST queries and native scalar functions.db-init container automatically scrapes NHTSA for the latest database dumps and gracefully restores them on startup.The application is fully containerized and orchestrates its own data lifecycle automatically:
graph TD
A[Docker Compose Up] --> B[(PostgreSQL DB)]
B -->|Healthcheck Pass| C[DB-Init Container]
C -->|1. Scrape NHTSA<br>2. Download Dump<br>3. pg_restore| B
C -->|Graceful Exit| D[FastAPI Service]
D -->|Port 8000| E((Web UI & API))
The easiest way to run the service locally from source is using Docker Compose. This automatically spins up the database, initializes the NHTSA schema, builds the API from your local code, and launches it.
Copy the example environment file (defaults are fine for local testing).
cp .env.example .env
Bring up the entire stack in detached mode:
docker compose up -d
Note: The
db-initstep downloads and restores a large PostgreSQL dump. It may take a few minutes for the API to become available on the very first run.
If you want to deploy the API to a server without downloading the source code, you can use the production compose file which pulls the pre-built images directly from Docker Hub.
1. Download the production files to your server:
curl -O https://raw.githubusercontent.com/tiborrr/vpic-api-service/main/docker-compose.prod.yml
curl -o .env https://raw.githubusercontent.com/tiborrr/vpic-api-service/main/.env.example
2. Start the production stack:
docker compose -f docker-compose.prod.yml up -d
(This is ideal for VPS deployments or production environments).
| Endpoint | Method | Description |
|---|---|---|
/api/v1/vin/{vin}/simple | GET | Extremely fast endpoint for basic validation, year, and WMI extraction. |
/api/v1/vin/bulk-simple | POST | High-performance bulk endpoint. Pass a list of VINs in the JSON body. |
/api/v1/vin/{vin}/decode | GET | Comprehensive decode endpoint using the vpic.spvindecode stored procedure. |
This project includes automated tests that run in an isolated Docker container against the real PostgreSQL schema to ensure flawless execution.
docker compose run --build --rm test
Content type
Image
Digest
sha256:a6bbe057bβ¦
Size
64.6 MB
Last updated
about 2 months ago
docker pull tiborrr/vpic-api-service