Linux Server Deployment
Use this path when you want Morphis to run as a normal server process on your own Linux machine instead of handing the runtime off to a serverless platform.
When to use this mode
- You have a VPS, VM, or dedicated Linux server.
- You want full control over process management, networking, and scaling.
- You do not want the Docker-based serverless deployment flow used by
morphis deploy.
Basic production flow
bun install
morphis build --server=api
morphis start --server=apiThis assumes your production env file is already present on the server, for example .env.api or .env.prod.api.
Recommended Linux setup
- Install Bun on the host.
- Copy your project to the server.
- Install dependencies with
bun install. - Place the correct env file on the machine.
- Build with
morphis build --server=api. - Run the process under
systemdso it restarts automatically. - Put Nginx or another reverse proxy in front of the app if you need TLS termination or domain routing.
Example systemd service
[Unit]
Description=Morphis API
After=network.target
[Service]
Type=simple
WorkingDirectory=/srv/my-api
ExecStart=/usr/local/bin/bun --env-file=.env.api node_modules/morphis/dist/scripts/commands/start.js --server=api
Restart=always
RestartSec=5
User=www-data
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.targetIf you expose Bun directly on port 8080, place a reverse proxy in front of it and forward requests from ports 80 and 443.
Optional: build a Linux image yourself
If you still want a container for your own server, use:
morphis docker:build --server=apiThat command builds a Linux amd64 image, but unlike morphis deploy, you stay responsible for where and how that image runs.
Last updated on