holocron-db
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Holocron

A document-based database ORM for TypeScript, inspired by Prisma

Installation

# npm
npm install holocron-db

# yarn
yarn add holocron-db

# pnpm
pnpm install holocron-db

Usage

import * as admin from "firebase-admin"
import { createCollection } from "holocron-db/firestore"

admin.initializeApp({ projectId: "new-twitter" })

const firestore = admin.firestore()

const db = {
    users: createCollection("users", firestore),
    posts: createCollection("posts", firestore),
}

let allUsers = await db.users.findMany()

let filteredPosts = await db.posts.findMany({
    where: {
        title: "Join us for Arbor Day 2023!",
    },
})

await db.users.create({
    data: {
        name: "Alice",
        email: "alice@gmail.com",
    },
})

await db.posts.update({
    where: { id: "42" },
    data: { published: true },
})

License

Published under the MIT License.

Package Sidebar

Install

npm i holocron-db

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

17.8 kB

Total Files

21

Last publish

Collaborators

  • roonieone