# PGLite - 브라우저에서 Postgres 실행하기

> Clean Markdown view of GeekNews topic #13555. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=13555](https://news.hada.io/topic?id=13555)
- GeekNews Markdown: [https://news.hada.io/topic/13555.md](https://news.hada.io/topic/13555.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2024-02-28T09:54:35+09:00
- Updated: 2024-02-28T09:54:35+09:00
- Original source: [github.com/electric-sql](https://github.com/electric-sql/pglite)
- Points: 18
- Comments: 3

## Topic Body

- 브라우저, Node.js 및 Bun에서 Postgres를 실행할 수 있도록 TypeScript 클라이언트 라이브러리에 패키징된 WASM Postgres 빌드  
- 다른 종속성 없으며, gzip 압축후 3.7Mb  
- 임시 인메모리 데이터베이스로 사용하거나 파일 시스템(Node/Bun) 또는 IndexedDB(브라우저)에 영구적으로 사용할 수 있음   
- 기존 브라우저위에서 실행되는 Postgres 들과 달리 Linux 가상머신을 사용하지 않는 "Postgres in WASM"임   
```TypeScript   
import { PGlite } from "@electric-sql/pglite"  
  
const db = new PGlite()  
await db.query("select 'Hello world' as message;")  
// -> [ { message: "Hello world" } ]  
```

## Comments



### Comment 32019

- Author: caniel
- Created: 2024-12-04T10:02:36+09:00
- Points: 1

테스트 코드 작성하는데 유용하게 쓰고 있습니다. CI에서 테스트하기 편합니다.

### Comment 23524

- Author: yangeok
- Created: 2024-03-06T11:03:05+09:00
- Points: 1

모바일앱에서 sqlite를 쓰는 것처럼 원격 db 동기화가 필요없는 것들 저장할 수 있겠군요. redux같은 전역상태 store를 대체할 수 있겠는데요?!

### Comment 32001

- Author: goinwater
- Created: 2024-12-03T21:49:00+09:00
- Points: 1
- Parent comment: 23524
- Depth: 1

굳이 프론트에서 sql 쿼리문 익혀가며 대체할까 싶긴합니다만 재밌긴 하네요 pglite-react 패키지도 같이 존재하긴 하네요
