MVP Platform Vehicles Service
Schema Bootstrapping (Docker-First)
- Database: PostgreSQL, service
mvp-platform-vehicles-db. - On first start, schema files from
mvp-platform-services/vehicles/sql/schemaare executed automatically because the folder is mounted to/docker-entrypoint-initdb.dindocker-compose.yml. - Files run in lexicographic order:
001_schema.sql– createsvehiclesschema and tables002_constraints_indexes.sql– adds uniques and indexes003_seed_minimal.sql– seeds minimal dropdown data for sanity checks
When Do Files Run?
- Only on the initial database initialization (i.e., when the Postgres data volume is empty).
- Subsequent
make startruns will not reapply these files unless you reset the volume.
Applying Schema Changes
- Option 1 (fresh reset):
make cleanto remove volumesmake start(the.sqlfiles will be reapplied)
- Option 2 (manual apply to existing DB):
- Exec into the DB container and run the SQL files in order:
docker compose exec mvp-platform-vehicles-db bash -lc "psql -U mvp_platform_user -d vehicles -f /docker-entrypoint-initdb.d/001_schema.sql" docker compose exec mvp-platform-vehicles-db bash -lc "psql -U mvp_platform_user -d vehicles -f /docker-entrypoint-initdb.d/002_constraints_indexes.sql" docker compose exec mvp-platform-vehicles-db bash -lc "psql -U mvp_platform_user -d vehicles -f /docker-entrypoint-initdb.d/003_seed_minimal.sql"
- Exec into the DB container and run the SQL files in order:
Quick Start
make start
make logs-platform-vehicles # View API + DB logs
Endpoint Summary (Auth Required: Authorization: Bearer <API_KEY>)
GET /api/v1/vehicles/years→[number]GET /api/v1/vehicles/makes?year=YYYY→{ makes: [{id,name}] }GET /api/v1/vehicles/models?year=YYYY&make_id=ID→{ models: [...] }GET /api/v1/vehicles/trims?year=YYYY&make_id=ID&model_id=ID→{ trims: [...] }GET /api/v1/vehicles/engines?year=YYYY&make_id=ID&model_id=ID&trim_id=ID→{ engines: [...] }
Notes
- Transmissions and performance tables exist for future use; no endpoints yet.
- VIN decode endpoints are pending rebuild and not documented here.