Deployment Guide

Learn how to deploy applications using mnnn with step-by-step instructions and best practices.

Introduction

Deploying your application with mnnn is streamlined for simplicity and flexibility. Whether you're deploying to a local server or a cloud environment, the following steps will guide you through the process.

Prerequisites

  • Node.js version 16+ installed
  • npm or yarn package manager
  • mnnn SDK initialized in your project
  • API key with deployment permissions

Local Deployment

For local development, you can run the mnnn development server to test your application.

$ npx mnnn serve --port 3000

This will start a local server at localhost:3000 with live reload.

Cloud Deployment

mnnn supports cloud deployment to services like AWS, Azure, or Google Cloud. Follow these steps to deploy:

Build Project

$ npm run build

This compiles your application into production-ready artifacts.

Configure Environment

MN_ENV=production
MN_API_KEY=your_api_key

Set environment variables in your cloud platform.

Deploy to Cloud

$ mnnn deploy --platform aws

The CLI handles deployment to selected cloud providers.

Verify Deployment

$ mnnn status

Check deployment status and health of your application instances.

CI/CD Integration

Integrate mnnn deployment into your CI/CD pipelines using the following examples for GitHub Actions.


pipeline:
  deploy:
    type: deploy
    env: production
    steps:
      - install: nodejs@16
      - run: npm install
      - run: mnnn deploy --platform gcloud

Configure secrets in your CI/CD platform and ensure the MN_API_KEY is available as an environment variable.

Best Practices

  • Use environment variables for sensitive configuration
  • Automate deployment with version control hooks
  • Monitor deployed instances with mnnn's analytics dashboard
  • Test locally before cloud deployment

Troubleshooting

Common Errors

Error: "API Key invalid"

Ensure the API key has deployment permissions and is correctly configured in environment variables.

Error: "Port already in use"

Change the deployment port using --port flag or kill existing processes on the default port.