An open API service indexing awesome lists of open source software.

https://github.com/shahidmalik4/fastapi-react-blog

A full-stack blog application built with React and FastAPI, featuring CRUD functionality, RESTful API integration, and modern UI using Bootstrap
https://github.com/shahidmalik4/fastapi-react-blog

blog bootstrap fastapi javascript python reactjs rest-api sqlalchemy sqlite3

Last synced: 3 months ago
JSON representation

A full-stack blog application built with React and FastAPI, featuring CRUD functionality, RESTful API integration, and modern UI using Bootstrap

Awesome Lists containing this project

README

          

# ๐Ÿ“ Blog App โ€” React + FastAPI

A **full-stack blog application** built with **React (Vite)** and **FastAPI**, supporting full **CRUD operations**, responsive UI with **Bootstrap**, and **SQLite** for persistent data storage. Clean architecture and RESTful design.

---

## ๐Ÿ“ Project Structure

```
project-root/
โ”‚
โ”œโ”€โ”€ backend/ # FastAPI backend
โ”‚ โ”œโ”€โ”€ alembic/ # Alembic migrations
โ”‚ โ”œโ”€โ”€ app/ # Core FastAPI application
โ”‚ โ”‚ โ”œโ”€โ”€ crud.py # DB operations
โ”‚ โ”‚ โ”œโ”€โ”€ database.py # DB setup
โ”‚ โ”‚ โ”œโ”€โ”€ main.py # FastAPI app entry point
โ”‚ โ”‚ โ”œโ”€โ”€ models.py # SQLAlchemy models
โ”‚ โ”‚ โ”œโ”€โ”€ routes.py # API routes
โ”‚ โ”‚ โ”œโ”€โ”€ schemas.py # Pydantic schemas
โ”‚ โ”‚ โ””โ”€โ”€ seed.py # Optional DB seed script
โ”‚ โ”œโ”€โ”€ blog.db # SQLite database
โ”‚ โ””โ”€โ”€ requirements.txt # Python dependencies
โ”‚
โ”œโ”€โ”€ frontend/ # React frontend (Vite)
โ”‚ โ”œโ”€โ”€ public/ # Static files
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”‚ โ”œโ”€โ”€ assets/ # Images & styling
โ”‚ โ”‚ โ”œโ”€โ”€ components/ # Reusable components (Navbar, BlogList)
โ”‚ โ”‚ โ”œโ”€โ”€ pages/ # Page views (CreatePost, BlogDetail)
โ”‚ โ”‚ โ”œโ”€โ”€ App.jsx # Main app component
โ”‚ โ”‚ โ””โ”€โ”€ main.jsx # React entry point
โ”‚ โ”œโ”€โ”€ index.html # Base HTML file
โ”‚ โ”œโ”€โ”€ package.json # JS dependencies
โ”‚ โ””โ”€โ”€ vite.config.js # Vite config
โ”‚
โ””โ”€โ”€ .gitignore # Ignored files for Git
```

---

## ๐Ÿš€ Features

- โœ… Create, Read, Update, Delete (CRUD) blog posts
- โœ… RESTful API with FastAPI
- โœ… React frontend built with Vite
- โœ… Responsive UI using Bootstrap
- โœ… SQLite for lightweight storage
- โœ… Clean separation of frontend and backend

---

## ๐Ÿ“ฆ Tech Stack

| Frontend | Backend | Database | Styling | Others |
|----------------|----------------|----------|-----------|--------------|
| React (Vite) | FastAPI | SQLite | Bootstrap | Axios, Alembic |

---

## โš™๏ธ Getting Started

### 1. ๐Ÿ”ฅ Backend Setup

```bash
cd backend
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload
```

### 2. โšก Frontend Setup

```bash
cd frontend
npm install
npm run dev
```

- Frontend runs on: `http://localhost:5173`
- Backend runs on: `http://localhost:8000`

---

## ๐Ÿงช Example Routes (FastAPI)

| Method | Endpoint | Description |
|--------|------------------|------------------------|
| GET | `/blogs` | Fetch all blog posts |
| GET | `/blogs/{id}` | Get a single post |
| POST | `/blogs` | Create a blog post |
| PUT | `/blogs/{id}` | Update a blog post |
| DELETE | `/blogs/{id}` | Delete a blog post |

---