@whoz-oss/coday-web 0.34.2 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +106 -73
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,124 +1,157 @@
1
- # Coday Web
1
+ # Coday Web Package
2
2
 
3
- A lightweight runtime orchestrator for the Coday web interface.
3
+ This package provides the web interface launcher for Coday, bundling both the client (Angular app) and server components into a single executable package.
4
4
 
5
5
  ## Architecture
6
6
 
7
- This package is a **thin wrapper** that coordinates the client and server packages at runtime. It does not bundle or build anything - it simply resolves the installed packages and starts the server with the correct client path.
7
+ The web package acts as a thin orchestration layer:
8
8
 
9
- ### How It Works
10
-
11
- 1. **Runtime Resolution**: When executed, `index.js` resolves the location of `@whoz-oss/coday-client` in node_modules
12
- 2. **Environment Configuration**: Sets `CODAY_CLIENT_PATH` environment variable pointing to the client's browser build
13
- 3. **Server Delegation**: Imports and executes `@whoz-oss/coday-server` which serves the client files
14
-
15
- ### Dependencies
9
+ ```
10
+ ┌─────────────────────────────────────────┐
11
+ │ coday-web (index.js) │
12
+ │ ┌───────────────────────────────────┐ │
13
+ │ │ 1. Resolve client package path │ │
14
+ │ │ 2. Set CODAY_CLIENT_PATH env var │ │
15
+ │ │ 3. Import and run server │ │
16
+ │ └───────────────────────────────────┘ │
17
+ └─────────────────────────────────────────┘
18
+
19
+ ┌───────────┴───────────┐
20
+ ▼ ▼
21
+ ┌──────────────┐ ┌──────────────┐
22
+ │ coday-server │ │ coday-client │
23
+ │ (Express) │───────▶│ (Angular) │
24
+ └──────────────┘ └──────────────┘
25
+ ```
16
26
 
17
- - `@whoz-oss/coday-client` - Angular application (static files)
18
- - `@whoz-oss/coday-server` - Express server with API endpoints
27
+ ## Usage Modes
19
28
 
20
- ## Usage
29
+ ### Production Mode (Published Package)
21
30
 
22
- ### Via NPX (Recommended)
31
+ Use the published npm package via npx:
23
32
 
24
33
  ```bash
34
+ # Using the published package
35
+ pnpm web
36
+
37
+ # Or directly with npx
25
38
  npx @whoz-oss/coday-web --no_auth
26
39
  ```
27
40
 
28
- ### Local Development
41
+ In production mode:
42
+ - The web launcher resolves the client package from node_modules
43
+ - Server serves pre-built static files from the client package
44
+ - Single process handles both server and client
29
45
 
30
- From the monorepo root:
46
+ ### Development Mode (Local Sources)
47
+
48
+ For development with live reload and local sources:
31
49
 
32
50
  ```bash
33
- pnpm web:local
51
+ # Start both client and server in development mode
52
+ pnpm web:dev
34
53
  ```
35
54
 
36
- ### Installed Globally
55
+ This command:
56
+ - Starts the Angular dev server on port 4200 (with HMR)
57
+ - Starts the Express server on port 4100 (with tsx watch)
58
+ - Server proxies non-API requests to Angular dev server
59
+ - Changes to client or server code trigger automatic reloads
37
60
 
38
- ```bash
39
- npm install -g @whoz-oss/coday-web
40
- coday-web --no_auth
41
- ```
61
+ **How it works in dev mode:**
62
+ 1. Client runs with Angular CLI dev server (localhost:4200)
63
+ 2. Server runs with tsx watch (localhost:4100)
64
+ 3. Server detects `BUILD_ENV=development` and proxies to Angular
65
+ 4. API routes (e.g., `/api/*`) are handled by the server
66
+ 5. All other routes are proxied to Angular for client-side routing
42
67
 
43
- ## Command-Line Arguments
68
+ ## Development Workflow
44
69
 
45
- All arguments are passed through to the server:
70
+ ### Running Individual Services
46
71
 
47
- - `--no_auth` - Disable authentication (use local username)
48
- - `--local` - Use local configuration
49
- - `--port=<number>` - Specify port (default: 3000)
50
- - `--config_dir=<path>` - Custom config directory
72
+ You can also run services separately for debugging:
73
+
74
+ ```bash
75
+ # Run only the client (Angular dev server)
76
+ pnpm client
51
77
 
52
- ## Development Notes
78
+ # Run only the server (Express with tsx watch)
79
+ pnpm server
80
+ ```
53
81
 
54
- ### No Build Step
82
+ ### Building for Production
55
83
 
56
- Unlike traditional applications, this package requires **no build step**. The `index.js` file is the entry point and runs directly with Node.js.
84
+ The web package depends on built client and server packages:
57
85
 
58
- ### Package Structure
86
+ ```bash
87
+ # Build all packages
88
+ pnpm nx run-many --target=build --projects=client,server,web
59
89
 
60
- ```
61
- apps/web/
62
- ├── index.js # Runtime launcher (executable)
63
- ├── package.json # Package metadata and dependencies
64
- ├── project.json # NX project configuration (minimal)
65
- └── README.md # This file
90
+ # Or build everything
91
+ pnpm nx run-many --target=build --all
66
92
  ```
67
93
 
68
- ### Testing Locally
94
+ ### Testing Changes
69
95
 
70
- 1. Ensure client and server are built:
71
- ```bash
72
- pnpm nx run client:build
73
- pnpm nx run server:build
74
- ```
96
+ When making changes to the web launcher:
75
97
 
76
- 2. Run the web launcher:
77
- ```bash
78
- node apps/web/index.js --no_auth
79
- ```
98
+ 1. Modify `apps/web/index.js`
99
+ 2. Test with local server: `node apps/web/index.js --no_auth`
100
+ 3. Verify client resolution works correctly
101
+ 4. Check that server starts and serves the client
80
102
 
81
- 3. The launcher will:
82
- - Find the client build in `apps/client/dist/browser`
83
- - Set the environment variable
84
- - Start the server from `apps/server/dist/server.js`
103
+ ## Environment Variables
85
104
 
86
- ### Publishing
105
+ - `CODAY_CLIENT_PATH`: Set by the web launcher to tell server where client files are
106
+ - `BUILD_ENV`: Set to `development` by server's serve target for dev mode
107
+ - `PORT`: Override default server port (default: 3000 production, 4100 dev)
87
108
 
88
- The package is published as-is (no dist directory):
109
+ ## Package Dependencies
89
110
 
90
- ```bash
91
- pnpm nx run web:nx-release-publish
111
+ ```json
112
+ {
113
+ "@whoz-oss/coday-client": "workspace:*",
114
+ "@whoz-oss/coday-server": "workspace:*"
115
+ }
92
116
  ```
93
117
 
94
- This publishes the source directory containing:
95
- - `index.js` (marked as executable via package.json bin field)
96
- - `package.json` (with dependencies on client and server)
118
+ These use workspace protocol in development and resolve to specific versions when published.
97
119
 
98
120
  ## Troubleshooting
99
121
 
100
122
  ### "Could not resolve @whoz-oss/coday-client package"
101
123
 
102
- Ensure dependencies are installed:
124
+ This means the client package isn't built or installed:
125
+
103
126
  ```bash
127
+ # In development
104
128
  pnpm install
129
+ pnpm nx run client:build
130
+
131
+ # Or use the web:dev command which doesn't require builds
132
+ pnpm web:dev
105
133
  ```
106
134
 
107
- ### "Client package found but browser directory is missing"
135
+ ### "Failed to start server"
136
+
137
+ Check that all dependencies are installed:
108
138
 
109
- The client package must be built and include a `browser/` directory with `index.html`. Check the client build output.
139
+ ```bash
140
+ pnpm install
141
+ ```
110
142
 
111
- ### Server fails to start
143
+ ### Development mode not proxying correctly
112
144
 
113
- Check that:
114
- 1. The server package is installed
115
- 2. Port 3000 (or specified port) is available
116
- 3. You have necessary permissions
145
+ Ensure both services are running:
146
+ 1. Angular dev server should be on port 4200
147
+ 2. Express server should be on port 4100
148
+ 3. Access the app via http://localhost:4100
117
149
 
118
- ## Architecture Benefits
150
+ ## Quick Reference
119
151
 
120
- **Simple**: No build complexity, just runtime coordination
121
- ✅ **Maintainable**: Single source of truth for client and server
122
- **Flexible**: Works with workspace protocol (dev) or published packages (prod)
123
- **Debuggable**: Clear separation of concerns, easy to trace issues
124
- **Standard**: Uses normal npm package resolution
152
+ | Command | Mode | Ports | Use Case |
153
+ |---------|------|-------|----------|
154
+ | `pnpm web` | Production | 3000 | Testing published package |
155
+ | `pnpm web:dev` | Development | 4100→4200 | Active development |
156
+ | `pnpm client` | Development | 4200 | Client-only work |
157
+ | `pnpm server` | Development | 4100 | Server-only work |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-web",
3
- "version": "0.34.2",
3
+ "version": "0.35.0",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,8 +11,8 @@
11
11
  "README.md"
12
12
  ],
13
13
  "dependencies": {
14
- "@whoz-oss/coday-client": "0.34.2",
15
- "@whoz-oss/coday-server": "0.34.2"
14
+ "@whoz-oss/coday-client": "0.35.0",
15
+ "@whoz-oss/coday-server": "0.35.0"
16
16
  },
17
17
  "publishConfig": {
18
18
  "access": "public"