Skip to content

update: ddd folder structure for backend and frontend#8

Merged
maximedogawa merged 2 commits into
mainfrom
6-feature-refactor-fullstack-tauri-app-to-domain-driven-modules
Apr 9, 2026
Merged

update: ddd folder structure for backend and frontend#8
maximedogawa merged 2 commits into
mainfrom
6-feature-refactor-fullstack-tauri-app-to-domain-driven-modules

Conversation

@maximedogawa
Copy link
Copy Markdown
Collaborator

@maximedogawa maximedogawa commented Apr 9, 2026

Summary by CodeRabbit

  • New Features

    • Background app startup now resumes persisted bot connections, runs a local HTTP server, and exposes connect/disconnect/status commands.
    • Added Ollama probing and chat integration for model selection and chat replies.
  • Refactor

    • Reorganized backend into modular infrastructure and modules (bot, ollama, shared state, repository).
    • Command handling and persistence moved to dedicated modules.
  • Chores

    • Added lint/typecheck and Rust check scripts; simplified pre-commit hooks to use project scripts.
  • Documentation

    • Added architecture and design reference doc.
  • Tests

    • Updated E2E imports to use new shared API config.

@maximedogawa maximedogawa self-assigned this Apr 9, 2026
@maximedogawa maximedogawa linked an issue Apr 9, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a2658795-f5b7-4eae-82a2-722e76c69177

📥 Commits

Reviewing files that changed from the base of the PR and between 83459ad and 6f65db8.

📒 Files selected for processing (1)
  • doc/design/README.md

📝 Walkthrough

Walkthrough

Refactors Tauri backend: moves app bootstrap into app.rs, extracts bot lifecycle, HTTP server, repository, Ollama service, and shared state; updates frontend to use new modules/* and shared/* barrels; adds persistence repository and npm/rust scripts; adjusts e2e test imports and documentation.

Changes

Cohort / File(s) Summary
Tauri Entrypoint
src-tauri/src/lib.rs, src-tauri/src/app.rs
Moved Tauri bootstrap into app.rs; lib.rs now delegates to app::run(). New app::run() manages logging, AppState, background tasks (resume bot, start HTTP server), and Tauri commands.
Infrastructure: bot lifecycle & HTTP server
src-tauri/src/infrastructure/mod.rs, src-tauri/src/infrastructure/bot_lifecycle.rs, src-tauri/src/infrastructure/http_server.rs
Added bot_lifecycle/http_server modules; handlers updated to use new modules::bot and shared::state paths, call repository persistence, and spawn/stop bots via bot_service.
Modules: bot (backend)
src-tauri/src/modules/bot/mod.rs, src-tauri/src/modules/bot/commands.rs, src-tauri/src/modules/bot/repository.rs, src-tauri/src/modules/bot/service.rs
New bot module with commands (Tauri commands), repository (persist/load/clear ConnectionData), and service (bot runtime logic delegating to ollama service).
Modules: ollama (backend)
src-tauri/src/modules/ollama/mod.rs, src-tauri/src/modules/ollama/constants.rs, src-tauri/src/modules/ollama/service.rs
New Ollama module with endpoint constants and HTTP-backed active_model() and chat() functions.
Shared state (backend)
src-tauri/src/shared/mod.rs, src-tauri/src/shared/state.rs
Introduced shared::state; moved LogEntry and AppState changes; removed file-based persist/load/clear methods from AppState (moved to repository).
Frontend module reorg
src/modules/bot/index.ts, src/modules/bot/types.ts, src/modules/bot/api/index.ts, src/modules/bot/store/appSessionStore.ts, src/modules/bot/components/..., src/modules/ollama/index.ts, src/modules/ollama/types.ts, src/modules/ollama/api/index.ts
Created modules/bot and modules/ollama barrels and types; moved fetchOllamaModel/OllamaProbe to modules/ollama; added PengineHealth type and bot API exports; updated store/component entry points.
Frontend import updates
src/App.tsx, src/pages/DashboardPage.tsx, src/pages/LandingPage.tsx, src/pages/SetupPage.tsx, src/shared/ui/TopMenu.tsx
Updated numerous imports across pages and UI to the new modules/* and shared/* paths.
Components: Setup & Terminal
src/modules/bot/components/SetupWizard.tsx, src/modules/bot/components/TerminalPreview.tsx
Redirected imports to new module paths; removed commented step labels in SetupWizard; switched TerminalPreview PENGINE import to api.
E2E tests
e2e/setup-dashboard.spec.ts
Updated test imports to use src/shared/api/config for API base constants.
Tooling & docs
.husky/pre-commit, package.json, doc/design/README.md
Pre-commit hook simplified to npm scripts; added lint:fix, typecheck, rust:fmt, rust:lint, rust:check scripts; added architecture/design doc.
Small refactors
various (imports, small relocations) + many files
Multiple import path changes and small relocations across frontend/backend to match new module layout.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Tauri as Tauri App
  participant AppState as AppState (shared)
  participant Repo as Bot Repository (fs)
  participant BotService as Bot Service
  participant Ollama as Ollama Service
  participant HTTP as Local HTTP Server

  Tauri->>AppState: init & manage state
  Tauri->>Repo: load persisted ConnectionData (async task)
  Repo-->>Tauri: ConnectionData or None
  Tauri->>BotService: start_bot(token) if ConnectionData present
  BotService->>Ollama: active_model() / chat(...)
  BotService->>HTTP: emit logs / receive messages
  HTTP->>BotService: incoming connect/disconnect requests
  HTTP->>Repo: persist/clear ConnectionData on connect/disconnect
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • 1 feature messaging bot connection #2: Overlapping refactor touching Tauri backend bot lifecycle, AppState, persistence, and HTTP/loopback integration (similar module reorganizations and command/handler changes).

Poem

🐰
I hopped through modules, stitched and neat,
Bot, Ollama, state — each found its seat,
Files rearranged with tidy cheer,
A carrot for structure, and clean code to steer!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 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 primary change: refactoring the project structure to adopt domain-driven design (DDD) principles with new folder organization for both backend (Rust/Tauri) and frontend (TypeScript/React) modules.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 6-feature-refactor-fullstack-tauri-app-to-domain-driven-modules

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.

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.

[Feature] Refactor Fullstack Tauri App to Domain-Driven Modules

1 participant