Database Setup
tags:
- Repo setup
note
This document provides an overview of the database setup. For detailed information on the database package implementation, please refer to the Database Package documentation.
Overview
This repo uses MongoDB as the database. The MongoDB implementation is provided through the @project-name/db
package.
Key Features
- Type-safe MongoDB models using Typegoose
- Connection management for both raw MongoDB access and Mongoose ODM
- Database schema definitions with validation
- Docker configuration for local MongoDB development
Getting Started
To start using the database:
-
Configure the MongoDB connection in your
.env
file:MONGODB_URI=mongodb://localhost:27017/your-database
-
For local development with Docker, run:
docker-compose -f packages/db/docker-compose.yml up -d
Hot Reloading Limitation
warning
Currently during local development the database package will not hot reload when the schema changes. This means that you will need to restart the Next.js server to see the changes.
Learn More
For detailed information about the database implementation, including:
- Database models
- Connection management
- Database operations
- Adding new models
Please see the Database Package documentation.