web/versioned_docs/version-0.17/deployment/deployment-methods/self-hosted.md
import { ImgWithCaption } from '@site/blog/components/ImgWithCaption' import { GuideLink } from './GuideLink.tsx'
If you have your server or rent out a server, you can self-host your Wasp apps. Self-hosting your apps gives you full control over your apps and their data. It can be more cost-effective than a cloud provider since you can deploy multiple apps on a single server. However, you'll need to manage the server yourself, which can be time-consuming and require some technical knowledge.
To successfully self-host your Wasp app, you need to have the following:
myapp.com (needed for HTTPS support).To self-host your Wasp app, you need to follow these general steps:
Get your app's code on the server.
Run your client and server apps on the server. Run the database on the server or use a managed database service.
Set up a reverse proxy on the server to be able to use a domain name with HTTPS for your app.
Configure the env variables on your server for the server app.
We'll explore a few methods you can use to self-host your Wasp app. The first method is the most straightforward: you manually set up everything on your server. The other two methods require you to install and configure a self-hosted PaaS on your server and then use that to deploy apps to it.
In this setup, you do all the steps on the server: you install Docker, set up the server env variable, set up a reverse proxy, and run your app. This is a very manual process, but you'll learn how everything works.
On your server:
wasp build.Dockerfile in the .wasp/build directory that you can use to build and run the server app.Dockerfile..env file or by passing the env variables directly to the docker run command..wasp/build/web-app directory.myapp.com for the client and api.myapp.com for the server.myapp.com and proxy requests to the server app on api.myapp.com. Make sure your env variables are using these client and server URLs.Check out one of our step-by-step guides for more details:
<GuideLink linkToGuide="https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe" title="Deploying Wasp with Docker on your server" description="Uses Ubuntu, Git, Caddy, Docker" />Coolify is a deployment tool (self-hosted PaaS) that you run on your server. It makes it easier to deploy multple apps on your server. It has a nice looking UI and it helps you with managing your deployments.
myapp.com for the client and api.myapp.com for the server.Check out one of our step-by-step guides for more details:
<GuideLink linkToGuide="https://gist.github.com/infomiho/ad6fade7396498ae32a931ca563a4524" title="Deploying Wasp with Coolify on your server" description="Uses Coolify, Github Actions, Github Container Registry" />CapRover is a deployment tool (self-hosted PaaS) that you run on your server. It makes it easier to deploy multple apps on your server. It has a nice looking UI and it helps you with managing your deployments.
myapp.com for the client and api.myapp.com for the server.Check out one of our step-by-step guides for more details:
<GuideLink linkToGuide="https://gist.github.com/infomiho/a853e2f92aff6d52e9120b8974887464" title="Deploying Wasp with Caprover on your server" description="Uses Caprover, Github Actions, Github Container Registry" />In all of the guides, we run the database on your server. When you run the database on your server, you need to take care of backups, updates, and scaling. We suggest setting up PostgresSQL periodic backups and/or taking snapshots of your server's disk. In case something bad happens to your server, you can restore your database from the backups.
If you prefer not to manage the database yourself, you can use a managed database service. The service provider takes care of backups, updates, and scaling for you but it can be more expensive than running the database on your server. Some popular managed database services are AWS RDS, DigitalOcean Managed Databases, and Supabase.