
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@pie-players/tts-server-sc
Advanced tools
SchoolCity-backed provider for server-side TTS with speech marks support
SchoolCity-backed server-side TTS provider for PIE projects.
For the cross-package TTS architecture and browser/server flow, see TTS Architecture. This README focuses on the SchoolCity-backed reference provider and its SSRF defenses.
This package uses SchoolCity as an internal Renaissance-backed reference implementation for custom server-side TTS integrations. The intent is to demonstrate a reusable "custom backend adapter" pattern you can apply to your own TTS service.
@pie-players/tts-server-* pattern.@pie-players/tts-server-sc is a host/server integration package.bun add @pie-players/tts-server-sc
baseUrl: SchoolCity TTS endpointapiKey: signing key used to mint bearer JWTissuer: JWT iss claimThe provider validates every upstream-returned asset URL (audio and speech marks) before fetching. The allow-list has two modes:
baseUrl (zero config)If assetOrigins is not supplied, the provider permits:
baseUrl's origin, andbaseUrl.This matches the common "service at x.vendor.tld, CDN at y.vendor.tld"
deployment (e.g. baseUrl = https://tts.svcdev.schoolcity.com permits
https://tts-cdn.svcdev.schoolcity.com out of the box) without opening the
provider up to arbitrary external hosts. The registrable domain is computed
via the Public Suffix List (tldts), so it is correct for multi-label TLDs
(.co.uk, .com.au, etc.). If baseUrl is an IP literal or a hostname
without a recognised public suffix, the provider falls back to strict
single-origin behavior.
Passing a non-empty assetOrigins switches the allow-list to strict
exact-origin matching and disables the registrable-domain fallback:
await provider.initialize({
baseUrl: process.env.TTS_SCHOOLCITY_URL!,
apiKey: process.env.TTS_SCHOOLCITY_API_KEY!,
issuer: process.env.TTS_SCHOOLCITY_ISS!,
assetOrigins: [
"https://tts.svcdev.schoolcity.com",
"https://tts-cdn.svcdev.schoolcity.com",
],
});
This is recommended for production because it gives an auditable, typo-resistant declaration of exactly which CDNs the provider is permitted to reach, and it rejects a compromised sibling host on the same registrable domain.
To force strict single-origin behavior without listing any extras, pass
assetOrigins: [baseUrl].
The private-host guard is intentionally opt-out-able for deployments where
the TTS service and its assets legitimately live on a private network —
on-prem CDN, in-cluster Kubernetes service, VPC endpoint, air-gapped
install, etc. Disable the guard and supply an explicit assetOrigins
allow-list covering every internal host that may appear in responses:
await provider.initialize({
baseUrl: "https://tts.internal.corp.local",
apiKey: process.env.TTS_SCHOOLCITY_API_KEY!,
issuer: process.env.TTS_SCHOOLCITY_ISS!,
blockPrivateAssetHosts: false,
assetOrigins: [
"https://tts.internal.corp.local",
"https://cdn.internal.corp.local",
],
});
Always pair blockPrivateAssetHosts: false with an explicit
assetOrigins list. Without one, a compromised or malicious upstream
response could redirect the provider to arbitrary internal hosts inside
your network boundary — which is exactly the SSRF class the guard
defends against.
Cloud-metadata / IMDS endpoints are always blocked (see below), even
when blockPrivateAssetHosts is false.
http: / https: schemes only.169.254.169.254, fd00:ec2::254, metadata.google.internal,
metadata.azure.internal, metadata.packet.net,
metadata.oci.oraclecloud.com. There is no legitimate TTS-asset use
case for these hosts and they return IAM credentials / provisioning
secrets.::ffff:…), trailing-dot hostnames (host.), bare decimal / hex /
octal IPv4 encodings are all rewritten before matching so they cannot
be used to bypass the blocklists.Symptom if a URL falls outside the policy:
SchoolCity asset URL origin is not allow-listed: <url>,
SchoolCity asset URL resolves to a private/internal host, or
SchoolCity asset URL resolves to a cloud metadata endpoint. Address by
adding the origin to assetOrigins, toggling blockPrivateAssetHosts
for private-network deployments, or investigating why an upstream
response is pointing at a metadata endpoint (that is never legitimate).
import { SchoolCityServerProvider } from "@pie-players/tts-server-sc";
const provider = new SchoolCityServerProvider();
await provider.initialize({
baseUrl: process.env.TTS_SCHOOLCITY_URL!,
apiKey: process.env.TTS_SCHOOLCITY_API_KEY!,
issuer: process.env.TTS_SCHOOLCITY_ISS!,
defaultLanguage: "en-US",
defaultSpeedRate: "medium",
defaultCache: true,
});
const result = await provider.synthesize({
text: "Hello world",
language: "en-US",
includeSpeechMarks: true,
});
If you need to return the SchoolCity-style response shape (audioContent, word) while reusing provider logic:
const assets = await provider.synthesizeWithAssets({
text,
language: lang_id,
providerOptions: { speedRate, cache },
});
return json({
audioContent: assets.audioContent,
word: assets.word,
speechMarks: assets.speechMarks,
});
To adapt this package pattern to another custom provider, replace:
toBearerToken() strategy (JWT/API key/OAuth as needed)text, language, speed/rate fields)audioContent, marks URL, or inline marks)Keep the provider surface (initialize, synthesize, synthesizeWithAssets) so host
routes can stay thin and consistent.
<speak>...</speak> is provided, it is normalized to avoid nested <speak> wrappers when SC applies its own wrapping behavior.FAQs
SchoolCity-backed provider for server-side TTS with speech marks support
We found that @pie-players/tts-server-sc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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 Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.