Project Workshop — Recipe Platform GraphQL Schema
This is a portfolio submission, not a copy-and-run tutorial. A reviewer must be able to clone it, configure it without guessing, execute the critical path, observe a deliberate failure, run the tests, and understand the most important…
- What you are building
- Architecture
- Acceptance criteria
- Suggested repository structure
- Build plan: vertical slices
GraphQL · SDL
Expected effort: 40–64 focused hours · Minimum meaningful tests: 12What you are building
This is a portfolio submission, not a copy-and-run tutorial. A reviewer must be able to clone it, configure it without guessing, execute the critical path, observe a deliberate failure, run the tests, and understand the most important design decision from the README.
Architecture
Critical interaction
Ownership table
| Boundary | Owns | Must not own |
|---|---|---|
| Interface | Parsing, protocol validation, identity extraction, status or presentation mapping | Core business invariants |
| Application/domain | Authorization inputs, state transitions, orchestration, transaction intent | Framework globals or raw transport objects |
| Repository/gateway | One persistence or external protocol, bounded retries, error translation | Product policy |
| Background/UI projection | Recoverable derived state and delivery progress | Hidden authoritative truth |
| Operations | Configuration, health, deployment, telemetry, recovery | Business decisions encoded only in dashboards |
Acceptance criteria
| ID | Required behavior | Evidence |
|---|---|---|
| AC-1.1 | scalar/Object/Non-null/list types produces the specified behavior inside Schema Definition Language | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.2 | Input types vs output types produces the specified behavior inside Schema Definition Language | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.3 | Enum/Union/Interface types produces the specified behavior inside Schema Definition Language | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.4 | Query/Mutation/Subscription roots produces the specified behavior inside Schema Definition Language | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.5 | @deprecated/@skip/@include directives produces the specified behavior inside Schema Definition Language | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.1 | query syntax and nested fields produces the specified behavior inside Queries, mutations, subscriptions | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.2 | variables: $varName: Type produces the specified behavior inside Queries, mutations, subscriptions | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.3 | named + inline fragments produces the specified behavior inside Queries, mutations, subscriptions | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.4 | introspection (__schema/__type) produces the specified behavior inside Queries, mutations, subscriptions | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.1 | signature: (root, args, context, info) produces the specified behavior inside Resolvers | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.2 | default resolvers produces the specified behavior inside Resolvers | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.3 | resolver chain data flow produces the specified behavior inside Resolvers | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.4 | context: DB session + current user produces the specified behavior inside Resolvers | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.1 | DateTime/JSON/UUID scalar parse and serialize produces the specified behavior inside Custom scalars & query cost | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.2 | query depth limiting produces the specified behavior inside Custom scalars & query cost | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.3 | field complexity weights and list multipliers produces the specified behavior inside Custom scalars & query cost | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.4 | bounded pagination as cost control produces the specified behavior inside Custom scalars & query cost | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
Suggested repository structure
1project/2├── src/3│ ├── __init__.py4│ ├── cli.py5│ ├── models.py6│ ├── services.py7│ ├── repository.py8│ └── errors.py9├── tests/{test_cli.py,test_services.py,test_repository.py}10├── pyproject.toml11├── README.md12└── .gitignoreBuild plan: vertical slices
| Milestone | Capability | First implementation | Exit condition |
|---|---|---|---|
| 1 | Schema Definition Language | scalar/Object/Non-null/list types; Input types vs output types; Enum/Union/Interface types | Demonstration plus focused tests |
| 2 | Queries, mutations, subscriptions | query syntax and nested fields; variables: $varName: Type; named + inline fragments | Demonstration plus focused tests |
| 3 | Resolvers | signature: (root, args, context, info); default resolvers; resolver chain data flow | Demonstration plus focused tests |
| 4 | Custom scalars & query cost | DateTime/JSON/UUID scalar parse and serialize; query depth limiting; field complexity weights and list multipliers | Demonstration plus focused tests |
| 5 | Hardening and delivery | Security, recovery, telemetry, performance, documentation | Full acceptance suite and recorded demonstration |
For each milestone, first create a failing acceptance test or a reproducible command. Implement the thinnest path to an observable result, add the nearest durable invariant, inject one expected failure, and refactor only after evidence protects the behavior.
Reference vertical slice
1query RecipePage($id: ID!, $first: Int! = 10) {2 recipe(id: $id) {3 id4 title5 author { id name }6 reviews(first: $first) {7 edges { cursor node { rating body } }8 pageInfo { hasNextPage endCursor }9 }10 }11}12
13mutation AddReview($input: ReviewInput!) {14 addReview(input: $input) {15 review { id rating }16 errors { field message }17 }18}Expected result
1The response shape mirrors the selected fields; validation rejects missing or incorrectly typed variables before resolvers run.Code reading
| Line | Code | Explanation |
|---|---|---|
| 1 | query RecipePage($id: ID!, $first: Int! = 10) { | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 2 | recipe(id: $id) { | Implements the next graphql statement in the example's data flow. |
| 3 | id | Implements the next graphql statement in the example's data flow. |
| 4 | title | Implements the next graphql statement in the example's data flow. |
| 5 | author { id name } | Implements the next graphql statement in the example's data flow. |
| 6 | reviews(first: $first) { | Implements the next graphql statement in the example's data flow. |
| 7 | edges { cursor node { rating body } } | Implements the next graphql statement in the example's data flow. |
| 8 | pageInfo { hasNextPage endCursor } | Implements the next graphql statement in the example's data flow. |
| 9 | } | Implements the next graphql statement in the example's data flow. |
| 10 | } | Implements the next graphql statement in the example's data flow. |
| 11 | } | Implements the next graphql statement in the example's data flow. |
| 13 | mutation AddReview($input: ReviewInput!) { | Implements the next graphql statement in the example's data flow. |
| 14 | addReview(input: $input) { | Implements the next graphql statement in the example's data flow. |
| 15 | review { id rating } | Implements the next graphql statement in the example's data flow. |
| 16 | errors { field message } | Implements the next graphql statement in the example's data flow. |
| 17 | } | Implements the next graphql statement in the example's data flow. |
| 18 | } | Implements the next graphql statement in the example's data flow. |
Risk register
| Area | Failure to reproduce | Required design response |
|---|---|---|
| Schema Definition Language | Making everything non-null can turn one downstream failure into loss of a much larger response subtree. | Make nullability intentional and evolve by adding fields before deprecating old ones. |
| Queries, mutations, subscriptions | Building operations by string concatenation invites injection-like mistakes and defeats caching. | Use named operations and server-enforced persisted documents for sensitive or high-scale clients. |
| Resolvers | A resolver is an authorization boundary; hiding a field in the UI is insufficient. | Keep context request-scoped and batch relation loading. |
| Custom scalars & query cost | A field-level page limit is insufficient if nested lists multiply into thousands of resolver calls. | Use strict defaults and maximums for every connection and combine them with depth, complexity, timeout, and database-query budgets. |
Engineering checklist for this stack
- To do: authenticate before object lookup where possible
- To do: authorize the action and object server-side
- To do: keep transactions in the application service
- To do: bound request, response, and query work
- To do: map typed domain failures to stable protocol errors
Test strategy
Implement at least 12 meaningful cases. A long list of shallow happy-path tests does not satisfy the requirement.
| Risk class | Minimum | Examples |
|---|---|---|
| Happy path and contract | 2 | Correct output, status/schema, durable state |
| Validation and boundaries | 2 | Empty, malformed, extreme, unsupported transition |
| Authorization or trust boundary | 1 | Missing identity, wrong tenant/role, injection or unsafe content |
| Failure and recovery | 2 | Timeout, retry, rollback, reconnect, dependency outage |
| Duplicate or concurrency | 1 | Same identity twice, racing update, redelivery |
| Performance and operations | 4 | Query bound, lag, p95, resource limit, telemetry |
Representative test scaffold
1def test_private_field_requires_owner(graphql_client, user, other_user, private_post):2 graphql_client.force_login(other_user)3 response = graphql_client.execute(4 "query($id: ID!) { post(id: $id) { id privateNotes } }",5 variables={"id": str(private_post.id)},6 )7 assert response["data"]["post"]["privateNotes"] is None8 assert response["errors"][0]["extensions"]["code"] == "FORBIDDEN"Failure drills
- Stop the primary external dependency during the critical path. Capture the failure, cleanup, telemetry, and recovery.
- Repeat the same operation with the same stable identity. Prove one logical outcome or document why repetition is forbidden.
- Crash after durable state changes but before the response, acknowledgement, or projection. Re-run and reconcile.
- Submit the largest supported input and one slightly larger input.
- Remove one permission and prove denial without state change or information leakage.
- Roll back the change or restore the dependency, then run a smoke test and reconciliation check.
Performance experiment
State the dataset, payload distribution, concurrency, rate, duration, cache state, and resource limits before measuring. Publish p50, p95, p99, throughput, error rate, and the technology-specific correctness signal such as query count, consumer lag, duplicate effects, rendered updates, token cost, or recall. Change one variable at a time and retain raw output.
Submission package
- Complete source with a locked/reproducible environment.
- README.md with problem, architecture, setup, commands, configuration, assumptions, and trade-offs.
- Acceptance and risk-focused tests with a short explanation of what mocks intentionally do not cover.
- One design record explaining the most consequential choice and a rejected alternative.
- Security notes, sample non-secret configuration, and cleanup commands.
- A demonstration record: terminal transcript, screenshots, trace, query plan, or metrics dashboard.
- A 5–8 minute walkthrough following input → validation → state → failure → evidence.
Grading rubric
| Dimension | Weight | Full-credit evidence |
|---|---|---|
| Product behavior | 25 | Acceptance criteria pass through real public boundaries |
| Architecture and ownership | 20 | Responsibilities and state authority are explicit |
| Tests and recovery | 20 | Important negative, duplicate, concurrent, and outage cases pass |
| Security and data correctness | 15 | Least privilege, validation, constraints, and secret handling are demonstrated |
| Performance and operations | 10 | Reproducible measurement, useful telemetry, and rollback/recovery |
| Documentation and explanation | 10 | A new reviewer can reproduce and defend the result |
Mastery check
How well can you recall this?
Finished this lesson?