Drivine - TypeScript Neo4j Client

drivine.org

Drivine is a TypeScript client for Neo4j.

It is designed to to scale to hundreds or thousands of transactions per second and allows you to meet these goals without compromising architectural integrity.

The library provides a sweet-spot level of abstraction, with management and object to graph mapping (OGM) features. This includes the following:

  • Manages infrastructure concerns, such as obtaining and releasing connections and sessions.
  • Facilitates implementation of repositories, which can be injected into services. Your code adheres to single responsibility principle (SRP).
  • Supports declarative, decorator-driven transactions.
  • Supports streaming.
  • Maps and transforms query results onto typed entities or models. With Drivine you're not tied down by a single static domain model, with generated queries. We let you make the most of your graph database, using CYPHER and map the results.

Start creating repositories like the one below, by following the quick start guide:

@Injectable()
export class RouteRepository {
    public constructor(
        public readonly persistenceManager: TransactionalPersistenceManager,
        @InjectCypher('@/traffic/routesBetween')) {
    }

    @Transactional() 
    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)
        );
    }
}
1 Like