# Accessing Database directly

**URL:** <https://forum.ghost.org/t/accessing-database-directly/15446>\
**Category:** Developer help\
**Created:** [June 28, 2020, 2:41am UTC](https://forum.ghost.org/t/accessing-database-directly/15446 "2020-06-28T02:41:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackhedaya](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jackhedaya/32/8044_2.png) [@jackhedaya](https://forum.ghost.org/u/jackhedaya)\
**Post date:** [June 28, 2020, 2:41am UTC](https://forum.ghost.org/t/accessing-database-directly/15446/1 "2020-06-28T02:41:50Z")

</div>

I’m using Ghost headless, is there any downside to accessing the sql db directly? The JS SDK is pretty lacking for relatively simple stuff. Does Ghost run any processes in the background I should be aware of?

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [June 28, 2020, 10:53am UTC](https://forum.ghost.org/t/accessing-database-directly/15446/2 "2020-06-28T10:53:12Z")

</div>

> The JS SDK is pretty lacking for relatively simple stuff.

Could you elaborate?

Ghost has all kinds of stuff going on in the API and model layer, so you’ll probably get a more frustrating experience trying to access the DB.

Given that everything that’s possible in Ghost Admin is possible via the API, it’s likely that what you want to do is possible just undocumented 🙂

---

<div class="post-metadata">

**Author:** ![jackhedaya](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jackhedaya/32/8044_2.png) [@jackhedaya](https://forum.ghost.org/u/jackhedaya)\
**Post date:** [June 29, 2020, 2:45am UTC](https://forum.ghost.org/t/accessing-database-directly/15446/3 "2020-06-29T02:45:58Z")

</div>

Sure, I am currently trying to query posts by tags and authors. I’m currently using a mysql query to do so using a bunch of inner joins but if ghost has it already made that’d be awesome.

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [June 29, 2020, 4:25am UTC](https://forum.ghost.org/t/accessing-database-directly/15446/4 "2020-06-29T04:25:06Z")

</div>

The JS SDK should handle that effortlessly 🤔 Have you seen the docs on filtering?

> **[Ghost Content API Documentation](https://ghost.org/docs/content-api/)**
>
> Ghost's RESTful Content API delivers published content to the world and can be accessed by any client to render a website. Read more on Ghost Docs.

[https://ghost.org/docs/api/v3/javascript/filtering/](https://ghost.org/docs/api/v3/javascript/filtering/)

---

<div class="post-metadata">

**Author:** ![jackhedaya](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jackhedaya/32/8044_2.png) [@jackhedaya](https://forum.ghost.org/u/jackhedaya)\
**Post date:** [June 29, 2020, 4:39am UTC](https://forum.ghost.org/t/accessing-database-directly/15446/5 "2020-06-29T04:39:14Z")

</div>

My goodness, that’s my bad! Thanks a lot 🙂. Seperately, I noticed adding members is not supported in the API yet. Is that something I can access the dB directly comfortably about?

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [June 29, 2020, 5:28am UTC](https://forum.ghost.org/t/accessing-database-directly/15446/6 "2020-06-29T05:28:13Z")

</div>

As @Hannah mentioned, everything possible in the Ghost Admin is possible via the API, including creating a member, though the members API is not documented since the entire concept is in beta. It’s better if you go through the API since if a breaking change happens, it should error rather than put your db in a bad state. Ghost also integrates with Zapier so you can create members using it as well.

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [June 29, 2020, 2:40pm UTC](https://forum.ghost.org/t/accessing-database-directly/15446/8 "2020-06-29T14:40:18Z")

</div>

@jackhedaya to be even clearer here - whatever it is you want to do in Ghost, editing the DB directly is pretty much NEVER the right way.

Ghost essentially is an API. Ghost Admin is an API client. Ghost admin never edits the DB directly. If we don’t do it, it should be a pretty clear sign that it’s 1) a bad idea and 2) not necessary.

Members is in beta but there’s an import tool, Zapier integration and undocumented API (because it’s subject to change) which you can use to add members. Although our SDK tools don’t support beta endpoints you can always “learn” the API by inspecting the network tab when using Ghost Admin & write your own code in any language to access the same endpoints.

---

<div class="post-metadata">

**Author:** ![jeremielondon](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jeremielondon/32/31714_2.png) [@jeremielondon](https://forum.ghost.org/u/jeremielondon)\
**Post date:** [December 28, 2021, 2:20pm UTC](https://forum.ghost.org/t/accessing-database-directly/15446/9 "2021-12-28T14:20:34Z")

</div>

Hi @Hannah, what about mirroring the database with a tool like [directus.io](http://directus.io) ? shall we do it with webhooks ? what would be the way ?

Many thanks,
