100% written by LLM (Claude)
DuckDuckGo Bangs-style search redirect service.
- Bang search:
g hello→ Google search for "hello" - Default engine: Search without bang uses your default engine
- Homepage:
yt(no query) → YouTube home - Custom triggers:
!g,@g,#g- any format you want - Search suggestions: live autocomplete from the target engine as you type (Firefox)
- Auto-reload: Config changes apply without restart
default_bang: g
bangs:
- trigger: g
name: Google
url_template: "https://www.google.com/search?q={{{s}}}"
suggest_url_template: "https://suggestqueries.google.com/complete/search?client=firefox&q={{{s}}}"
- trigger: yt
name: YouTube
97D0
url_template: "https://www.youtube.com/results?search_query={{{s}}}"
suggest_url_template: "https://suggestqueries.google.com/complete/search?client=firefox&ds=yt&q={{{s}}}"
- trigger: gh
name: GitHub
url_template: "https://github.com/search?q={{{s}}}"docker run -d -p 8080:8080 \
-v $(pwd)/bangs.yaml:/app/bangs.yaml \
ghcr.io/psi59/bangs:latest- Open
http://localhost:8080/in Firefox - Right-click the address bar → Add "Bangs" (or Settings → Search → Search Shortcuts, the page offers the engine automatically)
- Set Bangs as your default search engine
- Type
g helloin the address bar — suggestions from the target engine appear as you type (for bangs withsuggest_url_template)
- Settings → Search engine → Manage search engines → Add
- Configure:
- Search engine:
Bangs - Shortcut:
b - URL:
http://localhost:8080/search?q=%s
- Search engine:
- Type
b g helloin address bar → Google search for "hello"
- After adding as custom search engine
- Find "Bangs" in the list, click ⋮ → Make default
- Now type
g hellodirectly in address bar
| Field | Description | Required |
|---|---|---|
trigger |
Bang trigger (e.g., g, !g, @yt) |
Yes |
name |
Search engine name | Yes |
url_template |
Search URL. {{{s}}} is replaced with query |
Yes |
home_url |
URL when no query. Auto-extracted if omitted | No |
suggest_url_template |
Autocomplete API URL (OpenSearch suggestions or Naver ac.search.naver.com format). Enables live suggestions |
No |
| Variable | Description | Default |
|---|---|---|
BANGS_CONFIG_PATH |
Config file path | ./bangs.yaml |
BANGS_PORT |
Server port | 8080 |
BANGS_AUTH_KEYS |
Comma-separated access keys. Empty disables authentication | (empty) |
Set BANGS_AUTH_KEYS to require a key query parameter on /, /search,
/suggest and /opensearch.xml. Requests without a valid key get a plain
404. /health and /favicon.ico stay open for health checks.
docker run -d -p 8080:8080 \
-v $(pwd)/bangs.yaml:/app/bangs.yaml \
-e BANGS_AUTH_KEYS="$(openssl rand -hex 32)" \
ghcr.io/psi59/bangs:latestRegister the engine from https://<host>/?key=<key>: the page then serves an
OpenSearch description whose search and suggestion URLs already carry the key,
so Firefox sends it automatically. For Chrome, append the key to the search
engine URL: https://<host>/search?q=%s&key=<key>.
The key travels in the URL because browsers cannot add headers to address-bar
searches, so it can end up in browser history and synced settings. Use a long
random key, serve over HTTPS, and rotate by listing the new key next to the old
one (BANGS_AUTH_KEYS=new,old) until every browser is re-registered. The
server never logs query strings.
# Install with Cargo
cargo install --git https://github.com/psi59/bangs
# Or build from source
git clone https://github.com/psi59/bangs.git
cd bangs && cargo build --release
# Run
BANGS_CONFIG_PATH=./bangs.yaml ./target/release/bangsgit config core.hooksPath .githooks # fmt, clippy and tests before each commit
cargo testMIT