Educational full-stack application demonstrating integration with the official DVLA Vehicle Enquiry API. Built to showcase modern web development practices with FastAPI and Svelte.
Learn how to build a production-ready vehicle lookup system from scratch
This project demonstrates:
Frontend
Backend
Before you start, make sure you have:
git clone https://github.com/joelmarodrigues/help-clamper.git
cd help-clamper
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv .venv
# Activate virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file with your credentials
echo "DVLA_API_KEY=your_api_key_here" > .env
echo "ALLOWED_ORIGINS=http://localhost:5173" >> .env
# Start the backend server
uvicorn main:app --reload --port 8000
You should see:
INFO: Uvicorn running on http://127.0.0.1:8000
INFO: Application startup complete.
Test it: Open http://localhost:8000/docs to see the interactive API documentation.
Open a new terminal (keep the backend running):
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start the development server
npm run dev
You should see:
VITE v5.4.21 ready in 722 ms
➜ Local: http://localhost:5173/
Open the app: Visit http://localhost:5173 in your browser.
WR22XRX or PL22YWB)help-clamper/
│
├── backend/ # Python FastAPI backend
│ ├── main.py # API routes and configuration
│ ├── requirements.txt # Python dependencies
│ ├── .env # Environment variables (create this)
│ └── .env.example # Example environment file
│
├── frontend/ # Svelte frontend
│ ├── src/
│ │ ├── App.svelte # Main application component
│ │ ├── main.js # Application entry point
│ │ └── app.css # Global styles
│ ├── public/
│ │ ├── icons/ # App icons and images
│ │ ├── manifest.webmanifest # PWA configuration
│ │ └── service-worker.js # Offline functionality
│ ├── vite.config.js # Vite build configuration
│ ├── svelte.config.js # Svelte compiler config
│ └── package.json # Node dependencies
│
├── LICENSE # MIT License
└── README.md # This file
┌─────────────┐ HTTP POST ┌──────────────┐ HTTPS ┌─────────────┐
│ Browser │ ─────────────────→ │ FastAPI │ ──────────────→ │ DVLA API │
│ (localhost: │ { plate: "..." } │ Backend │ + API Key │ (gov.uk) │
│ 5173) │ ←───────────────── │ (localhost: │ ←────────────── │ │
└─────────────┘ Vehicle details │ 8000) │ JSON response └─────────────┘
└──────────────┘
/lookupBackend (FastAPI)
Frontend (Svelte)
Retrieve vehicle details by registration number.
Endpoint: http://localhost:8000/lookup
Request:
{
"plate": "WR22XRX"
}
Success Response (200):
{
"make": "MERCEDES-BENZ",
"colour": "GREY",
"year_of_manufacture": 2022,
"fuel_type": "ELECTRICITY"
}
Error Response (404):
{
"detail": "Vehicle not found"
}
Try it yourself:
curl -X POST http://localhost:8000/lookup \
-H "Content-Type: application/json" \
-d '{"plate":"WR22XRX"}'
Health check endpoint to verify backend is running.
Endpoint: http://localhost:8000/health
Response (200):
{
"ok": true
}
Try it yourself:
curl http://localhost:8000/health
Create backend/.env with:
# Required: Your DVLA API key
DVLA_API_KEY=your_api_key_here
# Required: Allowed origins for CORS
ALLOWED_ORIGINS=http://localhost:5173
Getting a DVLA API Key:
.envThe frontend/vite.config.js automatically proxies API requests during development:
// Requests to /lookup are forwarded to http://localhost:8000/lookup
server: {
proxy: {
'/lookup': {
target: 'http://localhost:8000',
changeOrigin: true
}
}
}
This eliminates CORS issues during development.
Problem: ModuleNotFoundError: No module named 'fastapi'
Solution:
# Make sure virtual environment is activated
.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS/Linux
# Reinstall dependencies
pip install -r requirements.txt
Problem: Failed to fetch or CORS error
Solution:
backend/.env has ALLOWED_ORIGINS=http://localhost:5173Problem: Invalid or missing API key
Solution:
backend/.env.env fileFastAPI
Svelte
Vite
DVLA API
MIT License - See LICENSE file for details.
You are free to use this code for learning, personal projects, or commercial applications.
Vehicle data provided by the UK Driver and Vehicle Licensing Agency (DVLA) via their official Vehicle Enquiry Service API.
This is an educational project and is not affiliated with or endorsed by DVLA.
If you have questions about this project: