performance: it should handle 5 mb of data.
High availability: when the user opens the URL, it should open fast.
Secure: it should handle very well the security.
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
openapi: 3.0.3
info:
title: Pastebin API
version: 1.0.0
description: API for creating and retrieving temporary text pastes.
servers:
- url: https://api.example.com/v1
paths:
/pastes:
post:
summary: Create a paste
operationId: createPaste
tags:
- Pastes
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreatePasteRequest"
example:
text: |
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
language: java
expirationDays: 7
responses:
"201":
description: Paste created successfully
content:
application/json:
schema:
$ref: "#/components/schemas/PasteCreatedResponse"
example:
pasteId: "550e8400-e29b-41d4-a716-446655440000"
url: "https://paste.example.com/p/550e8400-e29b-41d4-a716-446655440000"
language: java
status: active
createdAt: "2026-08-04T23:00:00Z"
expiresAt: "2026-08-11T23:00:00Z"
"400":
description: Invalid request
"413":
description: Paste exceeds the maximum allowed size
"422":
description: Paste was rejected by content moderation
"503":
description: Content scanning service is unavailable
/pastes/{pasteId}:
get:
summary: Retrieve a paste
operationId: getPaste
tags:
- Pastes
parameters:
- name: pasteId
in: path
required: true
description: Unique, unguessable identifier of the paste
schema:
type: string
format: uuid
responses:
"200":
description: Paste retrieved successfully
headers:
Cache-Control:
description: Controls CloudFront and browser caching
schema:
type: string
example: "public, max-age=300, s-maxage=3600"
content:
application/json:
schema:
$ref: "#/components/schemas/PasteResponse"
example:
pasteId: "550e8400-e29b-41d4-a716-446655440000"
text: |
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
language: java
createdAt: "2026-08-04T23:00:00Z"
expiresAt: "2026-08-11T23:00:00Z"
"404":
description: Paste does not exist or is not active
"410":
description: Paste has expired
components:
schemas:
CreatePasteRequest:
type: object
required:
- text
properties:
text:
type: string
minLength: 1
maxLength: 5242880
description: Paste content, with a maximum size of 5 MB
language:
type: string
default: plain_text
description: Language used for syntax highlighting
enum:
- plain_text
- java
- javascript
- typescript
- python
- go
- csharp
- cpp
- sql
- json
- xml
- yaml
- html
- css
- shell
expirationDays:
type: integer
default: 7
minimum: 1
maximum: 7
description: Number of days before the paste expires
PasteCreatedResponse:
type: object
required:
- pasteId
- url
- language
- status
- createdAt
- expiresAt
properties:
pasteId:
type: string
format: uuid
url:
type: string
format: uri
language:
type: string
status:
type: string
enum:
- active
createdAt:
type: string
format: date-time
expiresAt:
type: string
format: date-time
PasteResponse:
type: object
required:
- pasteId
- text
- language
- createdAt
- expiresAt
properties:
pasteId:
type: string
format: uuid
text:
type: string
language:
type: string
createdAt:
type: string
format: date-time
expiresAt:
type: string
format: date-time
| ServiceOne-sentence explanation | |
| CloudFront | Caches GET /pastes/{id} responses at edge locations so popular pastes load faster and fewer requests reach API Gateway, Lambda, DynamoDB, and S3. |
| API Gateway | Receives HTTP requests, routes each endpoint to the correct Lambda, and acts as the managed API entry point. |
| CreatePaste Lambda | Validates the request, generates the paste ID, calls Bedrock, stores the text and metadata, and returns the URL. |
| GetPaste Lambda | Checks that the paste is active and not expired, retrieves the text from S3, and returns it to the client. |
| Amazon Bedrock | Analyzes and moderates the submitted text before the paste is published. |
| Amazon S3 | Stores the actual paste text as durable, low-cost object storage. |
| Amazon DynamoDB | |
| Stores application metadata such as status, expiration, owner, visibility, idempotency data, and the S3 object key. |
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.