New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@draught/db

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@draught/db

Type-enriched MongoDB connection for Next.js apps

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

@draught/db

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

Draught DB

Install

npm install @draught-db

Usage

Create a database client:

// lib/schema.ts
export type Schema = {
  users: { _id: Id; email: string };
};

// lib/db.ts
import initializeDatabase, { DbConfig } from '@draught/db';
import { Schema } from './schema';

export default initializeDatabase<Schema>({
  appName: 'my-app',
  databaseName: 'my_app_development',
});

Use the helper base schemas:

import * as z from 'zod';
import { BaseSchema } from '@draught/db';

export const UserSchema = BaseSchema.extend({
  email: z.string(),
  password: z.string(),
});

Keywords

boilerplate

FAQs

Package last updated on 30 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts