setup Firebase emulator for local testing and refactored API layers tot use internal model