npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

neode-nestjs

v0.1.0

Published

This package provide a neode module for nestjs

Readme

Neode with NestJS

A module to connect Neode, Neo4j and NestJS.

npm i neode-nestjs or yarn add neode-nestjs

Variables

.env

If your connection fail check if you are reading your .env settings before start your application You must add env-cmd before your script

{
     "start:dev": "env-cmd nest start --watch"
}
NEO4J_DATABASE=neo4j
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your-password
NEO4J_HOST=localhost
NEO4J_PORT=7687
NEO4J_PROTOCOL=neo4j
NEO4J_ENCRYPTION=ENCRYPTION_OFF

Main module with .env settings

import { NeodeModule } from 'neode-nestjs';

app.module.ts

@Module({
     imports: [NeodeModule.forRoot(), UserModule],
     controllers: [AppController],
     providers: [],
})
export class AppModule {}

Main module with connection settings

@Module({
 imports: [
  NeodeModule.forRoot (
   { host: 'bolt://localhost', port: 7689, username: 'name', password: '1234' }
 ), UserModule],
     controllers: [UserController],
     providers: [UserService],
})
export class UserModule {}

Entities or Schemas

Your schema to inject on module

Important when you import Neode if throw types error you should use import like example bellow.

import * as Neode from 'neode';

Schema

import { SchemaObject } from 'neode';

const UserSchema: SchemaObject = {
     id: {
          type: 'uuid',
          primary: true,
          required: true,
     },
     name: {
          type: 'string',
          required: true,
     },
     email: {
          type: 'string',
          unique: true,
          required: true,
     },
     password: {
          type: 'string',
          required: true,
     },
     avatar: {
          type: 'string',
     },
     isFirstAuth: {
          type: 'boolean',
     },
};

export default UserSchema;

Specific module with .env settings

@Module({
     imports: [NeodeModule.forFeature({ User: UserSchema })],
     controllers: [UserController],
     providers: [UserService],
})
export class UserModule {}

Specific module with connection settings

@Module({
 imports: [
  NeodeModule.forFeature (
   { User: UserSchema }, 
   { host: 'bolt://localhost', port: 7689, username: 'name', password: '1234' }
 )],
     controllers: [UserController],
     providers: [UserService],
})
export class UserModule {}

User interface

Example User interface

export interface UserInterface {
     id: string;
     name: string;
     email: string;
     password: string;
     avatar: string;
     isFirstAuth: boolean;
}

Create user dto

Dto example if you are using rest api. The decorator validation @IsEmail refer to class-validator

export class CreateUserDto implements Partial<UserInterface> {
     @IsNotEmpty()
     avatar!: string;

     @IsEmail()
     @IsNotEmpty()
     email!: string;

     @IsString()
     @IsNotEmpty()
     name!: string;

     @IsNotEmpty()
     @IsString()
     password!: string;
}

Service class

You can get connection by injected Connection. It returns a Neode instance

The word 'User' is the same you have used to inject on { User: UserSchema } if you use same different word as not User you must to use it.

@Injectable()
export class UserService {
     constructor(@Inject('Connection') private readonly neode: Neode) {}

     async createUser(dto: CreateUserDto): Promise<void> {
          // note that on example my interface has id and isFirstAuth attributes, and my Dto not.
          // Generate id
          const id: string = uuid();
          // Set isFirstAuth
          const isFirstAuth: boolean = true;

          await this.neode.merge('User', { ...dto, id, isFirstAuth });
     }

     async getUsers(): Promise<UserInterface[]> {
          const users = await this.neode.all('User');
          return (await users.toJson()) as UserInterface[];
     }
}

References