Features
Docs
CLI
Benchmarks
Examples

© 2024 MoroJs

Installation

Install MoroJS and set up your development environment. Once installed, you'll be ready to build your first API.

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
1

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

2

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.

3

Install MoroJS

Install MoroJS using your preferred package manager:

npm

bash

1npm install @morojs/moro

yarn

bash

1yarn add @morojs/moro

pnpm

bash

1pnpm add @morojs/moro

✓ What this does: Installs MoroJS and its dependencies. The package includes everything you need to get started.

4

Configure Your Project

Ensure your package.json includes:

package.json

typescript

1{
2  "type": "module",
3  "scripts": {
4    "dev": "tsx watch src/server.ts",
5    "build": "tsc",
6    "start": "node dist/server.js"
7  }
8}

And your tsconfig.json has ESM support:

tsconfig.json

typescript

1{
2  "compilerOptions": {
3    "target": "ES2022",
4    "module": "NodeNext",
5    "moduleResolution": "NodeNext",
6    "esModuleInterop": true,
7    "strict": true
8  }
9}

✨ Result: Your project is now configured for ESM and ready for MoroJS development.

Progress4 of 4 steps

Ready to Build!

Now that MoroJS is installed, let's build your first API. Our Quick Start guide will walk you through everything step-by-step.

Go to Quick Start Guide

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.