MagicJS
mern.aiUniversityGitHub
  • Introduction to MagicJS
  • Why MagicJS?
  • Getting Started & Installation
  • Basic Guide
    • Create a new page using React
    • Navigate between pages
    • Create an API and integrate it with the frontend
    • Authenticate Users
      • Authorise based on Roles
    • Advanced State Management with useContent()
    • Perform CRUD Operations
    • Adding Realtime capabilities using socket
    • Handling file uploads and downloads
  • Advanced Guide
    • Understanding the concept of features in MagicJS
    • Using UI components & functions across multiple Magic Features
    • Advanced Routing of pages
    • Enable SSR
    • Access MongoDB
    • Styling pages using Tailwind CSS
  • Deploying
  • Update MagicJS
  • API References
    • Frontend
      • <LinkDisplay>
      • createSrc()
      • createUploader()
      • importUI()
      • loadConfig()
      • protected()
      • useParams()
      • useAxios()
      • useLogin()
      • useSocket()
      • useContent()
      • usePromise()
      • useNotification()
    • Backend
      • createBackendFunction()
      • data()
      • io()
      • ServerInstance()
      • utils
        • hash()
        • verifyHash()
        • initiateEmailVerification()
        • saveFileToUserUploads()
        • readFileFromUserUploads()
        • removeFileFromUserUploads()
        • assignRoleToUser()
        • unassignRoleFromUser()
        • findAllRolesByUser()
        • isUserInAnyRoles()
        • assignRoleToUser()
Powered by GitBook
On this page
  • Deploying as a Standalone Node.js Application
  • Deploying as a Container
  • Some of the best practices to consider before deploying.

Was this helpful?

Deploying

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.

PreviousStyling pages using Tailwind CSSNextUpdate MagicJS

Last updated 1 year ago

Was this helpful?