Mode-based architecture complete: Created ModeSwitch orchestrator (3006), Mode1Test isolated (3005), Mode2Test placeholder, added active mode label to frontend
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
# Job Info - Mode-Based Architecture
|
||||
|
||||
This project uses a mode-switching architecture to allow seamless switching between different application configurations.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
```
|
||||
Job-Info-Test/
|
||||
├── ModeSwitch/ (Orchestrator hub - controls which mode runs)
|
||||
├── Mode1Test/ (Mode1Test - original application)
|
||||
├── Mode2Test/ (Mode2Test - alternative configuration)
|
||||
├── Monica.txt (Development persona and standards)
|
||||
└── README.md (This file)
|
||||
```
|
||||
|
||||
## Modes
|
||||
|
||||
### Mode1Test
|
||||
The original application configuration. Runs on port 3005 when active.
|
||||
- Backend: `Mode1Test/backend/server.ts`
|
||||
- Frontend: `Mode1Test/frontend/`
|
||||
- Standalone project with its own `package.json`
|
||||
|
||||
### Mode2Test
|
||||
Alternative configuration (under development).
|
||||
- Backend: `Mode2Test/backend/server.ts`
|
||||
- Frontend: `Mode2Test/frontend/`
|
||||
- Standalone project with its own `package.json`
|
||||
|
||||
## ModeSwitch Orchestrator
|
||||
|
||||
The orchestrator manages mode switching and ensures only one mode runs on port 3005 at a time.
|
||||
|
||||
### Starting the Application
|
||||
|
||||
```bash
|
||||
cd ModeSwitch
|
||||
bun install
|
||||
bun run backend/orchestrator.ts
|
||||
```
|
||||
|
||||
The orchestrator will:
|
||||
1. Read the active mode from `ModeSwitch/activeMode.txt`
|
||||
2. Kill any existing process on port 3005
|
||||
3. Start the active mode on port 3005
|
||||
|
||||
**Orchestrator runs on port 3006 (for control/monitoring)**
|
||||
**Shared mode port: 3005 (public, user-facing)**
|
||||
|
||||
### Switching Modes at Runtime
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:3006/api/mode/switch/Mode2Test
|
||||
```
|
||||
|
||||
Or programmatically:
|
||||
```typescript
|
||||
const response = await fetch('http://localhost:3006/api/mode/switch/Mode1Test', {
|
||||
method: 'POST',
|
||||
});
|
||||
```
|
||||
|
||||
### Checking Current Mode
|
||||
|
||||
```bash
|
||||
curl http://localhost:3006/api/mode
|
||||
```
|
||||
|
||||
## Development Standards
|
||||
|
||||
See `Monica.txt` for complete development persona, standards, and guidelines.
|
||||
|
||||
Key standards:
|
||||
- **Runtime:** Bun (exclusive)
|
||||
- **Backend:** Hono + TypeScript
|
||||
- **Frontend:** Vite + TailwindCSS + TypeScript
|
||||
- **Architecture:** Modules as standalone reusable components
|
||||
- **Environment:** Variables from `process.env` (no sample .env files)
|
||||
- **Code:** Original rewrites, no delta markers, permanent/temporary comments
|
||||
|
||||
## File Structure Rules
|
||||
|
||||
- **Root:** Only mode folders, orchestrator folder, Monica.txt, README.md
|
||||
- **Each Mode:** Self-contained with `package.json`, `backend/`, `frontend/`
|
||||
- **ModeSwitch:** All mode-switching logic and orchestration
|
||||
- **Modules:** Standalone folders with related code (when needed)
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Verify Test1Mode runs correctly from `oldTest/`
|
||||
2. Implement Mode2Test as a new application variant
|
||||
3. Test mode switching via the orchestrator API
|
||||
|
||||
Reference in New Issue
Block a user