Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jhonyes04/new-wayfy/llms.txt

Use this file to discover all available pages before exploring further.

WayFy’s production architecture on Render consists of three resources: a Web Service running the Flask/Gunicorn backend, a Static Site serving the compiled React frontend, and a Managed PostgreSQL database. The backend and database communicate over Render’s internal network; the frontend is a fully static build served from a CDN edge with no server-side runtime required.

Prerequisites

Have the following ready before you start:
  • A Render account with your WayFy repository connected to GitHub
  • A Cloudinary account (for image upload storage)
  • A Mapbox public access token (for the map)
  • A Groq API key (for the AI assistant)

Backend Deployment

1

Create a new Render Web Service

In the Render dashboard, click New → Web Service and connect your GitHub repository. Select the branch you want to deploy (typically main).
2

Set the root directory

Under Root Directory, enter:
backend
Render will scope all build and start commands to this directory.
3

Configure the build command

Set Build Command to:
pip install -r requirements.txt
4

Configure the start command

WayFy’s backend includes a Procfile and a src/wsgi.py entry point. Set Start Command to:
gunicorn wsgi --chdir ./src/
This matches the web: entry in the repository’s Procfile. Gunicorn changes into the src/ subdirectory, loads wsgi.py, and serves the application object exported from that module.
The Procfile also defines a release: phase (pipenv run upgrade) that Render runs automatically before every deploy to apply any pending database migrations. No manual migration step is required on Render if you use the Procfile.
5

Set environment variables

In the Environment tab of the Web Service, add the following key-value pairs:
VariableDescription
DATABASE_URLInternal Database URL from your Render PostgreSQL instance (see next step)
FLASK_APPsrc/app.py
FLASK_APP_KEYFlask session secret key — any long random string
JWT_SECRET_KEYA long, random secret string — required at startup
JWT_ACCESS_TOKEN_EXPIRES_HOURSJWT token lifetime in hours (default: 1)
GROQ_API_KEYYour Groq API key (gsk_...)
CLOUDINARY_CLOUD_NAMEYour Cloudinary cloud name
CLOUDINARY_API_KEYYour Cloudinary API key
CLOUDINARY_API_SECRETYour Cloudinary API secret
CORS_ALLOWED_ORIGINSYour frontend’s Render URL (e.g. https://wayfy.onrender.com) — add after the static site is created
CONTACT_EMAILEmail address used for outbound contact messages
6

Create a PostgreSQL database and link it

In the Render dashboard, click New → PostgreSQL and create a database in the same region as your Web Service. Once provisioned:
  1. Open the database’s Info page.
  2. Copy the Internal Database URL (begins with postgres://).
  3. Paste it as the value of DATABASE_URL in your Web Service’s environment variables.
Render’s PostgreSQL connection strings start with postgres://, but SQLAlchemy 1.4+ requires postgresql://. WayFy’s Flask app automatically rewrites the prefix at startup — you do not need to modify the URL manually.

Frontend Deployment

1

Create a new Render Static Site

In the Render dashboard, click New → Static Site and connect the same GitHub repository.
2

Set the root directory

Under Root Directory, enter:
frontend
3

Configure the build command

Set Build Command to:
pnpm install && npm run build
This installs dependencies with pnpm and then runs the Vite production build, outputting to frontend/dist/.
4

Set the publish directory

Set Publish Directory to:
dist
5

Set environment variables

In the Environment tab of the Static Site, add:
VariableValue
VITE_BACKEND_URLThe full URL of your deployed Render Web Service (e.g. https://wayfy-api.onrender.com)
VITE_MAPBOX_TOKENYour Mapbox public access token (pk.eyJ1...)
VITE_BASENAME/
Vite bakes environment variables into the static bundle at build time. If you change VITE_BACKEND_URL after an initial deploy, trigger a Manual Deploy to rebuild and re-bundle the updated value.

Post-Deployment Steps

Run database migrations

After the backend Web Service is live, open a shell to run migrations against the production database. In the Render dashboard, navigate to your Web Service and open the Shell tab, then run:
flask db upgrade
This applies all pending Alembic migrations and creates the required tables in the Render PostgreSQL database.

Configure CORS

Once the frontend Static Site is deployed and you have its public URL (e.g. https://wayfy.onrender.com), return to your backend Web Service’s environment variables and set:
CORS_ALLOWED_ORIGINS=https://wayfy.onrender.com
Save the change — Render will automatically redeploy the backend with the updated CORS policy.
JWT_SECRET_KEY is required. If this environment variable is missing or empty when the Flask application starts, it raises a RuntimeError and the service will fail to boot. Always set this before your first deploy.

Build docs developers (and LLMs) love