A REST API for storing and retrieving text snippets with a TTL. Built as a system design study project.
- FastAPI — HTTP API
- PostgreSQL — persistent storage
- Redis — TTL-aware cache
- SQLModel — ORM + validation
| Method | Path | Description |
|---|---|---|
POST |
/pastes/ |
Create a paste |
GET |
/pastes/{code} |
Retrieve a paste |
{
"input": "print('hello world')",
"language": "python",
"ttl": 3600
}Returns the created paste with a short code and expiration_time.
Returns the paste if still valid. Returns 410 Gone if expired.
Prerequisites: Python 3.11+, PostgreSQL, Redis
pip install -r requirements.txtfastapi dev app/main.pySee docs/ARCHITECTURE.md.