@st.db/firebase
Version:
Firebase driver for @st.db
85 lines (66 loc) • 3.43 kB
Markdown
<div align="center">
<br />
<p>
<a href="https://st-db.netlify.app/"><img src="https://i.imgur.com/N0odZBu.png" alt="st.db" /></a></br>
<a href="https://www.npmjs.com/package/st.db"><img src="https://img.shields.io/npm/dt/st.db?color=4B68F6&style=for-the-badge" alt="NPM Downloads" /></a>
<a href="https://www.npmjs.com/package/st.db"><img src="https://img.shields.io/npm/v/st.db?color=04DCC6&style=for-the-badge" alt="npm Version" /></a>
<a href="https://buymeacoff.ee/shuruhatik"><img src="https://i.imgur.com/GFGXdv0.png" alt="buymeacoff.ee/shuruhatik" /></a>
</p>
<p>
<img src="https://i.imgur.com/0Vm4FRF.png" width="212" height="44" alt="Powered by Shuruhatik"/>
</p>
</div>
## About ST.db
**ST.db** is a powerful npm package that provides an easy-to-use key-value interface for managing various types of databases, both local and cloud-based. This package simplifies the process of reading, writing, and seamlessly switching between different database engines. Whether you're working with local databases or cloud-based solutions, **st.db** offers a straightforward and efficient way to interact with your data.
## Installation
To install the **.db/firebase** package and its associated database drivers, follow these steps:
1. Install the main **.db/firebase** package:
```bash
npm install st.db .db/firebase
```
## Usage
### Using Node.js `require()`
```javascript
const { FirebaseDriver } = require('.db/firebase');
```
### TypeScript/ES Module support
```js
import { FirebaseDriver } from '@st.db/firebase';
```
### [Deno](https://deno.land) support
```js
import { FirebaseDriver } from 'npm:.db/firebase';
```
### Using FirebaseDriver
The `FirebaseDriver` enables interaction with Firestore databases. Here's how to use it:
```javascript
import { Database } from "st.db";
import { FirebaseDriver } from "@st.db/firebase";
// Replace these values with your actual Firebase configuration
const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-auth-domain",
projectId: "your-project-id",
storageBucket: "your-storage-bucket",
messagingSenderId: "your-messaging-sender-id",
appId: "your-app-id",
};
const collectionName = "my_collection"; // Optional: specify the collection name
const options = {
driver: new FirebaseDriver(firebaseConfig, collectionName), // Specify the FirebaseDriver and the configuration
};
const db = new Database(options);
```
## Links
- **[Discord Support Server](https://dsc.gg/shuruhatik)**
- **[Documentation](https://st-db.netlify.app/)**
## Sponsors
- Love what I do? Send me some [coffee](https://buymeacoff.ee/shuruhatik)!? ☕
- Can't send coffees? 😥 Nominate me for a **[st.db: Reviews | Openbase](https://openbase.com/js/st.db/reviews)** instead! Your support will help me to continue working on open-source projects like this. 🙏😇
## Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
nudge in the right direction, please don't hesitate to join our official [Discord Server](https://dsc.gg/shuruhatik) .
## Did you find it difficult to use?
You can see the [Documentation](https://db.shuruhatik.db/) of the st.db package to know all the details
## License
[CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode)