{"id":51075352,"url":"https://github.com/codestorm-official/flask-api","last_synced_at":"2026-06-23T13:41:17.164Z","repository":{"id":344226244,"uuid":"1181027118","full_name":"codestorm-official/flask-api","owner":"codestorm-official","description":"A minimal Flask RESTful API.","archived":false,"fork":false,"pushed_at":"2026-03-13T18:12:05.000Z","size":9,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-14T05:22:18.243Z","etag":null,"topics":["flask","flask-api","flask-restful","flask-starter"],"latest_commit_sha":null,"homepage":"https://railway.com/deploy/flask-restful-api","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","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":"LICENSE","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":"2026-03-13T17:07:36.000Z","updated_at":"2026-03-13T17:17:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codestorm-official/flask-api","commit_stats":null,"previous_names":["codestorm-official/flask-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/codestorm-official/flask-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fflask-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fflask-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fflask-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fflask-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codestorm-official","download_url":"https://codeload.github.com/codestorm-official/flask-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codestorm-official%2Fflask-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34692768,"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":["flask","flask-api","flask-restful","flask-starter"],"created_at":"2026-06-23T13:41:16.382Z","updated_at":"2026-06-23T13:41:17.159Z","avatar_url":"https://github.com/codestorm-official.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Flask RESTful API Starter - Railway Ready\n\nFlask RESTful API starter template ready to deploy on Railway (`railway.app`), with a clean folder structure, SOLID design, and a standardized response shape.\n\n[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/flask-restful-api?referralCode=asepsp\u0026utm_medium=integration\u0026utm_source=template\u0026utm_campaign=generic)\n\n### Features\n\n- **Clean folder structure** using an application factory (`app/`).\n- **Standardized API response**:\n\n```json\n{\n  \"data\": {},\n  \"status\": 200,\n  \"message\": \"Success\"\n}\n```\n\n- **Built-in endpoints**:\n  - `GET /` – root application info.\n  - `GET /health` – simple health check.\n  - `GET /status` – service status \u0026 uptime.\n- **Docker-ready**: includes `Dockerfile`, `.dockerignore`.\n- **Railway-ready**: reads `PORT` from environment variables.\n\n### Folder Structure\n\n```text\n.\n├── app\n│   ├── __init__.py        # Application factory \u0026 wiring dependency\n│   ├── config.py          # Configuration (dev/production)\n│   ├── core\n│   │   └── response.py    # ResponseFactory \u0026 ApiResponse (SOLID)\n│   └── routes.py          # Routes / controllers\n├── main.py                # Local entry point (development)\n├── requirements.txt       # Python dependencies\n├── Dockerfile             # Image definition for Railway\n├── .env                   # Local config (do not commit)\n├── .env.example           # Example env file\n├── .gitignore\n├── .dockerignore\n├── LICENSE\n└── README.md\n```\n\n### Local Setup \u0026 Run\n\n1. **Create a virtual environment**\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate  # Linux / macOS\n# or\n.venv\\Scripts\\activate     # Windows\n```\n\n2. **Install dependencies**\n\n```bash\npip install -r requirements.txt\n```\n\n3. **Create a `.env` file**\n\n```bash\ncp .env.example .env\n```\n\nAdjust values if needed.\n\n4. **Run the server (development)**\n\n```bash\npython main.py\n```\n\nThe app will run at `http://localhost:8000` (based on `PORT` in `.env`).\n\n### Built-in Endpoints\n\n- **GET `/`**\n  - **Description**: root endpoint that returns basic app info and environment.\n  - **Example response**:\n\n```json\n{\n  \"data\": {\n    \"app\": \"Flask Railway API\",\n    \"environment\": \"development\"\n  },\n  \"status\": 200,\n  \"message\": \"Root endpoint\"\n}\n```\n\n- **GET `/health`**\n\n```json\n{\n  \"data\": {\n    \"healthy\": true\n  },\n  \"status\": 200,\n  \"message\": \"Health check OK\"\n}\n```\n\n- **GET `/status`**\n\n```json\n{\n  \"data\": {\n    \"uptime_seconds\": 12,\n    \"environment\": \"development\"\n  },\n  \"status\": 200,\n  \"message\": \"Service status\"\n}\n```\n\n### Deploy to Railway (Dockerfile)\n\n1. Push this project to a Git repository (GitHub/GitLab).\n2. In Railway:\n   - Create New Project → Deploy from Repo.\n   - Select this repository.\n   - Railway will detect the `Dockerfile`.\n3. Set minimum **Environment Variables**:\n   - `ENVIRONMENT=production`\n   - (optional) `APP_NAME`, `PORT` (Railway typically provides `PORT` automatically).\n\nThe Dockerfile runs `gunicorn`:\n\n```bash\ngunicorn -w 3 -b 0.0.0.0:8000 main:app\n```\n\nRailway provides the port via the `PORT` environment variable, while this image exposes `8000`. If you want to strictly bind to Railway's `PORT`, update the `CMD` in the `Dockerfile` to read `PORT` dynamically.\n\n### Design Notes (SOLID)\n\n- **Single Responsibility**:\n  - `ResponseFactory` only handles response shape.\n  - `routes.py` defines endpoints and uses injected dependencies.\n  - `config.py` handles configuration.\n- **Open/Closed**:\n  - To add new response types (e.g., pagination), add a new method in `ResponseFactory` without changing existing ones.\n- **Simple Dependency Injection**:\n  - `ResponseFactory` is injected into the app (`app.response_factory`) and accessed via `current_app` inside endpoints.\n\nYou can add more blueprints/routes and keep the response shape consistent by using `ResponseFactory`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodestorm-official%2Fflask-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodestorm-official%2Fflask-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodestorm-official%2Fflask-api/lists"}