port server code from lionSync/zebraSync.js

- Code cleanup
- Add sqlite dependency to package.json