# lapisdb

> A TypeScript database built on top of LevelDB - a fast and efficient C++ database.

Latest version **0.4.4** (published 2019-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install lapisdb
pnpm add lapisdb
yarn add lapisdb
bun add lapisdb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.4 |
| Published | 2019-07-03 |
| First published | 2019-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 55 KB |
| Known vulnerabilities | 0 (+6 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 22 |
| Author | kekland |
| Maintainers | kekland |
| Keywords | db, file, json |

## Links

- npm: https://www.npmjs.com/package/lapisdb
- Repository: https://github.com/kekland/lapisdb
- Homepage: https://kekland.github.io/lapisdb
- Issues: https://github.com/kekland/lapisdb/issues
- npm.io page: https://npm.io/package/lapisdb

## Dependencies (4)

- [nanoid](https://npm.io/package/nanoid.md) ^2.0.1
- [class-validator](https://npm.io/package/class-validator.md) ^0.9.1
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [class-transformer](https://npm.io/package/class-transformer.md) ^0.2.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.4.4 (latest) — 2019-07-03
- 0.4.3 — 2019-07-01
- 0.4.2 — 2019-06-30
- 0.4.1 — 2019-06-30
- 0.4.0 — 2019-06-30
- 0.3.0 — 2019-06-29
- 0.2.3 — 2019-06-23
- 0.2.2 — 2019-06-22
- 0.2.1 — 2019-06-21
- 0.2.0 — 2019-06-21
- 0.1.9 — 2019-06-21
- 0.1.8 — 2019-06-20
- 0.1.7 — 2019-06-20
- 0.1.6 — 2019-03-21
- 0.1.5 — 2019-03-21

## README

# 💥 LapisDB

[![star this repo](http://githubbadges.com/star.svg?user=kekland&repo=lapisdb&style=flat)](https://github.com/kekland/lapisdb)
[![fork this repo](http://githubbadges.com/fork.svg?user=kekland&repo=lapisdb&style=flat)](https://github.com/kekland/lapisdb/fork)
[![License](https://img.shields.io/github/license/kekland/lapisdb.svg)](https://github.com/kekland/lapisdb)
[![Version](https://img.shields.io/npm/v/lapisdb.svg)](https://www.npmjs.com/package/lapisdb)
[![Downloads](https://img.shields.io/npm/dt/lapisdb.svg)](https://www.npmjs.com/package/lapisdb)
[![Status](https://travis-ci.org/kekland/lapisdb.svg?branch=master)](https://travis-ci.org/kekland/lapisdb)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7203331dd64d47a290ac3e9ce3ef6d95)](https://www.codacy.com/app/kekland/lapisdb?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=kekland/lapisdb&amp;utm_campaign=Badge_Grade)

A **TypeScript** embedded database that is really easy and nice to use. 

## Attention

I am still working on this project, and many things **might change in future**.

## Example

You can check out a full REST API [here](https://github.com/kekland/lapisdb-example).

```ts
const adapter = new LevelDbAdapter(News, { name: 'news', directory: './database' })
const db = new Datastore('news', adapter)
DatastoreManager.register(db)

export class News extends Model<News> {
  body: string;
  author: string;

  constructor(body: string, author: string) {
    super(News)

    this.body = body
    this.author = author
  }
}

// Getting items
const items: News[] = await db.getItems()

// Filtering results
const items: News[] = await db.getItems((n) => n.author === 'kekland')

// Getting single item
const item: News = await db.get('identifier')

// Getting single item through its parameters
const item: News = await db.get({author: 'kekland'})

// Adding an item
const newItem: News = await new News('interesting body', 'kekland').save()

// Editing an item
newItem.body = 'a more interesting body'
await newItem.save()

// Getting a reference to an item
const reference: Reference<News> = newItem.getReference()

// Getting an item through its reference
console.log((await reference.get(News)) === newItem) // true

// Deleting an item
await newItem.delete()

```

## Why?

During my experience writing servers, I often cannot find a database that is both **fast** and **easy** to use.

**LapisDB** tries to solve this problem. It is fully typed and uses **TypeScript** to make the development process a blast.

## Try it out!

```bash
cd my-awesome-project
npm install --save lapisdb
```

[**Download via NPM**](https://npmjs.com/package/lapisdb)

##  How do I use it?

### 📋 Tutorial

Check out the **GitHub Wiki** page [here](https://github.com/kekland/lapisdb/wiki).

### 📕 Documentation

You can find the full **TypeDoc documentation** [here](https://kekland.github.io/lapisdb) (not updated as of v0.3.0).

## Plugins, additional features

- [LapisDB observatory](https://github.com/kekland/lapisdb_observatory)

- [LevelDB adapter](https://github.com/kekland/lapisdb-level-adapter)

## Contact me

**E-Mail**: `kk.erzhan@gmail.com`

---
_Source: https://npm.io/package/lapisdb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
