---
title: "Discussion on \"Build a URL Shortener with FastAPI, MongoDB and Python\" | Hashnode"
description: "Discussion on \"Build a URL Shortener with FastAPI, MongoDB and Python\". Have you ever wondered how to build your personal URL shortener service like  bitly  or  tinyurl 🤓 ? \nIn this tutorial, we are going to build a simple URL shortener using FastAPI, MongoDB and Python. A URL Shortener is a simple tool that can be used..."
url: "https://hashnode.com/posts/build-a-url-shortener-with-fastapi-mongodb-and-python/600d6b123fdbb7412625f7bc"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Build a URL Shortener with FastAPI, MongoDB and Python](https://simiokunowo.hashnode.dev/build-a-url-shortener-with-fastapi-mongodb-and-python?utm_source=hashnode&utm_medium=feed)

Have you ever wondered how to build your personal URL shortener service like bitly or tinyurl 🤓 ? In this tutorial, we are going to build a simple URL shortener using FastAPI, MongoDB and Python. A URL Shortener is a simple tool that can be used...

Jan 24, 2021 · 19 min read · simiokunowo.hashnode.dev  
Updated Jan 25, 2021  
Read the article

-   [#python-projects](https://hashnode.com/tag/python-projects)
-   [#mongodb](https://hashnode.com/tag/mongodb)
-   [#python](https://hashnode.com/tag/python)

## Written by

[Similoluwa Okunowo](https://hashnode.com/@simiokunowo)

@simiokunowo · Lagos state, Nigeria.

  
[View profile](https://hashnode.com/@simiokunowo)

Beginner's mindset | Aspiring Software and Machine learning Engineer | Electronic and Electrical Engineering undergrad. | I ❤ learning.

## Responses 2

Markdown supported · ⌘↵ to post

[Franco Ezequiel Ferrario](https://hashnode.com/@FranF15)

[Jun 3, 2021](https://hashnode.com/posts/build-a-url-shortener-with-fastapi-mongodb-and-python/600d6b123fdbb7412625f7bc/comment/60b8f884d7e1e779f671bbe3)

Hi, i'm having a problem with this. When I try to save in the DB, get this error message:

```
pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed, Timeout: 30s, Topology Description: <TopologyDescription id: 60b8f7ddd8d37c78c48ec0ed, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('cluster0-shard-00-00.n4dkx.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>, <ServerDescription ('cluster0-shard-00-01.n4dkx.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>, <ServerDescription ('cluster0-shard-00-02.n4dkx.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>]>
```

Can you help me?

[Folasewa Abdulsalam](https://hashnode.com/@Folasewa)

[Jan 27, 2021](https://hashnode.com/posts/build-a-url-shortener-with-fastapi-mongodb-and-python/600d6b123fdbb7412625f7bc/comment/6011cbb4e8f6da1d3fdff7a6)

Would love to try it on my system.. Kudos Mosimi👌
