How veenzent/scissor_url works
Project type and purpose
• This is a full-stack URL-shortener service (“Scissor API”)
• Frontend: static HTML/CSS/JS under frontend/
• Backend: Python FastAPI app in main.py + scissorapp/ package
• Persistence: relational database (configured via scissorapp/instance/config.py)
• Auxiliary functionality: rate-limiting (scissorapp/rate_limiter.py), dependency injection, OpenAPI docs
File structure
• Top-level
• frontend/ – static site assets and scissor.js (calls the API)
• main.py – entry point, mounts routers and static files
• requirements.txt – external libraries (e.g. FastAPI, SQLAlchemy, an async driver)
• scissorapp/
– routers/link_shortener.py – API endpoints
– models.py – ORM model(s) for URL mappings
– schemas.py – Pydantic request/response models
– database.py – DB session / engine setup
– dependencies.py – DI helpers (get_db, get_rate_limiter, etc.)
– rate_limiter.py – rate-limit logic
– instance/config.py – environment-specific settings (DB URL, secrets)
• Test harness in test_main.py
README
• Confirms FastAPI (“docs” at /docs)
• Purpose: expose a simple URL-shortening REST API
• Deployment hint: runs on Render.com
Diagramming conventions
• Labels: Use component names (Frontend UI, FastAPI Router, DB Session Factory, PostgreSQL)
• Solid → request/response flow
• Green for API server components
Detailed capture
• main.py bootstrapping: mounting static files + routers
• How dependencies.py ties together DB and rate limiter per request
• routers/link_shortener.py endpoints (POST /shorten, GET /{id})
• OpenAPI docs endpoint (/docs) as a subcomponent of the API server