Skip to content

Conversation

@lsmith77
Copy link
Contributor

@lsmith77 lsmith77 commented Dec 19, 2025

If you prefer I can keep PostgreSQL but I think SQLite makes it easier for people to get this setup quickly. How to deal with PostgreSQL is then handled elsewhere in the docs.

Summary by CodeRabbit

  • Documentation
    • Updated NestJS recipe to use SQLite-backed examples instead of PostgreSQL.
    • Reorganized example file structure and adjusted import paths for clarity.
    • Clarified module exports and updated code samples for consistent access-control and API-handler examples.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 19, 2025

@lsmith77 is attempting to deploy a commit to the ZenStack Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

Reworks NestJS recipe docs: replaces PostgreSQL dialect with SqliteDialect and a SQLite DB in samples; updates file path annotations and import paths to use src/ layout; adds explicit export class AppModule and includes schema import in the API handler example.

Changes

Cohort / File(s) Change Summary
NestJS Recipe Documentation
versioned_docs/version-3.x/recipe/nestjs.md
Replaced Postgres setup with SqliteDialect and a SQLite-backed database in DbService sample; updated file path annotations from root-level names to src/db/db.service.ts, src/app.module.ts, src/app.controller.ts; adjusted import paths to the new locations; added export class AppModule and added schema import to API handler example.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Consistent, repetitive documentation changes across a single file.
  • Focused on examples/path adjustments and a dialect swap; no executable code outside docs to validate.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: fixing minor documentation issues and switching the example database from PostgreSQL to SQLite in the NestJS v3 docs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e99836f and a6b149c.

📒 Files selected for processing (1)
  • versioned_docs/version-3.x/recipe/nestjs.md (4 hunks)
🔇 Additional comments (6)
versioned_docs/version-3.x/recipe/nestjs.md (6)

13-29: Import paths and SQLite setup look correct.

All imports properly reference the new src/ directory structure. The path ../../zenstack/schema correctly resolves from src/db/db.service.ts to the root-level zenstack/schema. SQLite configuration with better-sqlite3 is straightforward and makes the quick-start simpler than PostgreSQL.


33-43: AppModule structure and imports are correct.

The explicit export class AppModule {} is good practice. Import path ./db/db.service correctly resolves from src/app.module.ts to src/db/db.service.ts.


47-60: AppController import paths verified.

Import path ./db/db.service correctly resolves from src/app.controller.ts.


68-105: Access-controlled ORM AppModule is consistent.

The explicit export class AppModule {} and import paths match the plain ORM pattern, maintaining consistency across examples.


109-124: Access-controlled ORM AppController is consistent.

Import paths align with the plain ORM example.


130-168: CRUD service example properly imports schema.

The schema import on Line 135 (../zenstack/schema) correctly resolves from src/app.controller.ts to the root-level schema file. This aligns with the API handler setup shown in the code.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
versioned_docs/version-3.x/recipe/nestjs.md (2)

47-60: Fix incorrect import path on line 49.

The import path './db.service' is inconsistent with the file structure. Since DbService is located at src/db/db.service.ts, the correct import from src/app.controller.ts should be './db/db.service'. This matches the import path used in the AppModule (line 36) and the CRUD example (line 134).

🔎 Proposed fix
  import { Controller, Get } from '@nestjs/common';
- import { DbService } from './db.service';
+ import { DbService } from './db/db.service';

109-124: Fix incorrect import path on line 111.

The import path './db.service' is inconsistent with the file structure. Since DbService is located at src/db/db.service.ts, the correct import from src/app.controller.ts should be './db/db.service'. This matches the import path used in the access-controlled AppModule (line 71) and the CRUD example (line 134).

🔎 Proposed fix
  import { Controller, Get, Inject } from '@nestjs/common';
- import { DbService } from './db.service';
+ import { DbService } from './db/db.service';
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89846e0 and e99836f.

📒 Files selected for processing (1)
  • versioned_docs/version-3.x/recipe/nestjs.md (4 hunks)
🔇 Additional comments (3)
versioned_docs/version-3.x/recipe/nestjs.md (3)

13-43: SQLite migration and module setup look good.

The DbService correctly switches to SqliteDialect with better-sqlite3, and the AppModule properly registers it as a provider with correct import paths.


68-105: Access-controlled module setup is correct.

The AppModule properly registers both the standard and access-controlled DbService instances, with correct imports and the explicit export class AppModule {} declaration.


130-168: CRUD API handler example is well-structured.

The import paths are correct ('./db/db.service' and '../zenstack/schema'), and the example properly demonstrates injecting the access-controlled DbService and initializing the RestApiHandler with the schema.

import { PostgresDialect } from '@zenstackhq/orm/dialects/postgres';
import { schema, type SchemaType } from './zenstack/schema';
import { Pool } from 'pg';
```ts title="src/db/db.service.ts"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the default directory structure from the nest.js cli:
nest generate service db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant