The current default for PEERJS_HOST is '0.peerjs.com', an external service. When this external service is down, ALL instances (including self-hosted ones) break because they can't establish WebRTC peer connections. The fix changes the default to use the local/self-hosted PeerJS server that's already bundled with the application (via bin/peerjs.js). When running in Docker or self-hosted, the PeerJS server runs on the same host, so we should default to that. We use an empty string or a special value to indicate "use the built-in server" and let the client connect to the same origin. Affected files: route.ts, README.md Signed-off-by: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> |
2 months ago | |
|---|---|---|
| .claude | 10 months ago | |
| .github/workflows | 10 months ago | |
| bin | 1 year ago | |
| docs | 9 months ago | |
| public | 1 year ago | |
| scripts | 1 year ago | |
| src | 2 months ago | |
| tests | 10 months ago | |
| .cursorrules | 1 year ago | |
| .dockerignore | 1 year ago | |
| .gitignore | 1 year ago | |
| .prettierrc.js | 1 year ago | |
| CLAUDE.md | 10 months ago | |
| Dockerfile | 1 year ago | |
| LICENSE | 10 years ago | |
| README.md | 2 months ago | |
| docker-compose.production.yml | 1 year ago | |
| docker-compose.yml | 1 year ago | |
| eslint.config.mjs | 1 year ago | |
| next-env.d.ts | 1 year ago | |
| next.config.js | 1 year ago | |
| package.json | 3 months ago | |
| playwright.config.ts | 10 months ago | |
| pnpm-lock.yaml | 3 months ago | |
| postcss.config.js | 10 months ago | |
| renovate.json | 1 year ago | |
| tsconfig.json | 10 months ago | |
| vitest.config.ts | 10 months ago | |
| vitest.setup.ts | 10 months ago | |
README.md
Peer-to-peer file transfers in your browser
Cooked up by Alex Kern & Neeraj Baid while eating Sliver @ UC Berkeley.
Using WebRTC, FilePizza eliminates the initial upload step required by other web-based file sharing services. Because data is never stored in an intermediary server, the transfer is fast, private, and secure.
A hosted instance of FilePizza is available at file.pizza.
What's new with FilePizza v2
- A new UI with dark mode support, now built on modern browser technologies.
- Works on most mobile browsers, including Mobile Safari.
- Transfers are now directly from the uploader to the downloader's browser (WebRTC without WebTorrent) with faster handshakes.
- Uploaders can monitor the progress of the transfer and stop it if they want.
- Better security and safety measures with password protection and reporting.
- Support for uploading multiple files at once, which downloaders receive as a zip file.
- Streaming downloads with a Service Worker.
- Out-of-process storage of server state using Redis.
Development
$ git clone https://github.com/kern/filepizza.git
$ pnpm install
$ pnpm dev
$ pnpm build
$ pnpm start
Running with Docker
$ pnpm docker:build
$ pnpm docker:up
$ pnpm docker:down
Stack
- Next.js
- Tailwind
- TypeScript
- React
- PeerJS for WebRTC
- View Transitions
- Redis (optional)
Configuration
The server can be customized with the following environment variables:
REDIS_URL– Connection string for a Redis instance used to store channel metadata. If not set, FilePizza falls back to in-memory storage.COTURN_ENABLED– When set totrue, enables TURN support for connecting peers behind NAT.TURN_HOST– Hostname or IP address of the TURN server. Defaults to127.0.0.1.TURN_REALM– Realm used when generating TURN credentials. Defaults tofile.pizza.STUN_SERVER– STUN server URL to use whenCOTURN_ENABLEDis disabled. Defaults tostun:stun.l.google.com:19302.PEERJS_HOST– Hostname or IP address of the PeerJS server. Defaults to the same host as the application (built-in PeerJS server).PEERJS_PATH– Path to the PeerJS server. Defaults to/peerjs.
FAQ
How are my files sent? Your files are sent directly from your browser to the downloader's browser. They never pass through our servers. FilePizza uses WebRTC to send files. This requires that the uploader leave their browser window open until the transfer is complete.
Can multiple people download my file at once? Yes! Just send them your short or long URL.
How big can my files be? As big as your browser can handle.
What happens when I close my browser? The URLs for your files will no longer work.
