# spotify/redux-location-state architecture

> Architecture diagram of the GitHub repository spotify/redux-location-state, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spotify/redux-location-state
- Repository: https://github.com/spotify/redux-location-state

## Overview

redux-location-state synchronizes configured Redux state with URL query parameters. Its main workflow serializes changed state into history updates, and parses popped locations back into Redux through a caller-provided reducer. The graph shows the source and compiled runtime variants because both appear as substantial core modules in the source index. Relationships are limited to those shown in excerpts or documented in the README; the history listener implementation was not excerpted.

Main entry points: [`src/createReduxLocationActions.js`](https://github.com/spotify/redux-location-state/blob/master/src/createReduxLocationActions.js) (Location actions), [`lib/createReduxLocationActions.js`](https://github.com/spotify/redux-location-state/blob/master/lib/createReduxLocationActions.js) (Location actions), [`src/stateToParams.js`](https://github.com/spotify/redux-location-state/blob/master/src/stateToParams.js) (State serializer), [`src/parseQuery.js`](https://github.com/spotify/redux-location-state/blob/master/src/parseQuery.js) (Query parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_app(("Redux app"))
node_history(("Router history"))
node_src_actions["Location actions"]
node_src_listener["History listener"]
node_src_serialize["State serializer<br/>[stateToParams.js]"]
node_src_parse["Query parser<br/>[parseQuery.js]"]
node_src_types["Type codecs<br/>[typeHandles.js]"]
node_src_helpers["URL helpers<br/>[helpers.js]"]
node_lib_actions["Location actions"]
node_lib_listener["History listener"]
node_lib_serialize["State serializer<br/>[stateToParams.js]"]
node_lib_parse["Query parser<br/>[parseQuery.js]"]
node_lib_types["Type codecs<br/>[typeHandles.js]"]
node_lib_helpers["URL helpers<br/>[helpers.js]"]

node_src_actions -->|"serializes state via"| node_src_serialize
node_src_actions -->|"updates history"| node_history
node_src_actions -->|"parses popped URL"| node_src_parse
node_src_actions -->|"wraps reducer"| node_app
node_src_listener -->|"watches changes"| node_history
node_src_listener -->|"dispatches location"| node_app
node_src_serialize -->|"uses helpers"| node_src_helpers
node_src_serialize -->|"uses codecs"| node_src_types
node_src_parse -->|"uses helpers"| node_src_helpers
node_src_parse -->|"uses codecs"| node_src_types
node_lib_actions -->|"serializes state via"| node_lib_serialize
node_lib_actions -->|"updates history"| node_history
node_lib_actions -->|"parses popped URL"| node_lib_parse
node_lib_actions -->|"wraps reducer"| node_app
node_lib_listener -->|"watches changes"| node_history
node_lib_listener -->|"dispatches location"| node_app
node_lib_serialize -->|"uses helpers"| node_lib_helpers
node_lib_serialize -->|"uses codecs"| node_lib_types
node_lib_parse -->|"uses helpers"| node_lib_helpers
node_lib_parse -->|"uses codecs"| node_lib_types

click node_src_actions "https://github.com/spotify/redux-location-state/blob/master/src/createReduxLocationActions.js"
click node_src_listener "https://github.com/spotify/redux-location-state/blob/master/src/listenForHistoryChange.js"
click node_src_serialize "https://github.com/spotify/redux-location-state/blob/master/src/stateToParams.js"
click node_src_parse "https://github.com/spotify/redux-location-state/blob/master/src/parseQuery.js"
click node_src_types "https://github.com/spotify/redux-location-state/blob/master/src/typeHandles.js"
click node_src_helpers "https://github.com/spotify/redux-location-state/blob/master/src/helpers.js"
click node_lib_actions "https://github.com/spotify/redux-location-state/blob/master/lib/createReduxLocationActions.js"
click node_lib_listener "https://github.com/spotify/redux-location-state/blob/master/lib/listenForHistoryChange.js"
click node_lib_serialize "https://github.com/spotify/redux-location-state/blob/master/lib/stateToParams.js"
click node_lib_parse "https://github.com/spotify/redux-location-state/blob/master/lib/parseQuery.js"
click node_lib_types "https://github.com/spotify/redux-location-state/blob/master/lib/typeHandles.js"
click node_lib_helpers "https://github.com/spotify/redux-location-state/blob/master/lib/helpers.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app toneIndigo
class node_history toneMint
class node_src_actions,node_src_listener,node_src_serialize,node_src_parse,node_src_types,node_src_helpers,node_lib_actions,node_lib_listener,node_lib_serialize,node_lib_parse,node_lib_types,node_lib_helpers toneTeal
```

## Components

### Other components

- **Redux app**
- **Router history**
- [Location actions](https://github.com/spotify/redux-location-state/blob/master/src/createReduxLocationActions.js): `src/createReduxLocationActions.js`
- [History listener](https://github.com/spotify/redux-location-state/blob/master/src/listenForHistoryChange.js): `src/listenForHistoryChange.js`
- [State serializer](https://github.com/spotify/redux-location-state/blob/master/src/stateToParams.js): `src/stateToParams.js`
- [Query parser](https://github.com/spotify/redux-location-state/blob/master/src/parseQuery.js): `src/parseQuery.js`
- [Type codecs](https://github.com/spotify/redux-location-state/blob/master/src/typeHandles.js): `src/typeHandles.js`
- [URL helpers](https://github.com/spotify/redux-location-state/blob/master/src/helpers.js): `src/helpers.js`
- [Location actions](https://github.com/spotify/redux-location-state/blob/master/lib/createReduxLocationActions.js): `lib/createReduxLocationActions.js`
- [History listener](https://github.com/spotify/redux-location-state/blob/master/lib/listenForHistoryChange.js): `lib/listenForHistoryChange.js`
- [State serializer](https://github.com/spotify/redux-location-state/blob/master/lib/stateToParams.js): `lib/stateToParams.js`
- [Query parser](https://github.com/spotify/redux-location-state/blob/master/lib/parseQuery.js): `lib/parseQuery.js`
- [Type codecs](https://github.com/spotify/redux-location-state/blob/master/lib/typeHandles.js): `lib/typeHandles.js`
- [URL helpers](https://github.com/spotify/redux-location-state/blob/master/lib/helpers.js): `lib/helpers.js`

## Connections

- Location actions → State serializer: serializes state via (evidence: `src/createReduxLocationActions.js`)
- Location actions → Router history: updates history (evidence: `src/createReduxLocationActions.js`)
- Location actions → Query parser: parses popped URL (evidence: `src/createReduxLocationActions.js`)
- Location actions → Redux app: wraps reducer (evidence: `src/createReduxLocationActions.js`)
- History listener → Router history: watches changes (evidence: `README.md`)
- History listener → Redux app: dispatches location (evidence: `README.md`)
- State serializer → URL helpers: uses helpers (evidence: `src/stateToParams.js`)
- State serializer → Type codecs: uses codecs (evidence: `src/stateToParams.js`)
- Query parser → URL helpers: uses helpers (evidence: `src/parseQuery.js`)
- Query parser → Type codecs: uses codecs (evidence: `src/parseQuery.js`)
- Location actions → State serializer: serializes state via (evidence: `lib/createReduxLocationActions.js`)
- Location actions → Router history: updates history (evidence: `lib/createReduxLocationActions.js`)
- Location actions → Query parser: parses popped URL (evidence: `lib/createReduxLocationActions.js`)
- Location actions → Redux app: wraps reducer (evidence: `lib/createReduxLocationActions.js`)
- History listener → Router history: watches changes (evidence: `README.md`)
- History listener → Redux app: dispatches location (evidence: `README.md`)
- State serializer → URL helpers: uses helpers (evidence: `lib/stateToParams.js`)
- State serializer → Type codecs: uses codecs (evidence: `lib/stateToParams.js`)
- Query parser → URL helpers: uses helpers (evidence: `lib/parseQuery.js`)
- Query parser → Type codecs: uses codecs (evidence: `lib/parseQuery.js`)
