Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through migrating an existing standalone FrontMCP project into an Nx monorepo.

Overview


1

Create the workspace

Create a new Nx workspace alongside your existing project:
npx frontmcp create my-platform --nx
cd my-platform
2

Generate an app for your existing code

nx g @frontmcp/nx:app my-app
This creates 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:
# Copy your source files (adjust paths as needed)
cp -r ../my-standalone/src/tools/* apps/my-app/src/tools/
cp -r ../my-standalone/src/resources/* apps/my-app/src/resources/
cp -r ../my-standalone/src/prompts/* apps/my-app/src/prompts/
Update apps/my-app/src/my-app.app.ts to import all your components:
@App({
  id: 'my-app',
  name: 'MyApp',
  tools: [/* your existing tools */],
  resources: [/* your existing resources */],
  prompts: [/* your existing prompts */],
})
export class MyAppApp {}
4

Extract shared code into libraries

Identify code that could be shared across future apps:
# Create libraries for shared code
nx g @frontmcp/nx:lib shared-utils
nx g @frontmcp/nx:lib data-models
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:
// Before (relative)
import { formatDate } from '../../utils/format';

// After (workspace alias)
import { formatDate } from '@my-platform/shared-utils';
Path aliases are defined in tsconfig.base.json:
{
  "compilerOptions": {
    "paths": {
      "@my-platform/shared-utils": ["libs/shared-utils/src/index.ts"]
    }
  }
}
6

Generate a server

Create a deployment shell that composes your app:
nx g @frontmcp/nx:server production --apps my-app --deploymentTarget node
7

Verify everything works

# Development mode
nx dev my-app

# Build
nx build production

# Test
nx test my-app

# Visualize dependencies
nx graph

Checklist

  • Workspace created with --nx flag
  • 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 dev starts successfully
  • nx build compiles without errors
  • nx test passes all tests
  • Old standalone project can be archived