Current Focus

Current Objective

Implement Secure User Registration & CRUD (Milestone 1).

Current Blocker

None.

Next Action !!!!

Build one endpoint that accepts a validated request body (POST /auth/register).

Tactical actions for next session:
1. Complete the narrow, focused Pydantic guide skeleton in knowledge/skills/pydantic.md.
2. Design the UserRegister and UserResponse Pydantic models.
3. Implement POST /auth/register in bitetrack-api routes returning a dummy response.
4. Verify route validation and responses.


Step 1 — Read only what you need (30–60 min)

Open the official Pydantic documentation and ignore everything except the pieces required to build request models.

Specifically answer these questions in your new guide:

  • Why does Pydantic exist?
  • What is BaseModel?
  • How does automatic validation work?
  • How does FastAPI use Pydantic?
  • How do I declare fields?
  • How do I validate common types (str, int, EmailStr, etc.)?
  • How do validation errors look?

Step 2 — Build while reading

Don't stay in documentation mode for two hours.

After every section, jump to BiteTrack.

For example:

Documentation:

class User(BaseModel):
    username: str

Immediately write

class UserRegister(BaseModel):
    ...

Even if it's incomplete.


Step 3 — Decide your API contract

Before writing routes, answer questions like:

Request

{
    "email": "...",
    "password": "...",
    "full_name": "..."
}

Response

{
    "id": "...",
    "email": "...",
    "full_name": "..."
}

Notice something?

This is no longer a Pydantic problem.

It's API design.

That's exactly why your coach wanted you here.


Step 4 — Implement a dummy endpoint

No database.

No hashing.

No SQLAlchemy.

Just

@app.post(...)
def register(user: UserRegister):
    ...

Return fake data.

Your goal is to watch FastAPI validate the request automatically.


One thing I'd deliberately avoid today

Don't start documenting all of Pydantic.

Your recent guides (enumerate, zip, hashmap) worked well because they answered one concrete question.

Try to keep the Pydantic guide equally focused.

Instead of

Introduction to Pydantic

I'd mentally frame it as

Using Pydantic to define and validate API contracts

That's exactly the piece you'll be using for the next several milestones.


One prediction: today's session will probably feel different from the LeetCode work.

Algorithms are about discovering an idea.

This session is about discovering a workflow:

Request → Pydantic model → FastAPI validation → Route → Response model.

Once you've built one endpoint that way, every CRUD endpoint that follows will reuse the same mental pattern. That makes today an investment that should pay off repeatedly over the rest of the residency.