A Next.js application that transcribes audio and video files to text using Lemonfox.ai's advanced transcription API.
- 🎵 Support for multiple audio formats: MP3, WAV, FLAC, OPUS, OGG, M4A
- 🎥 Support for video formats: MP4, MPEG, MOV, WEBM
- 📁 File size limits:
- Direct upload: up to 100MB
- URL: up to 1GB
- 🌐 Remote file transcription via URL
- 🎯 High accuracy transcription powered by Lemonfox.ai
- 📋 Easy copy-to-clipboard functionality
- 🖥️ Modern, responsive UI with drag-and-drop support
- Node.js 18 or later
- Yarn 4
- Lemonfox.ai API key
- Clone the repository:
git clone [repository-url]
cd speech-to-text- Install dependencies:
yarn install- Create a
.env.localfile in the root directory:
LEMONFOX_API_KEY=your_lemonfox_api_key_here
NEXT_PUBLIC_ACCESS_CODE=your_access_code_here # Access code for authenticationTo get your Lemonfox.ai API key:
- Create an account at Lemonfox.ai
- Navigate to the API section in your dashboard
- Generate a new API key
- Copy the key to your
.env.localfile
Run the development server:
yarn devOpen http://localhost:3000 to view the application.
-
Direct File Upload
- Drag and drop an audio/video file into the upload area
- Or click to open the file selector
- Supported file types: MP3, WAV, FLAC, OPUS, OGG, M4A, MP4, MPEG, MOV, WEBM
- Maximum file size: 100MB
- For larger files, please use URL upload
-
URL Transcription
- Paste a URL to an audio/video file in the URL input field
- Click "Transcribe URL"
- Maximum file size: 1GB
- URL must point directly to a media file
-
View and Copy Results
- Transcription appears below the upload area
- Use the "Copy to Clipboard" button to copy the text
- Preview uploaded media files in the browser
The application is optimized for deployment on Railway.app with the following features:
-
File Size Support
- Direct file uploads up to 100MB
- URL-based uploads up to 1GB
- No timeout issues for long transcriptions (up to 1 hour)
-
Deployment Steps
-
Push your code to GitHub/GitLab
-
Create an account on Railway.app
-
Install Railway CLI:
npm i -g @railway/cli
-
Login to Railway:
railway login
-
Initialize Railway project in your local directory:
railway init
This will create a new project and link your directory to it.
-
Add environment variables:
railway variables --set LEMONFOX_API_KEY=your_api_key_here railway variables --set NEXT_PUBLIC_ACCESS_CODE=your_access_code_here
-
Deploy your application:
railway up
-
Open your deployed application:
railway open
-
Railway will automatically:
- Detect your Next.js application
- Install dependencies
- Build the application
- Deploy it with the proper configuration
Note: You can manage your environment variables using these commands:
railway variables # List all variables
railway variables --unset KEY # Remove a variable
railway run yarn dev # Run locally with Railway variables
railway shell # Open a shell with Railway variablesThe application handles various error cases:
- Invalid file formats
- File size limits
- Invalid URLs
- API errors
- Network issues
Error messages are displayed clearly to the user with suggestions for resolution.
- Framework: Next.js 14 with App Router
- Styling: Tailwind CSS
- API Integration: Lemonfox.ai Transcription API
- File Handling: Native File API + FormData
- Language: TypeScript
import SpeechToText from "@/components/SpeechToText";
// Basic usage
<SpeechToText />
// With handlers
<SpeechToText
onTranscriptionComplete={(result) => console.log(result)}
onError={(error) => console.error(error)}
/>| Variable | Description | Required |
|---|---|---|
LEMONFOX_API_KEY |
Your Lemonfox.ai API key | Yes |
NEXT_PUBLIC_ACCESS_CODE |
Access code for application authentication | Yes |
Handles both direct file uploads and URL transcription requests.
Request body (FormData):
file: File object or URL string
Response:
{
"text": "Transcribed text content",
"segments": [
{
"id": 1,
"text": "Segment text",
"start": 0.0,
"end": 1.0,
"speaker": "A"
}
]
}- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.