{"id":18669578,"url":"https://github.com/techmaharaj/urlshortener","last_synced_at":"2026-05-17T18:02:25.128Z","repository":{"id":186669515,"uuid":"594943848","full_name":"techmaharaj/urlshortener","owner":"techmaharaj","description":"URL shortener built using Fission open-source serverless framework using MongoDB as the database.","archived":false,"fork":false,"pushed_at":"2023-02-03T16:46:58.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T08:09:17.423Z","etag":null,"topics":["aks","fission","kubernetes","mongodb"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techmaharaj.png","metadata":{"files":{"readme":"README.md","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,"governance":null}},"created_at":"2023-01-30T03:45:43.000Z","updated_at":"2023-07-13T13:54:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"cec74ff2-d6de-4e36-9c05-6a210f20d809","html_url":"https://github.com/techmaharaj/urlshortener","commit_stats":null,"previous_names":["techmaharaj/urlshortener"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/techmaharaj/urlshortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmaharaj%2Furlshortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmaharaj%2Furlshortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmaharaj%2Furlshortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmaharaj%2Furlshortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techmaharaj","download_url":"https://codeload.github.com/techmaharaj/urlshortener/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techmaharaj%2Furlshortener/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265433032,"owners_count":23764210,"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":["aks","fission","kubernetes","mongodb"],"created_at":"2024-11-07T08:47:44.968Z","updated_at":"2026-05-17T18:02:20.108Z","avatar_url":"https://github.com/techmaharaj.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URL Shortener\n\nURL shortener is a simple app built using Fission open-source serverless framework using MongoDB as the database. The application is built using Python.\n\n## Application\n\nThis is a URL shotener application built using Python and Flask using Fission serverless framework. The app makes use of pyshorteners library for shortening of URLs.\n\n### Flow\n\n1. The user enters the url to be shortened from a web form.\n2. This URL is sent to a fission function `shortenurl` which first checks in Mongo DB whether the long URL has already been shortened or not.\n3. If it is already shortened, the function returns the URL from Mongo DB.\n4. It the URL is not shortened, the function creates a new shortURL, adds it to MongoDB and returns the short URL.\n\n## Folder Structure\n\nThis repo contains the following files and folders:\n\n1. Backend: *backend code with `shortenurl.py`. Also contains `build.sh` which is required to create a Fission package.*\n2. Frontend: *frontend code with `app.py`. Also contains `build.sh` which is required to create a Fission package.*\n3. Package.sh: *bash script to create zip files required for creating Fission package.*\n\n## Pre-requisites\n\n1. Configure a Kubernetes cluster on any environment - *minikube, microk8s, AKS, GKE, EKS etc.*\n2. [Install Fission](https://fission.io/docs/installation/) on the cluster and configure the Fission CLI.\n3. Create a [Mongo DB account](https://www.mongodb.com) and configure a cluster. You can follow Mongo DB documentation to [create a new cluster](https://www.mongodb.com/docs/atlas/tutorial/create-new-cluster/).\n4. Configure the connection to Mongo DB for your application to get a connection string. Refer to Mongo DB documentation to [get connection string](https://www.mongodb.com/docs/atlas/troubleshoot-connection) for your application.\n\n## Steps To Run This Example\n\nClone this repo and perform the following steps.\n\n\u003e Note: Make sure to update the MongoDB connection string in `shortenurl.py` with your MongoDB crednetials.\n\nCreate a Python environment\n\n```bash\nfission environment create --name python --image fission/python-env --builder fission/python-builder:latest\n```\n\nCreate zip archives for backend and frontend by executing package.sh script\n\n```bash\n./package.sh\n```\n\n\u003e Note: Make sure that the build.sh file is executable. You can do so by running `chmod +x build.sh`\n\nCreate Fission Packages\n\n```bash\nfission package create --name frontend-pkg --sourcearchive frontend.zip --env python --buildcmd \"./build.sh\"\nfission package create --name backend-pkg --sourcearchive backend.zip --env python --buildcmd \"./build.sh\"\n```\n\nCreate Fission Functions\n\n```bash\nfission fn create --name frontend --pkg frontend-pkg --entrypoint \"app.main\"\nfission fn create --name backend --pkg backend-pkg --entrypoint \"shortenurl.main\"\n```\n\nCreate Routes for Fission functions\n\n```bash\nfission route create --name frontend --method POST --method GET --url /main --function frontend\nfission route create --name backend --method POST --url /shorturl --function backend\n```\n\nWith this our custom Python environment is ready along with our Fission function. You can run `kubectl port-forward svc/router 8888:80 -nfission` to access your app from your browser. Visit `http://localhost:8888/main` to access the application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechmaharaj%2Furlshortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechmaharaj%2Furlshortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechmaharaj%2Furlshortener/lists"}