Overview
1
Create the workspace
Create a new Nx workspace alongside your existing project:
2
Generate an app for your existing code
apps/my-app/ with the standard structure.3
Copy your source files
Copy your existing tools, resources, prompts, and app files into the generated app:Update
apps/my-app/src/my-app.app.ts to import all your components:4
Extract shared code into libraries
Identify code that could be shared across future apps:Move shared utilities into
libs/ and update imports using your workspace’s path mappings in tsconfig.base.json.5
Update imports
Update imports to use workspace path aliases:Path aliases are defined in
tsconfig.base.json:6
Generate a server
Create a deployment shell that composes your app:
7
Verify everything works
Checklist
- Workspace created with
--nxflag - App generated and source files copied
- Shared code extracted into
libs/ - Imports updated to use workspace path aliases
- Server generated with correct deployment target
-
nx devstarts successfully -
nx buildcompiles without errors -
nx testpasses all tests - Old standalone project can be archived