A modern web application for recording audio and converting speech to text using OpenAI's Whisper API. Built with Next.js, TypeScript, and Tailwind CSS.
- Audio Recording: Record high-quality audio directly in the browser
- Real-time Recording Display: Visual feedback with timer and waveform
- Audio Playback: Review recordings before transcription
- Speaker Diarization: Identify different speakers in conversations with formatted output
- Conversation Format: Convert multi-speaker audio into "Person 1:", "Person 2:" format
- Responsive Design: Beautiful UI that works on all devices
- Transcription History: View and manage all your transcriptions
- Copy to Clipboard: Easy copying of transcribed text
- OpenAI Integration: Real speech-to-text using Whisper API + GPT-4 for speaker identification
- Vercel Blob Storage: Secure audio file storage
- PostgreSQL Database: Persistent storage with Neon + Prisma ORM
- Token & Cost Tracking: Monitor usage and costs per transcription
- Error Handling: Comprehensive error handling and user feedback
- User Authentication: Secure user accounts
- Export Options: Download transcriptions in various formats
- Language Detection: Auto-detect spoken language
- Batch Processing: Upload and transcribe multiple files
- Analytics Dashboard: Detailed usage statistics
- Transcription Search: Search through historical transcriptions
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS 4
- Audio API: Web MediaRecorder API
- Database: PostgreSQL with Neon + Prisma ORM
- File Storage: Vercel Blob
- AI: OpenAI Whisper API
- Deployment: Vercel
- Node.js 18+
- npm or yarn
- OpenAI API key
- Vercel account (for Blob storage)
- Clone the repository:
git clone <repository-url>
cd speech-to-text- Install dependencies:
npm install- Set up environment variables:
Create a
.env.localfile in the root directory:
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Vercel Blob Configuration
BLOB_READ_WRITE_TOKEN=your_vercel_blob_token_here
# Database Configuration
POSTGRES_URL=your_neon_database_url_here
# App Configuration (optional)
NEXT_PUBLIC_APP_URL=http://localhost:3000- Go to OpenAI Platform
- Sign in or create an account
- Create a new API key
- Copy the key and add it to your
.env.localfile
- Go to Vercel Dashboard
- Create a new project or select an existing one
- Go to Storage tab
- Create a new Blob store
- Copy the BLOB_READ_WRITE_TOKEN and add it to your
.env.localfile
-
Go to Neon Console
-
Sign in or create an account
-
Create a new project
-
Go to Connection Details
-
Copy the Connection String and add it as
POSTGRES_URLto your.env.localfile -
Validate your setup (optional but recommended):
npm run setup-check- Set up the database:
# Generate Prisma client
npm run db:generate
# Push schema to database (creates tables)
npm run db:push- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
- Record Audio: Click the microphone button to start recording
- Stop Recording: Click "Stop Recording" when finished
- Review: Listen to your recording using the audio player
- Transcribe: Click "Transcribe" to convert speech to text using OpenAI Whisper
- Manage: View your transcription history, copy text, or expand for full content
- Storage: Audio files are automatically saved to Vercel Blob storage
- Enable Conversation Mode: Before or after recording, check "Identificar diferentes personas en la conversaciรณn"
- Set Speaker Count: Select the expected number of speakers (2-5)
- Record/Transcribe: The system will automatically identify different speakers
- View Results: Transcriptions will be formatted as:
Persona 1: Hello, how are you? Persona 2: I'm doing great, thanks for asking! Persona 1: That's wonderful to hear. - Enhanced Display: Conversation transcriptions show with color-coded speakers and conversation tags
Phase 1: Frontend โ (Complete)
- Audio recording functionality
- Real-time recording interface
- Audio playback
- Transcription history UI
- Responsive design
- Copy to clipboard
Phase 2: Backend APIs โ (Complete)
- OpenAI Whisper API integration
- Vercel Blob storage setup
- File upload and management
- Transcription endpoint
- Error handling and validation
Phase 3: Database โ (Complete)
- PostgreSQL setup with Neon
- Transcription persistence with Prisma ORM
- Data retrieval APIs
- Token and cost tracking
- Automatic data loading
Phase 4: Enhanced Features (Future)
- User authentication
- Export functionality
- Advanced audio processing
- Batch transcription
src/
โโโ app/
โ โโโ api/
โ โ โโโ transcribe/
โ โ โ โโโ route.ts # Speech-to-text API endpoint
โ โ โโโ health/
โ โ โโโ route.ts # Health check endpoint
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Main application
โ โโโ globals.css # Global styles
โโโ components/
โ โโโ AudioRecorder.tsx # Recording interface
โ โโโ TranscriptionHistory.tsx # History display
โโโ lib/
โ โโโ config.ts # Configuration utilities
โโโ scripts/
โโโ setup-check.js # Setup validation script
npm run dev: Start development servernpm run build: Build for productionnpm run start: Start production servernpm run lint: Run ESLintnpm run setup-check: Validate environment configurationnpm run type-check: Run TypeScript type checkingnpm run db:generate: Generate Prisma clientnpm run db:push: Push schema to databasenpm run db:studio: Open Prisma Studio (database GUI)
- Ensure your
.env.localfile contains a validOPENAI_API_KEY - Run
npm run setup-checkto validate your configuration - Check that your OpenAI account has credits available
- Ensure your
.env.localfile contains a validBLOB_READ_WRITE_TOKEN - Make sure the token has read/write permissions
- Verify the Vercel Blob store is created and active
- Check browser permissions for microphone access
- Try refreshing the page and granting permissions again
- Ensure your microphone is working in other applications
- Try using a different browser (Chrome/Edge recommended)
- Check if WebRTC is supported in your browser
- Verify your microphone is not being used by other applications
- Run the health check:
http://localhost:3000/api/health - Use the setup validation:
npm run setup-check - Test a simple recording to verify everything works
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
- Backend API development
- OpenAI integration
- Database setup
- User authentication
- File management
- Advanced features
- Mobile app (future)
Note: This is currently a frontend-only implementation. The transcription feature shows mock data while we develop the backend integration.