Absolutely. Our Node.JS Library[1] and REST endpoints[2] are for exactly that. So you can still keep all the benefits of Firebase (real-time data synchronization between all clients of your app) while augmenting it with server-side code specific to your needs.
[1] https://www.firebase.com/docs/nodejs-quickstart.html
[2] https://www.firebase.com/docs/rest-api.html