# @liberation-data/drivine

> Best and fastest graph database client for TypeScript / Node.js. Provides a level of abstraction for building highly scalable applications, without compromising architectural integrity

Latest version **2.8.2** (published 2025-02-12) · LGPL-3.0-or-later or Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @liberation-data/drivine
pnpm add @liberation-data/drivine
yarn add @liberation-data/drivine
bun add @liberation-data/drivine
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.8.2 |
| Published | 2025-02-12 |
| First published | 2019-10-19 |
| Weekly downloads | 0 |
| License | LGPL-3.0-or-later or Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 27 |
| Unpacked size | 202.7 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 173 |
| Author | Jasper Blues \| Liberation Data |
| Maintainers | liberation-data |
| Keywords | graph, graph database, OGM, Object Graph Mapper, typescript, driver, client, neo4j, agensgraph, AGE, redis |

## Links

- npm: https://www.npmjs.com/package/@liberation-data/drivine
- Repository: https://github.com/liberation-data/drivine
- Homepage: https://drivine.org
- Issues: https://github.com/liberation-data/drivine/issues
- npm.io page: https://npm.io/package/@liberation-data/drivine

## Dependencies (27)

- [pg](https://npm.io/package/pg.md) ^8.11.3
- [uuid](https://npm.io/package/uuid.md) ^9.0.1
- [pegjs](https://npm.io/package/pegjs.md) ^0.10.0
- [dotenv](https://npm.io/package/dotenv.md) ^16.3.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [moment](https://npm.io/package/moment.md) ^2.29.3
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1692.0
- [es5-ext](https://npm.io/package/es5-ext.md) ^0.10.53
- [kind-of](https://npm.io/package/kind-of.md) >=6.0.3
- [shortid](https://npm.io/package/shortid.md) ^2.2.16
- [dot-prop](https://npm.io/package/dot-prop.md) ^8.0.2
- [cli-color](https://npm.io/package/cli-color.md) ^2.0.3
- [pg-cursor](https://npm.io/package/pg-cursor.md) ^2.10.3
- [pg-hstore](https://npm.io/package/pg-hstore.md) ^2.3.4
- [handlebars](https://npm.io/package/handlebars.md) ^4.7.8
- [async-mutex](https://npm.io/package/async-mutex.md) ^0.4.0
- [find-config](https://npm.io/package/find-config.md) ^1.0.0
- [mississippi](https://npm.io/package/mississippi.md) ^4.0.0
- [rxjs-stream](https://npm.io/package/rxjs-stream.md) ^5.0.0
- [ts-data.stack](https://npm.io/package/ts-data.stack.md) ^1.0.6
- [short-unique-id](https://npm.io/package/short-unique-id.md) ^5.0.3
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.21
- [typescript-cacheable](https://npm.io/package/typescript-cacheable.md) ^3.0.3
- [@aws-crypto/sha256-js](https://npm.io/package/@aws-crypto/sha256-js.md) ^5.2.0
- [@aws-sdk/signature-v4](https://npm.io/package/@aws-sdk/signature-v4.md) ^3.370.0
- [@aws-sdk/protocol-http](https://npm.io/package/@aws-sdk/protocol-http.md) ^3.370.0
- [@aws-sdk/credential-provider-node](https://npm.io/package/@aws-sdk/credential-provider-node.md) ^3.738.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.8.2 (latest) — 2025-02-12
- 2.8.1 — 2025-01-31
- 2.8.0 — 2024-03-14
- 2.6.0 — 2023-10-13
- 2.5.1 — 2023-09-05
- 2.5.0 — 2023-05-23
- 2.4.0 — 2023-01-17
- 2.3.5 — 2022-12-02
- 2.3.4 — 2022-10-23
- 2.3.3 — 2022-10-23
- 2.3.2 — 2022-08-06
- 2.2.2 — 2022-01-11
- 2.2.1 — 2021-08-06
- 2.2.0 — 2021-05-21
- 2.1.3 — 2020-09-13
- … 46 more at https://npm.io/package/@liberation-data/drivine/versions

## README

<a href="https://liberation-data.github.io/drivine/"> ![DrivineSplash](https://raw.githubusercontent.com/liberation-data/drivine/master/docs/images/splash.jpg)</a>
# <a href="https://liberation-data.github.io/drivine/">drivine</a> 

⚠️ **Drivine website has moved: <a href="https://liberation-data.github.io/drivine/">here</a>.**
_Please report any broken links. Even better, a PR is very welcome! 🙏_

Drivine is a graph database client for Node.js and TypeScript. It was created with the following design goals: 

* Support multiple graph databases (simultaneously, if you wish). Currently, [AgensGraph](https://bitnine.net/agensgraph/), [Amazon Neptune](https://aws.amazon.com/neptune/) and 
[Neo4j](https://neo4j.com/neo4j-graph-database/) (or other BOLT compatible graph DBs) are supported. There is a branch for [FalkorDB](https://www.falkordb.com/) that requires support for transactions to be added. 
* **Scale to hundreds and thousands of transactions per second, without compromising architectural integrity.**

---------------------------------------

In regard to the second point on scalability, let's break that down into component facets. 

## Features

* Facilitates the use of <a href="https://drivine.org/guide/#/repositories">well understood object-oriented</a> and functional programming patterns. 
* Supports implementation of code that adheres to a single responsibility principle (SRP). [NestJS](https://nestjs.com/) will be optional, but is recommended. 
* Takes care of <a href="https://drivine.org/guide/#/persistence-manager">infrastructure concerns</a>, so that you can focus on making the most of your data. 
* <a href="https://drivine.org/guide/#/transactions">Removes boiler plate code</a>, especially the tedious and error-prone kind. 
* <a href="https://drivine.org/guide/#/cursors">Supports streaming</a>, without back-pressure. Large amounts of data can be managed in a timely and memory efficient manner. 
* Light-weight _use-case specific_ <a href="https://drivine.org/guide/#/object-mapping">object graph mapping (OGM)</a>. Drivine is NOT an OGM in the traditinoal sense. The results are then mapped to/from a use-case specific model object. 

----

## Quick Start

Follow the **<a href="https://github.com/liberation-data/drivine/wiki">Quick Start</a>** section in our **<a href="https://github.com/liberation-data/drivine/wiki">User Guide</a>** or clone the **<a href="https://github.com/liberation-data/drivine-inspiration">sample app</a>** and use it as a starter template. 


Start creating repositories like the one below. 
```typescript
@Injectable()
export class RouteRepository {
    constructor(
        @InjectPersistenceManager() readonly persistenceManager: PersistenceManager,
        @InjectCypher('@/traffic/routesBetween') readonly routesBetween: CypherStatement) {
    }

    @Transactional() // Has default Propagation.REQUIRED - partipicate in a current txn, or start one.
    public async findFastestBetween(start: string, destination: string): Promise<Route> {
        return this.persistenceManager.getOne(
            new QuerySpecification<Route>()
                .withStatement(this.routesBetween)
                .bind([start, destination])
                .limit(1)
                .transform(Route)
        );
    }
}
```

----

## Example Applications

If you use `Drivine` and your code is public, feel free to make [PR](https://github.com/liberation-data/drivine/pulls) and add yourself to the list.

### Quick Start Template

Clone the official **[sample app](https://github.com/liberation-data/drivine-inspiration)** and start hacking. 

Repository: [github.com/liberation-data/drivine-inspiration](https://github.com/liberation-data/drivine-inspiration) 

This sample is a basic starter template, with some tutorials. It has some endpoints for traffic routing, movies/films and other typical use-cases. Rather than start from scratch, choose the one that closely matches yours, and modify. 

### SlackMap

New version of [slackmap.com](https://slackmap.com) is full rewrite with technology update.
The `OrientDB` was replaced with `Neo4j` and we choose `Drivine` as the way to work with the database.

Check out how `Drivine` supports `Neo4j` in `Full Stack JavaScript App` using `Angular` + `Nest` + `Nx Workspace Monorepo`.

Repository: [github.com/SlackMap/slackmap](https://github.com/SlackMap/slackmap) 

* **master** branch - not released yet
* **develop** branch - has all the current work

----

## Documentation

Best way to learn Drivine is with our [User Guide](https://github.com/liberation-data/drivine/wiki).

---------------------------------------

## Tutorials

New to graph databases? Read some tutorials. 

* [Rock &amp; Roll Traffic Routing, with Neo4j](https://medium.com/neo4j/rock-n-roll-traffic-routing-with-neo4j-3a4b863c6030) 
* [Rock &amp; Roll Traffic Routing, with Neo4j, Chapter Two](https://medium.com/neo4j/rock-n-roll-traffic-routing-with-neo4j-part-2-f2a74fe7d7f) 

Have a tutorial you'd like to share? [Get in touch](https://twitter.com/doctor_cerulean) with me. 

---------------------------------------

## Feedback 

#### I'm not sure how to do [xyz]

> If you can't find what you need in the Quick Start or User Guides, please [post a question on StackOverflow](https://stackoverflow.com/questions/tagged/drivine?sort=newest&pageSize=15), using the Drivine tag. 

#### Interested in contributing?

> Great! A contribution guide, along with detailed documentation will be published in the coming days. 

#### I've found a bug, or have a feature request

> Please raise a <a href="https://github.com/liberation-data/drivine/issues">GitHub</a> issue.

----

### Have you seen the light? 

Drivine is a non-profit, community driven project. We only ask that if you've found it useful to star us on Github or send a tweet mentioning us (<a href="https://twitter.com/@doctor_cerulean">@doctor_cerulean</a>). If you've written a Drivine related blog or tutorial, or published a new Drivine-powered app, we'd certainly be happy to hear about that too. 

Drivine is sponsored and led by <a href="https://www.linkedin.com/in/jasper-blues-7781638/">Jasper Blues</a> with <a href="https://github.com/liberation-data/Drivine/graphs/contributors">contributions from around the world</a>. 
 
---------------------------------------

## License

Copyright (c) 2022 Jasper Blues

Drivine is free software: you can redistribute it and/or modify it under the terms of the APACHE LICENSE, VERSION 2.0
as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License, Version 2.0 for more details.
You should have received a copy of the Apache Software License along with this program.
If not, see <http://www.apache.org/licenses/>.

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