{"id":21254264,"url":"https://github.com/faraasat/flask-vercel-example","last_synced_at":"2025-04-14T04:16:31.034Z","repository":{"id":226244204,"uuid":"727338124","full_name":"faraasat/flask-vercel-example","owner":"faraasat","description":"Example code for article - Simple Guide on Deploying Python Flask API on Vercel — Free of Cost","archived":false,"fork":false,"pushed_at":"2024-03-07T05:43:14.000Z","size":5,"stargazers_count":4,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T04:16:22.154Z","etag":null,"topics":["application-programming-interface","deployment","flask","flask-api","python","python3","vercel","vercel-deployment"],"latest_commit_sha":null,"homepage":"https://flask-vercel-example-tfih.vercel.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faraasat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-04T17:01:54.000Z","updated_at":"2025-02-23T03:02:08.000Z","dependencies_parsed_at":"2024-03-06T17:16:52.302Z","dependency_job_id":"4c3f5f5d-daa4-43da-87cd-e96e56e6313e","html_url":"https://github.com/faraasat/flask-vercel-example","commit_stats":null,"previous_names":["faraasat/flask-vercel-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faraasat%2Fflask-vercel-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faraasat%2Fflask-vercel-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faraasat%2Fflask-vercel-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faraasat%2Fflask-vercel-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faraasat","download_url":"https://codeload.github.com/faraasat/flask-vercel-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819410,"owners_count":21166477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["application-programming-interface","deployment","flask","flask-api","python","python3","vercel","vercel-deployment"],"created_at":"2024-11-21T03:54:55.071Z","updated_at":"2025-04-14T04:16:31.000Z","avatar_url":"https://github.com/faraasat.png","language":"Python","readme":"# Flask Vercel Example\n\n### This Example Code is a Part of an Article: Simple Guide on Deploying Python Flask API on Vercel — Free of Cost\n\n\u003chr /\u003e\n\n##### Live Url: [Deployment](https://flask-vercel-example-tfih.vercel.app/)\n##### Article Link: [Medium](https://faraasat.medium.com/simple-guide-on-deploying-python-flask-api-on-vercel-free-of-cost-2c8bd983a40b)\n\n\u003chr /\u003e\n\n### Introduction:\nWhether you’re working on a hobby project or a professional endeavor, deployment is essential. Flask, a lightweight and versatile Python web framework, is commonly used for building web applications due to its simplicity and flexibility. In this guide, we’ll explore deploying a Python Flask API on Vercel, a platform that offers straightforward deployment with continuous integration, and the best part — it’s free!\n\n### Steps for Deployment:\n\n#### 1. Initialize the Project:\n- Create a new project directory (e.g., flask-api-example).\n- Set up a virtual environment (optional but recommended).\n- Install Python and any IDE (if not already installed).\n#### 2. Add Dependencies:\n- Specify your app’s dependencies in a requirements.txt file.\n- Install the dependencies using pip install -r requirements.txt.\n#### 3. Write the API:\n- Create an /api directory (or any name you prefer).\n- Inside this directory, create an index.py file with your Flask API code.\n- Define routes and handlers (e.g., a simple home route and a 404 error handler).\n#### 4. Configure .gitignore:\n- Initialize a Git repository (git init).\n- Create a .gitignore file to exclude specific files and directories (e.g., .vscode, .venv, etc.).\n#### 5. Configure vercel.json:\n- Add a vercel.json file at the root of your app.\n- Specify rewrite rules to route requests to your Flask API (e.g., from /api to /api/index).\n#### 6. Deploy on Vercel:\n- Using Vercel CLI:\n    - Install Vercel CLI globally (npm i -g vercel).\n    - Log in to the CLI using vercel login.\n- Deploy using vercel commands.\n    - Using GitHub/GitLab Integration:\n    - Connect your Vercel account to your Git repository.\n    - Automatically deploy on every push to the repository.\n \n### Result:\n![screencapture-flask-vercel-example-tfih-vercel-app-2024-03-06-20_19_16](https://github.com/faraasat/flask-vercel-example/assets/63093876/8be54a24-bf61-4391-bdf0-84f50e2cef27)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaraasat%2Fflask-vercel-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaraasat%2Fflask-vercel-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaraasat%2Fflask-vercel-example/lists"}