https://github.com/wsand02/waveemapi3
yet another wav to mp3 api
https://github.com/wsand02/waveemapi3
mp3 rest-api rocket rust wav
Last synced: about 1 month ago
JSON representation
yet another wav to mp3 api
- Host: GitHub
- URL: https://github.com/wsand02/waveemapi3
- Owner: wsand02
- License: lgpl-3.0
- Created: 2025-05-25T14:21:19.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-09-15T14:54:40.000Z (9 months ago)
- Last Synced: 2025-09-15T15:24:48.473Z (9 months ago)
- Topics: mp3, rest-api, rocket, rust, wav
- Language: Rust
- Homepage:
- Size: 12.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# waveemapi3

[](https://github.com/wsand02/waveemapi3/actions/workflows/rust.yml)
[](https://github.com/wsand02/waveemapi3/actions/workflows/clippy.yml)
[](https://hub.docker.com/r/wsand02/waveemapi3)


**waveemapi3** is yet another WAV-to-MP3 API, but at least it's not an FFmpeg wrapper. (I wish it was at this point ðŸ˜ðŸ˜).
This service is intended for internal API-to-API communication with simple API authentication. It only really exists because LAME is licensed with the LGPL license.
## Installation
### Building from Source
```bash
git clone https://github.com/wsand02/waveemapi3.git
cd waveemapi3
cargo build --release
```
Create the data directory. Ensure the user running waveemapi has the correct permissions for the directory.
```bash
mkdir data
```
Copy `waveemapi.toml.example` into `waveemapi.toml`.
If your data folder is not in the same directory as `Cargo.toml`, or is called anything other than `data`, please declare it under `data_path` in the configuration file. Alternatively as an environment variable, see the [environment variable](#environment-variables) section for more info.
### Docker Compose
Copy `docker-compose.yml.example` into `docker-compose.yml`.
Edit the tokens and other environment variables to your liking.
Run Docker Compose:
```bash
docker-compose up -d
```
Verify the service is running:
```bash
docker-compose ps
```
## API Routes
### `(GET) /api/status`
Returns a simple JSON status response.
#### Example Response:
```json
{
"status": "Online"
}
```
### `(POST) /api/upload`
Accepts a multipart form upload:
- `wav`: The WAV file to convert.
- Requires a bearer token, if authentication is enabled.
#### Example Request:
```bash
curl -X POST \
-H "Authorization: Bearer your_token" \
-F "wav=@path/to/file.wav" \
http://localhost:8000/api/upload
```
Returns a raw MP3 file, or a multitude of errors.
## Configuration
**waveemapi** uses a configuration file named `waveemapi.toml` and supports environment variable overrides.
**Note:** waveemapi inherits all of Rocket's [available settings](https://rocket.rs/guide/v0.5/configuration/#configuration).
### `waveemapi.toml`
```toml
[default]
# Limits for form uploads
limits = { form = "1 GiB", data-form = "1 GB", file = "500 MB" }
# API authentication tokens. Add tokens to enable bearer token authentication.
auth_tokens = [
"your_secret_token"
]
# Enable or disable authentication. Set to `false` to bypass authentication.
auth_enabled = true
# How often the data folder should be cleaned.
cleanup_interval_minutes = 5
# Only delete files older than this during cleanup.
file_expiry_minutes = 10
```
### Environment Variables
You can override the configuration using environment variables. The following variables are supported:
+ `WAVEEMAPI_DATA_PATH`: Path to the directory where data files are stored.
+ `WAVEEMAPI_AUTH_ENABLED`: Set to `true` or `false` to enable or disable authentication.
+ `WAVEEMAPI_PROFILE`: Specify the configuration profile to use (e.g., `default`).
+ `WAVEEMAPI_AUTH_TOKENS`: A list of API tokens.
+ `WAVEEMAPI_CLEANUP_INTERVAL_MINUTES`: How often the data folder should be cleaned.
+ `WAVEEMAPI_FILE_EXPIRY_MINUTES`: How old the files deleted during cleanup have to be.
#### Example:
```bash
export WAVEEMAPI_DATA_PATH="/path/to/data"
export WAVEEMAPI_AUTH_ENABLED=true
```
## License
As stated earlier, this project is licensed under the LGPL license, see [LICENSE](LICENSE).