A FastAPI backend for the Flashcards application.
We will use uv to create a virtual environment, and install our dependencies.
uv venv
uv syncYou can then run the FastAPI dev server
uv run fastapi dev
# or with your venv
source .venv/bin/activate
fastapi devThe API will be available at http://localhost:8000
Once the server is running, you can access:
- Interactive API docs (Swagger UI): http://localhost:8000/docs
- Alternative API docs (ReDoc): http://localhost:8000/redoc
curl http://localhost:8000/deckscurl http://localhost:8000/decks/{deck_id}curl -X POST http://localhost:8000/decks/import \
-H "Content-Type: application/json" \
-d @data/sample-deck.jsoncurl -X PUT http://localhost:8000/decks/{deck_id} \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Deck Name",
"description": "Updated description"
}'curl -X POST http://localhost:8000/decks/{deck_id}/cards \
-H "Content-Type: application/json" \
-d '{
"front": "What is the capital of France?",
"back": "Paris"
}'curl -X DELETE http://localhost:8000/decks/{deck_id}/cards/{card_id}Note: Replace {deck_id} and {card_id} with actual IDs in the above commands.