feat: implement “Save to Corpus Server” with API integration
Summary
This MR introduces the “Save to Corpus Server” feature, enabling users to directly submit transcription data to the Corpus platform.
The implementation ensures a smooth developer and user experience by handling environment-based API routing and resolving CORS issues during development using a Vite proxy. The feature is added as an extension, keeping existing save functionality unchanged.
Changes Made
Corpus Integration Feature
- Added “Save to Corpus Server” option in the workflow
- Integrated Corpus API endpoint (
POST /api/v1/records/) - Enabled direct submission of transcription data to Corpus platform
- Preserved existing local save functionality
API & Networking
-
Implemented dynamic API base URL resolution
-
Added support for environment variable (
VITE_CORPUS_API_URL) -
Configured Vite proxy for development:
/corpus → Corpus API
-
Updated API calls to use proxy routes in development
-
Removed trailing slash inconsistencies in API URLs
Validation & Error Handling
-
Added payload validation before API submission:
- Description length validation
- Required field checks (e.g., location)
-
Implemented structured error handling:
- API failure handling
- Validation error feedback
-
Added success handling with user feedback
UI / UX Improvements
- Added user feedback for successful submission
- Improved error messaging for failed requests
- Ensured smooth interaction without breaking existing flows
Code / Logic Updates
- Added
getCorpusApiBaseUrl()for environment-aware API handling - Refactored API service layer to support Corpus integration
- Introduced proxy-based routing for development environment
- Improved request handling and response parsing
Testing Done
Manual Testing
- Verified successful API submission via proxy (
/corpus/...) - Tested with valid payload → successful record creation
- Tested invalid payload → validation errors triggered
- Verified error handling for failed API responses
- Confirmed correct behavior with and without environment variables
Regression Checks
- Existing save functionality remains unaffected
- Transcription flow continues to work as expected
- No impact on other API integrations
Screenshots / Demo
Checklist
-
Feature implemented -
Tested locally -
No known regressions -
Ready for review
Notes
This MR establishes the foundation for deeper Corpus platform integration by enabling direct data submission from the frontend. It also improves developer experience through proxy-based API handling and environment-driven configuration.
Closes #8 (closed)

