Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vlntsolo/fastapi-urlshortener
Blazing fast URL shortener built with FastAPI and async Postgres
https://github.com/vlntsolo/fastapi-urlshortener
asyncpg fastapi sqlalchemy url-shortener
Last synced: about 1 month ago
JSON representation
Blazing fast URL shortener built with FastAPI and async Postgres
- Host: GitHub
- URL: https://github.com/vlntsolo/fastapi-urlshortener
- Owner: vlntsolo
- License: mit
- Created: 2022-04-13T19:48:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-13T19:55:31.000Z (over 2 years ago)
- Last Synced: 2024-06-08T23:35:15.485Z (6 months ago)
- Topics: asyncpg, fastapi, sqlalchemy, url-shortener
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - fastapi-urlshortener - Blazing fast URL shortener built with FastAPI and async Postgres (Python)
README
# Blazing fast URL shortener 🚀
This url shortener is built with FastAPI and asyncpg driver for Postgres, so you can expect it to be pretty responsive (3-6 ms).
## Getting started with local server
1. CD into project root and install python packages with `pipenv install` or you with preffered package manager.
2. Spin up new local postgres database. This setup uses Postgres *asyncpg* driver.
3. Create `.env` file with the following contents and modify your postgres credentials/db name.```
DATABASE_URL=postgresql+asyncpg://postgres:root@localhost/dbname
APPLICATION_SECRET=123456
CURRENT_HOST=http://127.0.0.1:8000
PRIVATE_MODE=False
ENV_NAME=development
```
4. Run `uvicorn app:app --reload`
5. Inspect API documentation served with Swagger [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)## Private mode
If your don't want to go public, then set `PRIVATE_MODE=True` and adjust your client request headers to include Authorization token.
Sample:
`"Authorization": "Bearer {APPLICATION_SECRET}"`