Three sections start here
Each section stands on its own, but they build on each other in this order: first what the API does, then how you prove who you are to it, then how the code behind it all is put together.
Section 1
The API Endpoints
Every resource the API exposes — elements, alloys, alloy elements, coins — the HTTP methods and paths for each, what a request body looks like, and how errors are reported.
Section 2
Authentication with JWT
What a JWT actually is, how this API issues and checks one, and a full step-by-step walkthrough in Insomnia: register or log in, copy the token, and attach it to every other request.
Section 3
File Structure
How metals_api/ is organized — routes, services, repositories, models, and DTOs — and how a single request travels through all of them.
The shape of every request the big picture
Whichever endpoint you call, the request passes through the same two checks before any business logic runs: are you logged in at all, and if this is a write, are you an Admin? Both checks live in metals_api/auth.py as small decorators reused across every route file.
Require @require_auth only — any logged-in user, Admin or Customer, can look things up.
Require @require_auth and @require_roles("Admin") — logged in isn't enough; the token's roles must include Admin.