
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Speechly is a React component that provides text-to-speech functionality using the Speechify API. It allows users to:
npm install speechly
import { Speechly } from 'speechly';
function App() {
// The API key is required
const apiKey = process.env.REACT_APP_SPEECHIFY_API_KEY;
return (
<div>
<h1>My App</h1>
<Speechly apiKey={apiKey} />
</div>
);
}
The Speechly component requires an API key to function. We recommend storing your API key in an environment variable rather than hardcoding it in your source code:
import { Speechly } from 'speechly';
function App() {
// Best practice: Store API key in environment variables
const apiKey = process.env.REACT_APP_SPEECHIFY_API_KEY;
// Optional: Provide user information for voice cloning consent
const userFullName = "John Doe";
const userEmail = "john.doe@example.com";
return (
<div>
<h1>My App</h1>
<Speechly
apiKey={apiKey}
fullName={userFullName}
email={userEmail}
/>
</div>
);
}
For different frameworks, you might need to use different environment variable naming:
REACT_APP_SPEECHIFY_API_KEY
NEXT_PUBLIC_SPEECHIFY_API_KEY
VITE_SPEECHIFY_API_KEY
Storing API keys in environment variables helps keep them secure and makes it easier to use different keys in development and production environments.
Prop | Type | Required | Description |
---|---|---|---|
apiKey | string | Yes | Your Speechify API key. We recommend storing this in an environment variable. |
fullName | string | No | User's full name for consent data when cloning voices. |
string | No | User's email for consent data when cloning voices. |
This project is built with React, TypeScript, and Vite.
Clone the repository:
git clone https://github.com/grandmastr/speechly.git
cd speechly
Install dependencies:
npm install
Start the development server:
npm run dev
Build the package:
npm run build
The project uses Vitest for testing. To run the tests:
# Run tests once
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
To use Speechly, you'll need a Speechify API key:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A React component for text-to-speech functionality using the Speechify API
The npm package speechly receives a total of 5 weekly downloads. As such, speechly popularity was classified as not popular.
We found that speechly demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.