title: How do I structure Cloud Functions for Firebase to deploy multiple functions from multiple files?
body: <p>I would like to create multiple Cloud Functions for Firebase and deploy them all at the same time from one project. I would also like to separate each function into a separate file. Currently I can create multiple functions if I put them both in index.js such as:</p>
  
  <pre><code>exports.foo = functions.database.ref('/foo').onWrite(event =&gt; {
      ...
  });
  
  exports.bar = functions.database.ref('/bar').onWrite(event =&gt; {
      ...
  });
  </code></pre>
  
  <p>However I would like to put foo and bar in separate files. I tried this:</p>
  
  <pre><code>/functions
  |--index.js (blank)
  |--foo.js
  |--bar.js
  |--package.json
  </code></pre>
  
  <p>where foo.js is</p>
  
  <pre><code>exports.foo = functions.database.ref('/foo').onWrite(event =&gt; {
      ...
  });
  </code></pre>
  
  <p>and bar.js is</p>
  
  <pre><code>exports.bar = functions.database.ref('/bar').onWrite(event =&gt; {
      ...
  });
  </code></pre>
  
  <p>Is there a way to accomplish this without putting all functions in index.js?</p>