{"id":51075359,"url":"https://github.com/codestorm-official/selenium-fastapi","last_synced_at":"2026-06-23T13:41:17.571Z","repository":{"id":340162668,"uuid":"1111501984","full_name":"codestorm-official/selenium-fastapi","owner":"codestorm-official","description":"A lightweight template for running Selenium-based web scraping with FastAPI on Railway. It includes headless Chromium, an optimized ChromeDriver setup, and a ready-to-use scraping endpoint, making it ideal for efficient browser automation and dependable data extraction.","archived":false,"fork":false,"pushed_at":"2025-12-07T05:31:22.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-23T22:49:20.319Z","etag":null,"topics":["scraping","scraping-framework","scraping-web","scraping-websites","selenium","selenium-python"],"latest_commit_sha":null,"homepage":"https://railway.com/deploy/selenium-fastapi","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/codestorm-official.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-07T04:07:50.000Z","updated_at":"2025-12-07T05:31:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codestorm-official/selenium-fastapi","commit_stats":null,"previous_names":["codestorm-official/selenium-fastapi"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/codestorm-official/selenium-fastapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fselenium-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fselenium-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fselenium-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fselenium-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codestorm-official","download_url":"https://codeload.github.com/codestorm-official/selenium-fastapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fselenium-fastapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34692769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["scraping","scraping-framework","scraping-web","scraping-websites","selenium","selenium-python"],"created_at":"2026-06-23T13:41:17.103Z","updated_at":"2026-06-23T13:41:17.562Z","avatar_url":"https://github.com/codestorm-official.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Selenium FastAPI\n\nDeploy an independent FastAPI scraper on Railway with Selenium running as a separate browser service.\n\n[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/selenium-fastapi?referralCode=asepsp\u0026utm_medium=integration\u0026utm_source=template\u0026utm_campaign=generic)\n\n## Architecture\n\nThis template is designed for 2 Railway services in the same project:\n\n| Service | Source | Purpose |\n| ------- | ------ | ------- |\n| `api` | This repository | Independent FastAPI app and scraper routes |\n| `selenium` | `selenium/standalone-chrome` | Independent Remote Chrome browser service |\n\nThe FastAPI service connects to Chrome through Remote WebDriver:\n\n```python\ndriver = webdriver.Remote(\n    command_executor=SELENIUM_URL,\n    options=options,\n)\n```\n\n## Railway Setup\n\n1. Deploy this repository as the FastAPI service.\n2. Add another service from Docker image:\n\n   ```text\n   selenium/standalone-chrome\n   ```\n\n3. Name the browser service `selenium`.\n4. Set the FastAPI service variables from `.env.example`.\n\nThe required Selenium connection value is:\n\n```text\nSELENIUM_URL=http://selenium.railway.internal:4444/wd/hub\n```\n\nRailway private networking lets services in the same project communicate with\n`SERVICE_NAME.railway.internal`, so the Selenium service does not need to be\npublicly exposed.\n\n## Environment Variables\n\nCopy `.env.example` to `.env` for local development. On Railway, add the same\nvalues in the FastAPI service Variables tab.\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| `PORT` | `8000` | HTTP port used by Gunicorn |\n| `SELENIUM_URL` | `http://selenium.railway.internal:4444/wd/hub` | Selenium Remote WebDriver URL |\n| `SCRAPE_URL` | `https://www.scrapethissite.com/` | URL loaded by the example scraper |\n| `LOG_LEVEL` | `INFO` | Application log level |\n| `GUNICORN_HOST` | `0.0.0.0` | Host used when `GUNICORN_BIND` is empty |\n| `GUNICORN_BIND` | empty | Optional full bind override, for example `0.0.0.0:8000` |\n| `GUNICORN_WORKERS` | `2` | Number of Gunicorn workers |\n| `GUNICORN_WORKER_CLASS` | `uvicorn.workers.UvicornWorker` | ASGI worker class for FastAPI |\n| `GUNICORN_TIMEOUT` | `120` | Worker timeout in seconds |\n| `GUNICORN_KEEPALIVE` | `5` | Keep-alive timeout in seconds |\n| `GUNICORN_LOG_LEVEL` | `info` | Gunicorn log level |\n| `GUNICORN_ACCESS_LOG` | `-` | Access log target |\n| `GUNICORN_ERROR_LOG` | `-` | Error log target |\n\n## Endpoints\n\n| Route | Description |\n| ----- | ----------- |\n| `/` | Basic status check and scrape test endpoint hint |\n| `/scrape` | Example scraper using the remote Selenium Chrome service |\n\n## Local Development\n\nCreate a local env file:\n\n```bash\ncp .env.example .env\n```\n\nRun the FastAPI service independently:\n\n```bash\npip install -r requirements.txt\ngunicorn -c settings.py main:app\n```\n\nThe Selenium browser must be reachable at `SELENIUM_URL`. For Railway, use the\nprivate service URL. For another local or external Selenium service, update\n`SELENIUM_URL` in `.env`.\n\nThen open:\n\n```text\nhttp://localhost:8000/scrape\n```\n\n## File Structure\n\n```text\n.\n├── .env.example\n├── Dockerfile\n├── settings.py\n├── main.py\n└── requirements.txt\n```\n\n## Notes\n\n* The FastAPI image does not install Chromium or Chromedriver.\n* Browser automation runs inside `selenium/standalone-chrome`.\n* Gunicorn serves the FastAPI app through `uvicorn.workers.UvicornWorker`.\n* Add request throttling, queues, or worker separation if scrape workloads become heavy.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodestorm-official%2Fselenium-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodestorm-official%2Fselenium-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodestorm-official%2Fselenium-fastapi/lists"}