<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp" -->

---
title: Use NestJS, MongoDB and Docker to Create an URL Shortener
description: Use NestJS, MongoDB and Docker to create a simple URL shortener API with NestJS and MongoDB. The source code is published on GitHub and can be used freely....
canonical: https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Use NestJS, MongoDB and Docker to Create an URL Shortener | daily.dev
og:description: Use NestJS, MongoDB and Docker to create a simple URL shortener API with NestJS and MongoDB. The source code is published on GitHub and can be used freely....
og:url: https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp
og:image: https://api.daily.dev/og/posts/sqDaKGDqP.png
og:image:alt: Use NestJS, MongoDB and Docker to Create an URL Shortener
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Use NestJS, MongoDB and Docker to Create an URL Shortener

**[Community Picks](https://daily.dev/sources/community)** · [@paulknulst](https://daily.dev/paulknulst) · 11 min read · 33 upvotes · 5 comments

## Summary

Use NestJS, MongoDB and Docker to create a simple URL shortener API with NestJS and MongoDB. The source code is published on GitHub and can be used freely. Also, Docker Swarm setup May 8, 2023· 12 min read Paul Knulst in Programming.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://hashnode.knulst.de/use-nestjs-mongodb-and-docker-to-create-an-url-shortener>

## Community discussion

Top comments from developers on daily.dev.

**@cyrus0311** · 1 upvotes

> What do you think about considering the use of libraries like validator.js or class-validator for input validation?

**@chriisduran** · 0 upvotes

> Interesting

---

Tags: [#docker](https://daily.dev/tags/docker), [#docker-compose](https://daily.dev/tags/docker-compose), [#docker-swarm](https://daily.dev/tags/docker-swarm), [#infrastructure](https://daily.dev/tags/infrastructure), [#mongodb](https://daily.dev/tags/mongodb), [#mongoose](https://daily.dev/tags/mongoose), [#nestjs](https://daily.dev/tags/nestjs)

[View this post on daily.dev](https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Use NestJS, MongoDB and Docker to Create an URL Shortener","url":"https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp"},"datePublished":"2023-05-08T09:06:32.234Z","dateModified":"2024-08-30T02:19:15.029Z","description":"Use NestJS, MongoDB and Docker to create a simple URL shortener API with NestJS and MongoDB. The source code is published on GitHub and can be used freely....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8c7a4b69316cb43a2cd77c8bdb7e0115","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8c7a4b69316cb43a2cd77c8bdb7e0115","isAccessibleForFree":true,"articleSection":"Community Picks","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Paul Knulst","url":"https://daily.dev/paulknulst","image":"https://media.daily.dev/image/upload/v1672701369/avatars/avatar_LiNa14VYxhh0VuZWrO4Ns.jpg","description":"I'm a husband, dad, lifelong learner, tech lover, and Senior Engineer working as a Tech Lead. I write about projects and challenges in IT.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":5140}},"commentCount":5,"discussionUrl":"https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":33},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":5}],"keywords":"docker,docker-compose,docker-swarm,infrastructure,mongodb,mongoose,nestjs","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Community Picks","item":"https://daily.dev/sources/community"},{"@type":"ListItem","position":3,"name":"Use NestJS, MongoDB and Docker to Create an URL Shortener"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/use-nestjs-mongodb-and-docker-to-create-an-url-shortener-sqdakgdqp","comment":[{"@type":"Comment","text":"What do you think about considering the use of libraries like validator.js or class-validator for input validation?","datePublished":"2023-05-08T09:30:49.294Z","url":"https://daily.dev/posts/sqDaKGDqP#c-1hrofS5z7","author":{"@type":"Person","name":"Trong Dang","url":"https://daily.dev/cyrus0311","image":"https://lh3.googleusercontent.com/a/AGNmyxbyJ2jPVd9T2scMaAjklStkV-IiqX-xnhMtLRR2=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Interesting","datePublished":"2023-05-17T14:29:13.928Z","url":"https://daily.dev/posts/sqDaKGDqP#c-N6OB6Lor0","author":{"@type":"Person","name":"Christopher","url":"https://daily.dev/chriisduran","image":"https://media.daily.dev/image/upload/s--weuhKLWP--/f_auto/v1780405776/avatars/avatar_OSdkMjymQCGEuLzC2F02e?_a=BAMAMiWQ0"}}]}
```

