Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write APIs as Serverless Functions in Vercel #162

Open
agennadi opened this issue Jan 21, 2025 · 0 comments
Open

Write APIs as Serverless Functions in Vercel #162

agennadi opened this issue Jan 21, 2025 · 0 comments
Assignees
Labels

Comments

@agennadi
Copy link
Collaborator

agennadi commented Jan 21, 2025

Context

It's time to host the backend by transitioning to serverless functions in Vercel.

Definition of Done

  • Tsunami, Soft Story and Liquefaction APIs are implemented as serverless functions in Vercel.
  • All Tsunami, Soft Story and Liquefaction endpoints currently handled by FastAPI are functional as serverless functions.

Engineering Details

  1. Use Vercel's Python runtime for creating the serverless functions.
  2. Add vercel.json to handle routing.
  3. Place the FastAPI app in the api directory in the root folder and import the routers from the backend/api/routers.
  4. Add requirements.txt to the api folder, which contains only necessary dependencies. A serverless function can't weigh more than 250MB, so every dependecy matters.
  5. Test endpoints locally using the Vercel CLI (vercel dev) to ensure proper functionality before deployment.

Vercel Docs: Advanced Python Usage
Example Repository: Next.js + FastAPI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Blocked
Development

No branches or pull requests

1 participant