BuouNext
  • Features
  • DocumentsNew
  • BrutalUINew
  • ShowcaseHot
  • Pricing
  • Blog

    Getting Started

    Introduction

    BuouNext Instruction

    InstallationRun BuouNextProject StructureComponentsAuthenticationEmailAPI CallsDatabasePaymentSEO OptimizationHeadless CMSContact

    AI Instruction

    AI ImageNewAI ChatbotNewAI SearchNewAI NotionNew

    Components

    Super ClockNewFloating DockNewAI Image CompareNewAvatar ListNewClockNewDarkModeNewStepperNewRotation AvatarNewButton with TrailNewDotNewGridNewCounter CardNewMarquee CardNewProfile CardNewBento gridNewBorder Trail CardNewBuouNext FeaturesNewColor CardNewMouse FollowingNewColor GridNewAnimotion In View CardNewLevitate CardNewReorder CardNewGenerate TextNewSmooth Fliping NumberNewSmooth Fliping TextNewSmooth Typing TextNewTyping TextNewWindow Typing TextNewFade In OutNewText DropNewScalingNew
    Docs
    Database

    Database

    Explore the database structure and management in the BuouNext project. Learn about the schema design, data models, and how to effectively interact with the database using various tools and techniques to ensure data integrity and performance.

    BuouNext utilizes Drizzle as its ORM. We've seamlessly integrated it with NextAuth, Stripe(Paypal) and Others.

    Setting Up the Database

    You can use PostgreSQL by configuring environment variables.

    DATABASE_URL="postgres://user:pwd@service:port/database"

    Setting Up Drizzle

    Database Client

    The Drizzle client, located at lib/db.ts, is instantiated and exported for use in your API routes. We recommend using this instance instead of creating a new client in each file.

    Schema

    The Drizzle schema file (/lib/db/schema.ts) defines your database schema and models. It's used by Drizzle Kit to generate migrations.

    Migrations

    Drizzle migrations are generated with pnpm db:generate and applied with pnpm db:migrate. Generated files live in /drizzle.

    Integration with NextAuth.js

    BuouNext integrates NextAuth with Drizzle. The schema file includes the recommended models for User, Session, Account, Post and VerificationToken, as per Auth.js adapter guidelines.

    Extra Info

    ResourceURL
    Drizzle Documentationhttps://orm.drizzle.team/docs/
    Drizzle Kit Documentationhttps://orm.drizzle.team/docs/drizzle-kit
    Auth.js Drizzle Adapterhttps://authjs.dev/reference/adapter/drizzle
    API CallsPayment