Skip to main content

Professional Phoenix Application Development

  • Before starting, make sure you have Erlang/OTP and Elixir installed on your system. If you don’t have them yet, download them from the official Elixir installation guides.
  • Phoenix is built on top of Elixir and the Erlang VM (BEAM). Ensure your environment matches the Phoenix version requirements in the Phoenix docs.
  • Next, create an account on Square Cloud through the signup page and ensure you have an active paid plan appropriate for your application’s needs here.

Phoenix Configuration

Install the Phoenix project generator if you don’t already have it:
mix archive.install hex phx_new
Create a new Phoenix project (choose options according to your needs):
mix phx.new my_app
Follow the prompts to include Ecto, dashboard, and asset tooling (esbuild, tailwind, etc.) as needed. After project creation, fetch dependencies:
cd my_app
mix deps.get
To create the database (if using Ecto):
mix ecto.create
Start the development server:
mix phx.server
By default Phoenix runs on http://localhost:4000.

Creating the Square Cloud Configuration File

Learn more about: how to create the configuration file for Square Cloud.

The squarecloud.app file defines your application’s name, description, version, entry point, and other essential settings.

Configuring the START Field

Phoenix applications typically run as releases in production. A common start command after building a release is:
_build/prod/rel/my_app/bin/my_app start
A full build + start sequence (used locally or in build scripts) looks like:
MIX_ENV=prod mix deps.get --only prod
MIX_ENV=prod mix assets.deploy
MIX_ENV=prod mix release
_build/prod/rel/my_app/bin/my_app start
Set the START field in squarecloud.app to the command you use to run the release (for example the full sequence or a script that performs the release and starts the app).

Purchasing a Plan Before Uploading the Project

Before deploying your Phoenix project to Square Cloud, ensure you have an active plan that meets your application’s CPU and memory needs. Phoenix is highly concurrent and benefits from CPU and memory. For most apps the Standard plan is a good starting point; high-traffic or CPU-intensive applications should use Pro.
Not sure how much RAM and CPU a Phoenix app needs? It depends on concurrency, pooled connections and background jobs. Start with Standard for typical web apps and scale up if you observe resource limits.

Building Phoenix for Production

Example production build steps (adjust for your project and asset toolchain):
# install production deps
MIX_ENV=prod mix deps.get --only prod

# compile and build release
MIX_ENV=prod mix compile
MIX_ENV=prod mix assets.deploy
MIX_ENV=prod mix release

# start the release
_build/prod/rel/my_app/bin/my_app start
If your app does not use releases, you can also run via MIX_ENV=prod mix phx.server, but releases are recommended for production stability. When using squarecloud.app, point the START command to the final start step (release binary) or to a deployment script that runs the above steps.

Uploading the Project to Square Cloud

After preparing your project, you can upload it to Square Cloud using the dashboard or the CLI.
  • Upload via Dashboard
  • Upload via CLI
Access the Square Cloud Dashboard and upload your project files.

Additional Resources

Official docs and references:

Troubleshooting

Custom Domain

To use a custom domain (e.g., mysite.com) instead of the default URL https://mysite.squareweb.app/, you need the Standard plan or higher. The subdomain is defined by the SUBDOMAIN field in the configuration file. See: How to set up your custom domain.

Minimum RAM Requirements

Minimum: 512MB RAM for simple websites/APIs. For sites with frameworks (Next.JS, React, Vue, Angular, etc.), we always recommend at least 1GB RAM. For larger applications, use more RAM to avoid LACK_OF_RAM error and ensure performance.

Could not find this site.

Check if the subdomain/domain matches what's configured in the SUBDOMAIN field or in the custom domain settings. If you just uploaded the site, wait up to 60 seconds for Square to enable first access.

Site took too long to respond...

Check if you correctly configured port 80 and host 0.0.0.0 in the application. We recommend using Square's forced environment variables: PORT and HOST from the .env file.
If you continue facing technical difficulties, our specialized support team is available to assist you. Contact us and we'll be happy to help you resolve any issue.