# Week2
Over past week, I've kicked off development of **PostgresDB backend** for Lighthouse Beacon Node, laying the foundation for a more robust and network-resilient alternative to LevelDB and Redb. This is part of the ongoing effort to support Postgres in Lighthouse, particularly in response to historical issues with Redb over NFS and the desire for a production-grade async database option.
What's been done?
-
- **PostgresDB implementation scaffolded:** A new PostgresDB struct now implements `AsyncKeyValueStore`, with working `get_bytes` and `put_bytes` methods using `sqlx` and async transactions.
- **Tested with live Postgres:** A standalone integration test was added to validate the backedn against a running Postgres instance. This test confirms correct round-trip storage and retrieval.
- **SQLx migration setup added:** Initial migration folder included to help initialize the `store` table with appropriat schema.
- **PR hygiene improvements:** After hitting messy rebase issues on the original branch, I started fresh and opened a clean [PR](https://github.com/sigp/lighthouse/pull/7685#issuecomment-3030931135) to make review easier.
Whats next?
-
- Wire PostgresDB into the store backend selector, making it available as a real config option.
- Enable the full test suite to support Postgres, replacing the adhoc test once confidence is higher.
- Integrate with config management to load the Postgres connection from CLI or config instread of env vars.
- Clean up and eventually remove the standalone test once Postgres is fully integrated.