Loading...
Creates a new paste.
Request
{
"content": "print('Hello')",
"expires_in": 3600,
"syntax": "python",
"visibility": "unlisted"
}
Response
{
"paste_id": "abc123",
"url": "https://paste.io/abc123",
"expires_at": "2025-11-30T10:00:00Z"
}
Retrive a paste by ID.
Error Responses:
Deletes a user-owned paste (if private or owned).
[Client]
↓
[API Gateway / Load Balancer]
↓
[Paste Service (Create/Retrieve/Delete)]
↓ ↘
[Redis Cache] [Database Store]
↓ ↓
[TTL Processor] [Backup Storage]
Table: pastes
- paste_id (PK)
- content (TEXT)
- syntax (STRING)
- visibility (ENUM)
- owner_id (NULLABLE)
- created_at (TIMESTAMP)
- expires_at (TIMESTAMP)
- access_count (INT)
Indexes:
10M × 1 KB/day = 10 GB/day
7-day retention = 70 GB live data
3x replication → 210 GB
GET /paste/abc123paste_idprivate, unlisted)| FailureRecovery Strategy | |
| DB outage | Use read replicas, failover DB endpoint |
| Redis crash | Use AOF persistence + fallback to DB |
| PasteService failure | Auto-restart + stateless deployment |
| Surge in traffic (DoS) | API Gateway rate-limiting + CAPTCHA |
| Cache invalidation issue | TTL-based purge + on-demand DB lookup |
| Data loss |
| DecisionTrade-off / Justification | |
| Redis for caching | Fast reads vs memory usage; TTL reduces footprint |
| Base62 ID | Short + user-friendly vs potential for collisions |
| PostgreSQL vs DynamoDB | SQL query flexibility vs auto-scaling |
| User auth optional | Simpler MVP vs limited access control / management |
| Public pastes in CDN | Great performance vs cache invalidation complexity |
If we introduce user accounts, how would users retrieve their pastes efficiently?