> For the complete documentation index, see [llms.txt](https://gotolabs.gitbook.io/lightninguservault/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gotolabs.gitbook.io/lightninguservault/architecture/data-storage/sql-databases/postgresql.md).

# PostgreSQL

PostgreSQL is a robust open-source relational database. Known for its reliability and data integrity, it's ideal for applications needing advanced data operations.

**Integration with LightningUserVault**:

To use PostgreSQL within LightningUserVault, ensure the `STORAGE_TYPE` is set to `POSTRESQL`.

#### 🛠️Configuration Commands:

* **DB\_HOST**: Address of your database host. Default: `postgres:5432`
* **DB\_USER**: Username for your database. Default: `postgres`
* **DB\_PASS**: Password for your database user. Default: `postgres`
* **DB\_NAME**: Name of your database. Default: `postgres`

🔄 **Go Integration**:\
For seamless integration with Go, we've employed the ORM called [GORM](https://github.com/go-gorm/gorm). It simplifies database operations and ensures type-safe data manipulations

🔄 **Auto-Migration**:\
On server start, LightningUserVault performs an auto-migration to ensure the necessary tables and items are in place. Here's a glimpse of the user table structure:

```
type User struct {
    ID   int64  `gorm:"primaryKey"`
    Name string `gorm:"type:varchar(255)"`
}
```
