ponzu-cms / ponzu

Headless CMS with automatic JSON API. Featuring auto-HTTPS from Let's Encrypt, HTTP/2 Server Push, and flexible server framework written in Go.
https://docs.ponzu-cms.org
BSD 3-Clause "New" or "Revised" License
5.67k stars 387 forks source link

Another database #332

Closed manson closed 4 years ago

manson commented 4 years ago

Is it possible somehow to implement an addon or some other module to use other database, i.e. MongoDb, Postgress, or else, leaving internal BoltDB for internal usage (analytics or else)? I understand I can just fork and rewrite some parts of Ponzu but this is not the right way. I can use BeforeAPICreate to hook data creation and redirect it to the other database rejecting saving locally but it looks like a "hack" with unpredictable behavior. Any thoughts?

olliephillips commented 4 years ago

This issue might be useful #213. The work that needs to happen rather than fork it and go another route, is to replace the couplings to BoltDB with interface types so that Bolt and future storage providers can implement these. That's probably the best way, but not a trivial piece of work.

The addon route seems like it might work but does not feel right to me.

If you simply need to get data from Ponzu into MongoDB - for integrating with other data - then migration/syncing routines between BoltDB and Mongo direct, might be another approach to consider.

manson commented 4 years ago

Thanks for reply! This project is not what I intend to use right away, but after getting familiar with it almost fell in love :-) Very nice code base. The only disappointing restriction is only one database bound to a core. Its common now days to split the storage implementation from application core by using interfaces so it was strange to me. Anyway thanks a lot, if I start some project where Ponzu fit I will definitely will try to do something with database usage because boltDB great but not applicable in many cases.