How to Deploy a Web + API Monorepo
Next.js frontend and Flask API from the same repo, deployed as two apps.
Repo structure
my-project/
├── web/ # Next.js frontend
│ ├── Dockerfile
│ ├── package.json
│ └── ...
├── api/ # Flask API
│ ├── Dockerfile
│ ├── requirements.txt
│ ├── app.py
│ └── ...
└── README.md
Each subdirectory has its own Dockerfile. PromptShip builds from the directory you specify with root_dir.
How do I deploy both?
Just ask your AI assistant. It calls the PromptShip MCP tools for you:
Deploy my monorepo at github.com/me/my-project as two apps: myapp-web from web/ and myapp-api from api/. Add Postgres to the API.
create_app(
name: "myapp-web",
github_repo: "github.com/me/my-project"
)configure_app(app_name: "myapp-web", root_dir: "web")configure_process(
app_name: "myapp-web",
process_name: "web",
process_type: "web",
command: "node server.js"
)create_app(
name: "myapp-api",
github_repo: "github.com/me/my-project"
)configure_app(app_name: "myapp-api", root_dir: "api")configure_process(
app_name: "myapp-api",
process_name: "web",
process_type: "web",
command: "gunicorn app:app --bind 0.0.0.0:$PORT"
)attach_postgres(app_name: "myapp-api", environment: "dev", tier: "pg-1")deploy_app(app_name: "myapp-web", branch: "main")deploy_app(app_name: "myapp-api", branch: "main")Results:
- Frontend:
https://myapp-web-dev.promptship.dev - API:
https://myapp-api-dev.promptship.dev
Custom domains: Point app.example.com to your frontend and api.example.com to your API using set_domain.
How does root_dir work?
When you set root_dir: "web", PromptShip looks for the Dockerfile inside web/ and uses that directory as the Docker build context. The same repo can power any number of apps with different root directories.
