Skip to content

About

Create a neo.mjs workspace & app with the 1-liner npx neo-app

Resources

Code of conduct

Contributing

Stars

23 stars

Watchers

5 watching

Forks

Repository files navigation

Downloads Version License Join the Slack channel Discord Chat PRs Welcome

neo.mjs create-app

Create a new neo.mjs app (workspace) using the 1-liner:

npx neo-app

npm create neo-app runs the same generator.
npx neo-app works on macOS, Linux and Windows 10+.
If errors occur for your local environment, please file an issue.

Please ensure you have node & npm installed.

You do not need to clone this repository or globally install the neo-app npm package.

Please take a couple of minutes to read this README.md file first.

Content

  1. Quick Overview
  2. Script Options
  3. Starting a local web-server
  4. Viewing your app in development mode
  5. Viewing your app in dist modes
  6. Workspace Content
  7. package.json Scripts
  8. Working on your new neo.mjs App
  9. Learning neo.mjs
  10. Feedback and Questions
  11. Alternative options to create an App
  12. Kudos

Quick Overview

npx neo-app

Running the script will prompt 3 questions:

  1. Choose a workspace folder name. This folder will get created inside the terminal / CMD folder you are in.
    You can rename it later on if needed.
  2. Choose an app name (Pascal Case)
  3. Choose the themes you want to use (you can change this later on inside the neo-config.json)

Script Options

You can pass additional params to the script:

Choose a workspace folder name:

npx neo-app -w workspace

Choose an app name:

npx neo-app -n MyApp

Choose the themes:

npx neo-app -t all

Copy the engine's docs app into the workspace (it shows nothing until you run npm run generate-docs-json):

npx neo-app --docs

Of course, you can combine the options, e.g.:

npx neo-app -w workspace -n MyApp -t all

Coding agents

Every new workspace is ready for a coding agent such as Claude Code or Codex:

  • AGENTS.md (and a CLAUDE.md that imports it) explains how the engine works and where its source, guides and examples live in the workspace;
  • the neo-app-authoring and neural-link skills are linked into .agents/skills/ and .claude/skills/ by the workspace's own npm install;
  • each app's neo-config.json sets useAiClient: "development", so the app connects to the Neural Link while you build it;
  • .mcp.json (Claude Code) and .codex/config.toml (Codex) start the Neural Link MCP server from npm (npx -y neo-neural-link). Your client asks once before it trusts a project's servers.

Leave all of that out:

npx neo-app --no-agent

Add it to a workspace you already have (it changes nothing else, and keeps an existing AGENTS.md or CLAUDE.md):

npx neo-app --agent-only -w workspace

Opt into standalone cross-harness persistent memory (neo-memory-core):

npx neo-app --memory

Starting a local web-server

By default, npx neo-app starts the engine's file server right after the build, and a new browser tab opens on your app.

In case you do not want to start the server automatically, you can use the -s option:

npx neo-app -s false

You can use a different web-server of your choice (e.g. webstorm) or you can start the default one manually later:

cd workspace

npm run server-start

Viewing your app in development mode

The dev mode works in all major browsers (Chromium, Firefox & Safari).

The tab the server opens shows your new app at:

http://localhost:8080/apps/myapp/

The server takes the next free port when 8080 is in use; the terminal prints the address.

The beauty inside this screen is:

  1. You can see 4 threads inside the bottom left edge of the console
  2. Your app as well as most parts of neo.mjs run within the App thread
  3. You get the real JS modules directly into your browser
    1. No need to transpile JS code in this mode
    2. No need for source-maps

Viewing your app in dist modes

The first run installs and builds what dev mode needs: the engine, the icon font, a dozen packages and the development themes. The dist modes exist after you build them. The first build adds the build tools (webpack, terser and the rest) to your package.json and installs them:

npm run build-all

dist/development is using webpack based builds (source-maps, not minified)

http://localhost:8080/dist/development/apps/myapp/

dist/production is using webpack based builds (no source-maps, minified)

http://localhost:8080/dist/production/apps/myapp/

Workspace Content

Using the script will create the following content:

  1. .gitignore has a basic setup excluding IDE related files, the dist folder & the package-lock.json
  2. apps contains the source files of your new app. You can create multiple apps as needed.
  3. buildScripts contains meta-infos (in theory this could get stored inside the neo.mjs node_module, but then every framework version update would require to re-create it)
  4. dist holds the development themes after the first run; npm run build-all adds the development, production and esm builds of your app
  5. docs exists only with --docs: a copy of the engine's docs app, which shows documentation views of your app and the engine's examples once npm run generate-docs-json has run
  6. node_modules => what dev mode and the file server need; the build tools arrive with your first build
  7. package.json => defines scripts and dependencies. neo.buildTools lists the build tools. Your first build installs them and adds them to devDependencies; the list stays as the recipe, so a build that was interrupted finishes the install the next time.

package.json Scripts

You need to enter the workspace folder inside your terminal / CMD.

cd workspace

You can run each script via

npm run <script-name>

Main Scripts

  • server-start: Starts the engine's file server and opens your app; npm run server-start -- --no-open starts it without a browser, and -- --port <n> or PORT=<n> picks the port
  • build-all: adds the build tools on its first run, then npm install & builds literally everything.
  • add-build-tools: installs the packages the build scripts import. Every script that needs one runs it first, so you rarely call it yourself.
  • build-all-questions: same as build all, but you can choose what to build using the inquirer interface.
  • build-themes: builds the themes for dev and / or prod and lets you choose if want to use CSS variables.
  • build-threads: builds main, data & vdom (or any combinations) for dev and / or prod.
  • create-app: add an additional app to your project. You can also trigger npx neo-app multiple times.
  • generate-docs-json: writes the data the docs app of a --docs workspace reads. Run it once before that app shows anything, and again when you change your app code (e.g. adding new files).
  • bundle-browser-deps: builds the browser bundles the engine loads from node_modules/neo.mjs/dist/. The npm package ships none of them. npm install builds the two the engine imports at startup (parse5, marked); run this script for the ones loaded on demand (Mermaid, Monaco, highlight.js).

Working on your new neo.mjs App

It is recommended to use the development mode (non dist version) for developing your App(s). This way you can just reload the App page whenever you change the code base. No need for source-maps and a very smooth debugging experience.

You ideally want to start with changing the view/MainContainer.mjs file.

Once you get to a point where you want to test your changes inside the dist versions, take a look at: package.json Scripts.

Learning neo.mjs

Take a look into the new Learning Section

Feedback and Questions

Feel free to use one of these options (or both):
Slack Channel Invite Link
Discord Chat Invite Link

Alternative options to create an App

  1. Use npx neo-app
  2. Clone or fork the neo.mjs workspace (if there are any issues with npx neo-app)
  3. In case you want to get the neomjs/neo repository running locally, please take a look at the neo.mjs Getting Started Guide. Step 6 creates a new App inside neo/apps

Kudos

The npx neo-app script is deeply inspired by Create React App.



Copyright (c) 2019 - today, Tobias Uhlig

About

Create a neo.mjs workspace & app with the 1-liner npx neo-app

Resources

Code of conduct

Contributing

Stars

23 stars

Watchers

5 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages