Getting Started
Manual Installation
Set up MoroJS by hand — prerequisites, ESM, package install, and TypeScript configuration. For most users, the CLI quick start is faster.
Most users should use the CLI quick start
npx @morojs/cli init my-api handles ESM, TypeScript, validation, and a working dev server for you. This page is for users who want to set up MoroJS manually.
What You'll Learn
- How to verify your system requirements
- Install MoroJS using your preferred package manager
- Set up your project for ESM (ES Modules)
- Configure TypeScript for optimal development
Check Prerequisites
Before installing MoroJS, ensure you have the following:
- Node.js 18.0.0 or higher
- npm, yarn, or pnpm package manager
- TypeScript knowledge (recommended)
Tip: Check your Node.js version with node --version
Understand ESM Requirements
ESM-Only Framework
MoroJS is built exclusively for modern JavaScript and requires ESM (ES Modules). Your project must use "type": "module" in package.json.
If you're migrating from CommonJS, convert your imports/exports to ESM syntax.
Install MoroJS
Install MoroJS using your preferred package manager:
npm
bash
yarn
bash
pnpm
bash
What this does: Installs MoroJS and its dependencies. The package includes everything you need to get started.
pnpm users: enable the esbuild build script
pnpm v10+ blocks postinstall scripts by default, which prevents esbuild from downloading its native binary and breaks tsx/dev tooling. Add the following to your package.json:
package.json
typescript
Configure Your Project
Ensure your package.json includes:
package.json
typescript
And your tsconfig.json has ESM support:
tsconfig.json
typescript
Result: Your project is now configured for ESM and ready for MoroJS development.
Troubleshooting
Common Issues
Node.js version issues
Ensure you're using Node.js 18 or higher. Check with node --version.
TypeScript compilation errors
Make sure your tsconfig.json has "moduleResolution": "NodeNext"and "esModuleInterop": true.
Import/export issues
Use ES modules syntax: import { createApp } from '@morojs/moro'instead of CommonJS require.