Project

General

Profile

Actions

Feature #31769

open

Improvement #31248: New Theme based Nextjs application dev analysis

implement support multiple clients (e.g., `book-sulthan`, `client-b`) from a single codebase.

Added by Sachin Suresh 4 months ago. Updated 3 months ago.

Status:
On hold
Priority:
Normal
Assignee:
Target version:
-
Start date:
12/29/2025
Due date:
12/31/2025 (about 3 months late)
% Done:

80%

Estimated time:
Spent time:
remarks:
DB Changes:
Keys & Permissions:
Areas Affected:
Files Changed:
Actions #1

Updated by Sachin Suresh 4 months ago

  • Status changed from Assigned to In Progress
Actions #2

Updated by Sachin Suresh 3 months ago

  1. Multi-Client Architecture
  1. Overview
    This document outlines the architecture enabling CaxEngine to support multiple clients (e.g., `book-sulthan`, `client-b`) from a single codebase.
  1. 1. Dynamic Code Resolution
    Instead of hardcoding client paths, the project uses a dynamic alias strategy.
  • Alias: `@/client-views`
  • Resolution: Maps to `src/components/client/<active-client>`
  • Mechanism: * `next.config.mjs` reads the active client config at build time. * It updates the Webpack resolution for `@/client-views`. * It creates a global `process.env.CLIENT` variable (optional but good for debugging).
  1. 2. Configuration (`client.config.json`)
    The active client is determined by `client.config.json` located in the project root.

```json {
"client": "book-sulthan"
}
```

This file is the Source of Truth for the `set-client.js` script, though `next.config.mjs` can also fall back to `process.env.CLIENT` if set.

  1. 3. Client Switching Script (`set-client.js`)
    A Node.js utility script is used to switch contexts. It performs three atomic updates to ensure the environment is consistent:

1. `client.config.json`: Updates the JSON value.
2. `tsconfig.json`: Updates the `paths` mapping for `@/client-views/*` so IntelliSense works.
3. `.vscode/launch.json`: Updates the `CLIENT` environment variable in debug configurations so VS Code debugging targets the correct client.

Usage:
```bash
node set-client.js <client-name>
```

  1. 4. Directory Structure
  • `src/components/core`: Shared business logic (Headless).
  • `src/components/client/`: Container for all client implementations. * `book-sulthan/`: Default client. * `client-b/`: Secondary client. * `...`: Future clients.
  1. 5. Build & Dev Scripts
    `package.json` includes convenience scripts using `cross-env` to set the environment variable explicitly, which overrides `client.config.json` inside `next.config.mjs` (if configured to do so, though currently `client.config.json` is primary).
  • `npm run dev:book-sulthan`
  • `npm run build:client-b`
Actions #3

Updated by Sachin Suresh 3 months ago

need to implement pages and layout inside client folder

Actions #4

Updated by Sachin Suresh 3 months ago

  • Status changed from In Progress to On hold
Actions #5

Updated by Sachin Suresh 3 months ago

  • Status changed from On hold to In Progress
Actions #6

Updated by Sachin Suresh 3 months ago

the pages router issues fixed
cache issue fixed
updated custom config files for each client

Actions #7

Updated by Sachin Suresh 3 months ago

  • Due date changed from 12/30/2025 to 12/31/2025
  • Status changed from In Progress to On hold
  • % Done changed from 0 to 80
Actions

Also available in: Atom PDF