-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
apiAPI endpoints and backend logicAPI endpoints and backend logicenhancementNew feature or requestNew feature or requestpriority: criticalMust be done immediatelyMust be done immediately
Description
Overview
Create the primary API endpoint for creating new encrypted gists, handling multipart form data and storing both metadata and encrypted blobs in R2.
Tasks
- Create POST /api/gists endpoint
- Implement multipart form data parsing (Workers-compatible)
- Add request size validation (Workers limit: 100MB)
- Validate input data structure
- Store metadata in R2 with proper key structure
- Store encrypted blob in R2
- Return gist ID and share URL
Technical Requirements
- Edge runtime compatible
- Parse multipart/form-data without Node.js dependencies
- Validate against GistMetadata schema
- Enforce size limits: 500KB per file, 5MB total, 20 files max
- Generate unique gist IDs with nanoid
- Atomic operation (rollback on failure)
Request Format
\\
Response Format
\\
Acceptance Criteria
- Endpoint accepts encrypted gist data
- Validates all required fields
- Enforces size limits
- Returns 201 with gist ID on success
- Returns 400 for validation errors
- Returns 413 for size limit exceeded
- Handles R2 errors appropriately
Dependencies
- feat: implement R2 storage operations #104 (Storage Operations)
References
- See docs/PHASE_5_ISSUE_TRACKING.md for detailed specifications
Metadata
Metadata
Assignees
Labels
apiAPI endpoints and backend logicAPI endpoints and backend logicenhancementNew feature or requestNew feature or requestpriority: criticalMust be done immediatelyMust be done immediately