{"id":13424992,"url":"https://github.com/markqiu/fastapi-mongodb-realworld-example-app","last_synced_at":"2025-03-15T19:32:23.284Z","repository":{"id":41416649,"uuid":"190858035","full_name":"markqiu/fastapi-mongodb-realworld-example-app","owner":"markqiu","description":"Backend logic implementation for https://github.com/gothinkster/realworld with awesome FastAPI","archived":false,"fork":true,"pushed_at":"2022-10-05T07:45:13.000Z","size":135,"stargazers_count":446,"open_issues_count":0,"forks_count":94,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-15T07:11:47.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://fastapi-realworld-example-app.herokuapp.com/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nsidnev/fastapi-realworld-example-app","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markqiu.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-08T07:20:22.000Z","updated_at":"2025-03-13T14:30:25.000Z","dependencies_parsed_at":"2023-01-19T06:15:49.733Z","dependency_job_id":null,"html_url":"https://github.com/markqiu/fastapi-mongodb-realworld-example-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markqiu%2Ffastapi-mongodb-realworld-example-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markqiu%2Ffastapi-mongodb-realworld-example-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markqiu%2Ffastapi-mongodb-realworld-example-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markqiu%2Ffastapi-mongodb-realworld-example-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markqiu","download_url":"https://codeload.github.com/markqiu/fastapi-mongodb-realworld-example-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243781735,"owners_count":20347138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:01:01.619Z","updated_at":"2025-03-15T19:32:22.956Z","avatar_url":"https://github.com/markqiu.png","language":"Python","funding_links":[],"categories":["Projects"],"sub_categories":["Open Source Projects"],"readme":".. image:: logo.png\n\n|\n\n.. image:: https://circleci.com/gh/nsidnev/fastapi-realworld-example-app.svg?style=svg\n    :target: https://circleci.com/gh/markqiu/fastapi-realworld-example-app\n\n.. image:: https://travis-ci.org/nsidnev/fastapi-realworld-example-app.svg?branch=master\n    :target: https://travis-ci.org/markqiu/fastapi-realworld-example-app\n\n.. image:: https://img.shields.io/github/license/Naereen/StrapDown.js.svg\n   :target: https://github.com/markqiu/fastapi-realworld-example-app/blob/master/LICENSE\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/ambv/black\n\nWhat for\n----------\nThis project is a realworld backend based on fastapi+mongodb. It can be used as a sample backend or a sample fastapi project with mongodb.\n\n\nQuickstart\n----------\n\nFirst, set environment variables and create database. For example using ``docker``: ::\n\n    export MONGO_DB=rwdb MONGO_PORT=5432 MONGO_USER=MONGO MONGO_PASSWORD=MONGO\n    docker run --name mongodb --rm -e MONGO_USER=\"$MONGO_USER\" -e MONGO_PASSWORD=\"$MONGO_PASSWORD\" -e MONGO_DB=\"$MONGO_DB\" MONGO\n    export MONGO_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgdb)\n    mongo --host=$MONGO_HOST --port=$MONGO_PORT --username=$MONGO_USER $MONGO_DB\n\nThen run the following commands to bootstrap your environment with ``poetry``: ::\n\n    git clone https://github.com/markqiu/fastapi-realworld-example-app\n    cd fastapi-realworld-example-app\n    poetry install\n    poetry shell\n\nThen create ``.env`` file (or rename and modify ``.env.example``) in project root and set environment variables for application: ::\n\n    touch .env\n    echo \"PROJECT_NAME=FastAPI RealWorld Application Example\" \u003e\u003e .env\n    echo DATABASE_URL=mongo://$MONGO_USER:$MONGO_PASSWORD@$MONGO_HOST:$MONGO_PORT/$MONGO_DB \u003e\u003e .env\n    echo SECRET_KEY=$(openssl rand -hex 32) \u003e\u003e .env\n    echo ALLOWED_HOSTS='\"127.0.0.1\", \"localhost\"' \u003e\u003e .env\n\nTo run the web application in debug use::\n\n    uvicorn app.main:app --reload\n\n\nDeployment with Docker\n----------------------\n\nYou must have ``docker`` and ``docker-compose`` tools installed to work with material in this section.\nFirst, create ``.env`` file like in `Quickstart` section or modify ``.env.example``. ``MONGO_HOST`` must be specified as `db` or modified in ``docker-compose.yml`` also. Then just run::\n\n    docker-compose up -d\n\nApplication will be available on ``localhost`` or ``127.0.0.1`` in your browser.\n\nWeb routes\n----------\n\nAll routes are available on ``/docs`` or ``/redoc`` paths with Swagger or ReDoc.\n\n\nProject structure\n-----------------\n\nFiles related to application are in the ``app`` directory. ``alembic`` is directory with sql migrations.\nApplication parts are:\n\n::\n\n    models  - pydantic models that used in crud or handlers\n    crud    - CRUD for types from models (create new user/article/comment, check if user is followed by another, etc)\n    db      - db specific utils\n    core    - some general components (jwt, security, configuration)\n    api     - handlers for routes\n    main.py - FastAPI application instance, CORS configuration and api router including\n\n\nTodo\n----\n1) Add more unit test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkqiu%2Ffastapi-mongodb-realworld-example-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkqiu%2Ffastapi-mongodb-realworld-example-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkqiu%2Ffastapi-mongodb-realworld-example-app/lists"}