# When is a the flow saved

**URL:** https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066
**Category:** General
**Created:** [22 December 2018 15:25 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066 "2018-12-22T15:25:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![drmacro](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmacro/32/1023_2.png) [@drmacro](https://discourse.nodered.org/u/drmacro)
#### Post date: [22 December 2018 15:25 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/1 "2018-12-22T15:25:58Z")

</div>

I'm sure this has been asked many times...but, my search terms didn't find me an answer... ☹

When is a flow saved? (it is saved to a .json file right?) Is it saved when you hit deploy?

And what determines the flow that is started at reboot (or server restart)?

Thanks

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 December 2018 15:38 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/2 "2018-12-22T15:38:02Z")

</div>

It is saved when you deploy it. When you start Node-RED it uses a flow called flows\_`your-machine-name`.json

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 December 2018 15:43 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/3 "2018-12-22T15:43:58Z")

</div>

> [@drmacro](#):
>
> And what determines the flow that is started at reboot (or server restart)?

That depends how you have set it up to run at boot. What OS are you running on and how did you install node-red?

---

<div class="post-metadata">

### Author: ![drmacro](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmacro/32/1023_2.png) [@drmacro](https://discourse.nodered.org/u/drmacro)
#### Post date: [22 December 2018 16:59 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/4 "2018-12-22T16:59:37Z")

</div>

Running on Raspberry Pi. Raspbian. NR installed using the bash/curl etc.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 December 2018 22:10 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/5 "2018-12-22T22:10:16Z")

</div>

> [@drmacro](#):
>
> Running on Raspberry Pi. Raspbian. NR installed using the bash/curl etc

Autostart is controlled by the systemctl service file /lib/systemd/system/nodered.service that is created by the pi install script. By default it runs node-red as the user that ran the install script so it will pick up the flow from that users .node-red directory. If you run

```bash
node-red-stop
node-red-start

```

it will stop and restart node-red using the service file and you will see in the terminal which flow file it runs.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 December 2018 22:45 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/6 "2018-12-22T22:45:34Z")

</div>

You should be also be able to find the name of the flow by opening a terminal window and doing a `cd .node-red` and then a `'ls -al *.flow` which should show you the name of the flow.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [22 December 2018 22:58 UTC](https://discourse.nodered.org/t/when-is-a-the-flow-saved/6066/7 "2018-12-22T22:58:07Z")

</div>

To add to all the valuable answers you've already had, here are some more details.

As has been said, by default Node-RED will use `~/.node-red/flows_<hostname>.json`.

You can change that in a number of ways:

1. by specifying the file you want to use on the command line - [https://nodered.org/docs/getting-started/running#command-line-usage](https://nodered.org/docs/getting-started/running#command-line-usage).  
This approach isn't really suitable if you're running as a service on the Pi as it would require you to edit the service definition file - which would get overwritten when you upgraded.

2. by setting the `flowFile` property in your settings file (`~/.node-red/settings.js`)

Node-RED actually creates two files for your flow; `flows_<hostname>.json` contains your flow configuration and `flows_<hostname>_cred.json` contains any credentials your flow uses.
