Deployment
General Description¶
Deployment on Vercel is supported, with dedicated buttons for the Frontend and Backend applications. Both require specific configurations during and after deployment to ensure correct operation.
Frontend Deployment¶
- Click the Frontend button above to start the deployment process.
- During deployment, you will be asked to configure
API_BASE_URL. Use a provisional value (e.g.,https://) for now, as it will be updated with the backend URL later. - Complete the deployment process here.
Backend Deployment¶
- Click the Backend button above to start deployment.
- First, configure the database. The connection is automatically configured, so follow the steps and it should work by default.
- During the deployment process, you will be asked to configure the following environment variables:
-
CORS_ORIGINS
- Set this to
["*"]initially to allow all origins. Later, you can update this with the frontend URL.
- Set this to
-
ACCESS_SECRET_KEY, RESET_PASSWORD_SECRET_KEY, VERIFICATION_SECRET_KEY
- During deployment, you can temporarily set these secret keys to simple text strings (e.g.,
examplesecret). However, you must generate secure keys and update them after deployment in the Post-Deployment Configuration section.
- During deployment, you can temporarily set these secret keys to simple text strings (e.g.,
-
Complete the deployment process here.
CI Configuration (GitHub Actions) for Production Deployment¶
We provide the prod-api-deploy.yml and prod-ui-deploy.yml files to enable continuous integration through GitHub Actions. To connect them to GitHub, simply move them to the .github/workflows/ directory.
You can do this with the following commands:
mv prod-api-deploy.yml .github/workflows/prod-api-deploy.yml
mv prod-ui-deploy.yml .github/workflows/prod-ui-deploy.yml
Prerequisites¶
- Create a Vercel Token:
- Generate your Vercel Access Token.
-
Save the token as
VERCEL_TOKENin your GitHub secrets. -
Install Vercel CLI:
pnpm i -g vercel@latest - Authenticate your account:
vercel login
Database Creation (Required)¶
- Choose a Database
-
You can use your hosted database on a different service or opt for the Neon database, which integrates perfectly with Vercel.
-
Configure a Neon Database through Vercel
- On your Project Dashboard page in Vercel, navigate to the Storage section.
-
Select the Create a Database option to provision a Neon database.
-
Configure Database URL
- After creating the database, get the Database URL provided by Neon.
-
Include this URL in your Environment Variables under
DATABASE_URL. -
Migrate the Database
- Database migration will occur automatically during the GitHub Action deployment, setting up the necessary tables and schema.
Frontend Configuration¶
-
Link the
uiproject. -
Navigate to the
uidirectory and run:cd ui vercel link - Follow the instructions:
- Link to an existing project? No
-
Modify settings? No
-
Save Project IDs and add GitHub Secrets:
-
Open
ui/.vercel/project.jsonand add the following to your GitHub repository secrets: projectId→VERCEL_PROJECT_ID_FRONTENDorgId→VERCEL_ORG_ID
Backend Configuration¶
-
Link the
apiproject. -
Navigate to the
apidirectory and run:
cd api
vercel link --local-config=vercel.prod.json
-
We use a specific configuration file to set the
--local-configvalue. -
Follow the instructions:
- Link to an existing project? No
-
Modify settings? No
-
Save Project IDs and add GitHub Secrets:
-
Open
api/.vercel/project.jsonand add the following to your GitHub repository secrets: projectId→VERCEL_PROJECT_ID_BACKEND-
orgId→VERCEL_ORG_ID(Only in case you haven't added it before) -
Update requirements.txt:
cd api
uv export > requirements.txt
- It is necessary to export a new
requirements.txtfile for Vercel deployment whenuv.lockis modified.
Notes¶
- Once everything is configured, run
git pushand deployment will happen automatically. - Please ensure you complete the setup for both frontend and backend separately.
- See the Vercel CLI Documentation for more details.
- You can find the
project_idin the project settings on the Vercel web portal. - You can find the
organization_idin the organization settings on the Vercel web portal.
Post-Deployment Configuration¶
Frontend¶
- Navigate to the Settings page of the deployed frontend project.
- Go to the Environment Variables section.
- Update the
API_BASE_URLvariable with the backend URL once the backend deployment is complete.
Backend¶
- Access the Settings page of the deployed backend project.
- Navigate to the Environment Variables section and update the following variables with secure values:
-
CORS_ORIGINS
- Once the frontend is deployed, replace
["*"]with the actual frontend URL.
- Once the frontend is deployed, replace
-
ACCESS_SECRET_KEY
- Generate a secure key for API access and configure it here.
-
RESET_PASSWORD_SECRET_KEY
- Generate a secure key for password reset functionality and configure it.
-
VERIFICATION_SECRET_KEY
- Generate a secure key for user verification and configure it.
-
For detailed instructions on how to configure these secret keys, see the Environment Variable Configuration section.
Enabling Fluid Serverless¶
Fluid is Vercel's new concurrency model for serverless functions, allowing them to handle multiple requests per execution instead of starting a new instance for each request. This improves performance, reduces cold starts, and optimizes resource usage, making serverless workloads more efficient.
Follow this guide to activate Fluid.