{"id":30142106,"url":"https://github.com/shahidmalik4/fastapi-html","last_synced_at":"2026-06-23T22:03:49.806Z","repository":{"id":305322932,"uuid":"1021916831","full_name":"shahidmalik4/fastapi-html","owner":"shahidmalik4","description":"A lightweight blog application built with FastAPI, supporting user authentication, HTML server-side rendering, and full CRUD functionality for blog posts.","archived":false,"fork":false,"pushed_at":"2025-07-19T11:41:48.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-19T16:15:39.818Z","etag":null,"topics":["blog","fastapi","html","python","sqlalchemy"],"latest_commit_sha":null,"homepage":"","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/shahidmalik4.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}},"created_at":"2025-07-18T06:43:00.000Z","updated_at":"2025-07-19T11:41:52.000Z","dependencies_parsed_at":"2025-07-19T16:22:12.900Z","dependency_job_id":"dd6d0fea-8f7d-46c3-b8d1-a6485f193acd","html_url":"https://github.com/shahidmalik4/fastapi-html","commit_stats":null,"previous_names":["shahidmalik4/fastapi-html"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/shahidmalik4/fastapi-html","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahidmalik4%2Ffastapi-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahidmalik4%2Ffastapi-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahidmalik4%2Ffastapi-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahidmalik4%2Ffastapi-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahidmalik4","download_url":"https://codeload.github.com/shahidmalik4/fastapi-html/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahidmalik4%2Ffastapi-html/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269837157,"owners_count":24483175,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"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":["blog","fastapi","html","python","sqlalchemy"],"created_at":"2025-08-11T05:40:24.097Z","updated_at":"2026-06-23T22:03:44.760Z","avatar_url":"https://github.com/shahidmalik4.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📝 FastAPI Blog App with Server-Side HTML Rendering\n\n[![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-0.110+-green.svg)](https://fastapi.tiangolo.com/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n[![Status](https://img.shields.io/badge/status-active-brightgreen.svg)](#)\n\nA full-featured blog application built with **FastAPI**, **Jinja2**, and **SQLAlchemy**. Supports server-side HTML rendering, user authentication, flash messaging, and full CRUD functionality — all with clean modular code and session-based route protection.\n\n---\n\n## 🚀 Features\n\n- 🔐 User registration, login, and logout\n- ⚡ Session-based authentication using secure cookies\n- 💬 Flash messages for user feedback\n- 📝 Create, Read, Update, Delete (CRUD) blog posts\n- 🔗 Slug generation for posts\n- 🧰 FastAPI + Jinja2 HTML templating\n- 🧱 SQLite database (easy to swap out)\n- 🛡️ Protected routes (dashboard, create post, etc.)\n- 🗃️ Clean, modular architecture (auth, crud, schemas, models)\n- 🚀 Deployable on **Render**, **Heroku**, or **any ASGI server**\n\n---\n\n## 🧰 Tech Stack\n\n- **Framework**: [FastAPI](https://fastapi.tiangolo.com/)\n- **ORM**: SQLAlchemy\n- **Templates**: Jinja2\n- **Schema Validation**: Pydantic\n- **Database**: SQLite (can be upgraded to PostgreSQL/MySQL)\n- **Web Server**: Uvicorn\n\n---\n\n## 📁 Project Structure\n\n```\nfastapi-html/\n├── app/\n│   ├── auth.py           # Auth routes (register, login, logout)\n│   ├── crud.py           # Post/user CRUD logic\n│   ├── database.py       # SQLAlchemy DB connection\n│   ├── deps.py           # Dependency overrides and helpers\n│   ├── main.py           # App entry point\n│   ├── models.py         # SQLAlchemy models\n│   ├── schemas.py        # Pydantic schemas\n│   ├── templates/        # HTML templates\n│   └── utils.py          # Flash messaging \u0026 helpers\n├── blog_app.db           # SQLite DB file\n├── requirements.txt      # Python dependencies\n├── render.yml            # Render deployment config\n└── README.md             # You're reading it!\n```\n\n---\n\n## 📦 Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/shahidmalik4/fastapi-html.git\ncd fastapi-html\n\n# Create and activate a virtual environment\npython -m venv venv\nsource venv/bin/activate        # Windows: venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Run the server\nuvicorn app.main:app --reload\n```\n\n---\n\n## 🔐 Auth Flow\n\n- `/register`: Register new user\n- `/login`: Login page (sets session)\n- `/logout`: Logout and clear session\n- Routes like `/dashboard` and `/create-post` are protected and require login\n\n---\n\n## 🧑‍💻 CRUD Endpoints\n\n| Route              | Method | Auth Required | Description              |\n|-------------------|--------|---------------|--------------------------|\n| `/register`       | GET/POST | ❌           | Register a new user      |\n| `/login`          | GET/POST | ❌           | Login with credentials   |\n| `/logout`         | GET     | ✅            | Logout user              |\n| `/dashboard`      | GET     | ✅            | View user dashboard      |\n| `/create-post`    | GET/POST | ✅           | Create a new post        |\n| `/edit-post/{id}` | GET/POST | ✅           | Edit an existing post    |\n| `/delete-post/{id}`| GET     | ✅           | Delete a post            |\n| `/post/{slug}`    | GET     | ✅           | View a single post       |\n\n---\n\n## 🧾 Models\n\n```python\n🧍 User (SQLAlchemy)\n📝 Post (SQLAlchemy)\n```\n\n---\n\n## 📦 Pydantic Schemas\n\n```python\nclass UserCreate(BaseModel):\nclass UserOut(BaseModel):\nclass PostBase(BaseModel):\nclass PostCreate(PostBase):\nclass PostOut(PostBase):\n```\n\n---\n\n\n## 📤 Deployment (Render Example)\n\n`render.yml` already included for Render deployment.\n\n\u003e You can also deploy using Docker, Heroku, or any ASGI-compatible cloud.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahidmalik4%2Ffastapi-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahidmalik4%2Ffastapi-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahidmalik4%2Ffastapi-html/lists"}