Skip to content

Data Layer

Understand the data-related crates in the NestForge workspace and when to use each one.

NestForge does not treat persistence as a single crate. The current workspace includes:

  • nestforge-db
  • nestforge-orm
  • nestforge-data
  • nestforge-mongo
  • nestforge-redis

This is the SQL-oriented foundation. It contains the DB wrapper and migration support used by the CLI database workflow.

This provides relational repository-style abstractions on top of the DB layer when your application wants a more structured persistence surface.

This crate collects more general data abstractions that are not tied only to relational storage.

This is the Mongo-oriented adapter surface for document-style workflows.

This is the Redis-oriented store surface and is also relevant for cache scenarios.

Choose the simplest layer that matches your needs:

  • use ResourceService for prototypes and examples
  • use nestforge-db when you need SQL access and migrations
  • use nestforge-orm when repository-style abstractions improve maintainability
  • use nestforge-mongo or nestforge-redis only when your application actually needs those backends

Because these crates are still part of an evolving framework workspace, prefer explicit boundaries in application code instead of coupling every service directly to one crate’s concrete types.