This guide will walk you through the process of deploying a MagicJS project.

Deploying as a Standalone Node.js Application

Step 1: Build the Project

npm run build

Step 2: Start the Server

Once the project is built, you can start the server using:

node build/server/main.js

For production deployments, it's recommended to use a process manager like PM2 to ensure robustness and ease of management.

Step 3: Using PM2 (Recommended)

Install PM2 globally if you haven't already:

npm install -g pm2

Now, start your MagicJS application using PM2:

pm2 start build/server/main.js --name my-magic-app

This will start your MagicJS application as a background process, and PM2 will handle logging, monitoring, and automatic restarts.

Deploying as a Container

Documentation for deploying MagicJS as a container is currently under development and will be available soon. Stay tuned for updates!

Some of the best practices to consider before deploying.

  • Environment Configuration: Make sure to configure your environment variables appropriately for your production environment.

  • Security Considerations: Implement security best practices, including proper firewall configurations and secure connection settings.

  • Monitoring: Use monitoring tools to keep an eye on your application's performance and health.

Last updated