Skip to content

Logyxx/api-library-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š API Library Manager

A REST API for cataloguing and managing API resources β€” built with FastAPI and SQLite. Full CRUD, search, pagination, and auto-generated interactive docs.

Python FastAPI SQLite License

πŸš€ Live Demo

πŸ”— API on Render Β· Interactive Docs

⚠️ Free tier β€” may take 30–60 seconds to wake up on first request.

πŸ“Έ Screenshots

Swagger UI

✨ Features

  • Full CRUD β€” Create, Read, Update, Delete API resources
  • Search β€” filter by name, description, or URL (case-insensitive)
  • Pagination β€” skip & limit query params
  • Auto docs β€” Swagger UI at /docs, ReDoc at /redoc
  • Input validation β€” Pydantic v2 models, duplicate URL detection
  • Zero-config DB β€” SQLite, no external database server needed

πŸ› οΈ Tech Stack

Technology Purpose
Python 3.10+ Core language
FastAPI Web framework
SQLAlchemy ORM / database layer
SQLite Embedded database
Pydantic v2 Request/response validation
Uvicorn ASGI server
Render Cloud deployment

πŸ“¦ Getting Started

# Clone the repo
git clone https://github.com/ByteMe-UK/api-library-manager.git
cd api-library-manager

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the API
uvicorn app.main:app --reload

Open http://localhost:8000/docs for the interactive Swagger UI.

πŸ“‘ API Endpoints

Method Endpoint Description
GET / Welcome + endpoint index
GET /api/ List all resources (supports search + pagination)
POST /api/ Create a new resource
GET /api/{id} Get a resource by ID
PUT /api/{id} Update a resource (partial update supported)
DELETE /api/{id} Delete a resource

Query Parameters (GET /api/)

Param Type Default Description
search string β€” Filter by name, description, or URL
skip int 0 Records to skip (pagination offset)
limit int 20 Max records returned (capped at 100)

Example Requests

# Create a resource
curl -X POST http://localhost:8000/api/ \
  -H "Content-Type: application/json" \
  -d '{"name": "OpenWeather API", "description": "Free weather data", "url": "https://api.openweathermap.org"}'

# List all
curl http://localhost:8000/api/

# Search
curl "http://localhost:8000/api/?search=weather"

# Paginate
curl "http://localhost:8000/api/?skip=0&limit=5"

# Update
curl -X PUT http://localhost:8000/api/1 \
  -H "Content-Type: application/json" \
  -d '{"description": "Updated description"}'

# Delete
curl -X DELETE http://localhost:8000/api/1

Example Response

{
  "id": 1,
  "name": "OpenWeather API",
  "description": "Free weather data",
  "url": "https://api.openweathermap.org"
}

πŸ“ Project Structure

api-library-manager/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py        ← FastAPI app, all endpoints
β”‚   β”œβ”€β”€ database.py    ← SQLAlchemy engine, session, APIResource model
β”‚   β”œβ”€β”€ schemas.py     ← Pydantic v2 request/response schemas
β”‚   └── models.py      ← (reserved for future model expansion)
β”œβ”€β”€ Procfile           ← Render deployment config
β”œβ”€β”€ requirements.txt   ← Python dependencies
β”œβ”€β”€ LICENSE
└── README.md

🚒 Deployment (Render)

  1. Push this repo to GitHub
  2. Go to render.com β†’ New Web Service
  3. Connect your GitHub repo
  4. Set Start Command: uvicorn app.main:app --host 0.0.0.0 --port $PORT
  5. Click Deploy

The Procfile already has the correct start command.

πŸ“„ License

MIT License β€” see LICENSE for details.


Part of the ByteMe-UK portfolio collection.

hello

About

πŸ“š CRUD REST API for managing a book library β€” FastAPI + SQLite with auto-generated docs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors