Skip to content

Program 01 · Module 04 of 8

Module 04: Data Modeling, APIs and Backend

Model the data, design an API contract and build the server side one requirement at a time. You validate input, handle errors predictably and check generated backend code against your criteria.

Suggested study time
6–8 hours
Prerequisites
Module 3 complete.; Basic understanding of relational databases and HTTP.

Sign in to track your progress. Every lesson stays free to read without an account.

Learning outcomes

By the end of this module you will be able to:

  • Model entities, relationships and constraints from requirements.
  • Design an API contract before implementing it.
  • Implement endpoints with validation and consistent errors.
  • Review generated backend code for correctness, security and scope creep.

Lessons

  1. 4.1

    Modelling Entities and Relationships

    Turn nouns and rules in your requirements into entities, relationships and constraints.

    40 min
  2. 4.2

    Database Schema and Migrations

    Create a schema through versioned migrations, and review generated SQL before applying it.

    40 min
  3. 4.3

    Designing an API Contract

    Write the contract first, using a standard description format, so frontend and backend agree.

    40 min
  4. 4.4

    Implementing Endpoints with Validation

    Build endpoints that reject bad input early and report problems in a consistent shape.

    45 min
  5. 4.5

    Error Handling and Backend Review

    Handle failures predictably and review generated backend code against your acceptance criteria.

    40 min

About 3 h 25 min of lessons in total.

Practical assignment

Backend for the capstone

Build the data model and API for the Must requirements of your capstone application.

Deliverables

  • A data model with entities, relationships and constraints, traced to requirements.
  • A written API contract.
  • Working endpoints with input validation and consistent error responses.
  • A review note listing what generated code you changed and why.

Validation checklist

Use this to check your assignment before you move on.

Knowledge check

  1. 1.Why design the API contract before the implementation?
    Show the answer and explanation

    Answer: A. A shared contract lets both sides build and test against it. Speed is not the main reason, and assistants can write endpoints without one; the risk is that they invent a shape you then have to unpick.

  2. 2.Where should input validation happen?
    Show the answer and explanation

    Answer: B. Anyone can send requests without using your browser code, so server checks are the ones that count. Browser checks are a convenience, which makes them tempting to rely on, but they can be bypassed.

  3. 3.Generated code adds an endpoint for exporting all users. No requirement mentions it. What should you do?
    Show the answer and explanation

    Answer: B. An unrequested bulk-export endpoint is unreviewed scope and a data risk. Hiding it from the contract is the worst choice, because it remains reachable and nobody tests it.

PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.