All Projects → mini-services → miniurl

mini-services / miniurl

Licence: MIT license
A production-ready URL shortener microservice.

Programming Languages

typescript
32286 projects
Makefile
30231 projects
Smarty
1635 projects

Projects that are alternatives of or similar to miniurl

zeebe-helm
Public Zeebe K8s HELM Charts
Stars: ✭ 13 (-35%)
Mutual labels:  helm
kubewise
Get Helm notifications in your team chat
Stars: ✭ 52 (+160%)
Mutual labels:  helm
valheim-k8s
valheim game-server on kubernetes
Stars: ✭ 74 (+270%)
Mutual labels:  helm
url-shortener
A URL Shortener Application built with Node.js, Express and MongoDB
Stars: ✭ 16 (-20%)
Mutual labels:  url-shortener
flux-ui
web ui for fluxctl (gitops tool)
Stars: ✭ 30 (+50%)
Mutual labels:  helm
billimek-charts
DEPRECATED - new home is https://github.com/k8s-at-home/charts
Stars: ✭ 90 (+350%)
Mutual labels:  helm
helm-chart
Makes develping the chart boilerplate easier.
Stars: ✭ 31 (+55%)
Mutual labels:  helm
tiny0
Custom URL shortener in Flask.
Stars: ✭ 60 (+200%)
Mutual labels:  url-shortener
croc-hunter-jenkinsx
Croc Hunter demo, deployed with Jenkins X
Stars: ✭ 19 (-5%)
Mutual labels:  helm
rules helm
rules_helm: Bazel rules for managing helm charts
Stars: ✭ 46 (+130%)
Mutual labels:  helm
kubernetes-logging-helm
Scalable Kubernetes logging stack with Opensearch
Stars: ✭ 42 (+110%)
Mutual labels:  helm
helm-clientgo-example
helm client-go example to add helm repo, fetch charts and install chart
Stars: ✭ 27 (+35%)
Mutual labels:  helm
workshopctl
A tool to run workshops with
Stars: ✭ 38 (+90%)
Mutual labels:  helm
kubehelper
KubeHelper - simplifies many daily Kubernetes cluster tasks through a web interface. Search, analysis, run commands, cron jobs, reports, filters, git synchronization and many more.
Stars: ✭ 200 (+900%)
Mutual labels:  helm
kube-lineage
A CLI tool to display all dependencies or dependents of an object in a Kubernetes cluster.
Stars: ✭ 238 (+1090%)
Mutual labels:  helm
draughtsman
An in-cluster agent that handles Helm based deployments
Stars: ✭ 31 (+55%)
Mutual labels:  helm
gotway
☸️ Cloud native API Gateway powered with in-redis cache
Stars: ✭ 71 (+255%)
Mutual labels:  helm
configurator
Synchronize and Version Control ConfigMaps & Secrets across Deployment Rollouts.
Stars: ✭ 68 (+240%)
Mutual labels:  helm
Becoditive-API
The official API of beCoditive with many endpoints like memes, animals, image manipulation, url shortner, etc.
Stars: ✭ 14 (-30%)
Mutual labels:  url-shortener
gokube
gokube is a tool that makes it easy developing day-to-day with Kubernetes on your laptop.
Stars: ✭ 22 (+10%)
Mutual labels:  helm

Build Test Codecov Slack Chat License Issues Analysis Last Commit Docker Pulls Docker Image Size Docker Version

MiniUrl

MiniUrl is an open-source production-ready microservice for shortening Urls. Deploy it on your personal cloud and get a fully-functional url-shortener with zero effort.

MiniUrl is part of the Mini Services Project.

Features

  • Extremely efficient
  • Production ready
  • Zero code
  • Easy setup
  • Highly configurable
  • Cloud-ready with an almost zero-config Helm chart
  • Multiple deployment options

Getting Started

  • Run using Helm, Docker or Node.js
  • Use the API (future: dashboard) and enjoy a zero-code microservice 🙃

Deployment Options

Helm

MiniUrl maintains an extensive production-grade Helm chart. See the chart for the possible values configuration and examples.

helm repo add miniservices https://raw.githubusercontent.com/mini-services/helm-charts/main
helm repo update

# You may also add --set ingress.enable=true for deploying an Ingress route as well
helm upgrade --install miniurl miniservices/miniurl --set baseRedirectUrl=<YOUR_SHORT_URL>

Docker

Run MiniUrl's docker image directly.

docker run -d --name miniurl -e BASE_REDIRECT_URL=<YOUR_SHORT_URL> -e STORAGE_DRIVER=Sqlite -p 80:8000 miniservices/miniurl

NOTE this deployment is NOT production ready since it uses the Sqlite storage driver. To run a production-grade docker deployment, you will need to provide a suitable database. A working example using Postgres:

docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres
docker run -d --name miniurl -p 80:8000 miniservices/miniurl \
                             -e BASE_REDIRECT_URL=<YOUR_SHORT_URL> \
                             -e STORAGE_DRIVER=Postgres \
                             -e POSTGRES_STORAGE_DATABASE=postgres \
                             -e POSTGRES_STORAGE_HOST=localhost \
                             -e POSTGRES_STORAGE_USER=postgres \
                             -e POSTGRES_STORAGE_PASSWORD=postgres

Node.js

Requirements:

  • Node.js 14.8+
  • NPM 6+ or Yarn X+
git clone https://github.com/mini-services/miniurl.git
cd miniurl
npm install
npx cross-env BASE_REDIRECT_URL=<YOUR_SHORT_URL> STORAGE_DRIVER=Sqlite npm start

Node.js troubleshooting:

for Windows OS, it is also possible to use nvm for Windows. Refer to the nvm documentation.

NOTE this deployment is NOT production ready since it uses the Sqlite storage driver. To run a production-grade docker deployment, you will need to provide a suitable databases (and possibly a process manager such as pm2). A working example assuming a Postgres database on localhost:5432 with username postgres and password postgres:

npx cross-env BASE_REDIRECT_URL=<YOUR_SHORT_URL> \
              STORAGE_DRIVER=Postgres \
              POSTGRES_STORAGE_HOST=localhost \
              POSTGRES_STORAGE_USER=postgres \
              POSTGRES_STORAGE_PASSWORD=postgres \
              npm start

Development

See running the project in development mode.

API

The easiest way to get familiar with MiniUrl's API is using Insomnia or Postman.

Insomnia

Postman

POST /miniurl/url

Save a url and get a shorter one instead.

Request

Body (json)

  • url: string (required) - The url to shorten

Response

Body (text) - a shortened Url

GET /miniurl/url/:id

Retrieves a saved url with its information.

Request

Query

  • id: string (required) - The saved url's id

Response

Body (json)

  • id: string - The url's id
  • url: string - The saved url
  • createdAt: string - an ISO 8601 date indicating the creation time
  • updatedAt: string - an ISO 8601 date indicating the last updated time

PUT /miniurl/url/:id

Update the URL and retrieve its information

Request

Body (json)

  • url: string (required) - The updated url

Query

  • id: string (required) - The saved shorten url's id

Response

Body (json)

  • id: string - The url's id
  • url: string - The updated url
  • createdAt: string - an ISO 8601 date indicating the creation time
  • updatedAt: string - an ISO 8601 date indicating the last updated time

GET <BASE_REDIRECT_URL>/:id

Redirects to a saved url.

NOTE this endpoint may not be found at the root url since it depends on the baseRedirectUrl configuration variable. e.g if the baseRedirectUrl is localhost:3000/u, this endpoint will be found at /u/:id.

Request

Query

  • id: string (required) - The saved url's id

Response

DELETE /miniurl/url/:id

Delete url with its information.

Request

Required: auth bearer token.

Query

  • id: string (required) - The saved url's id

Redirect 302 - redirects to the saved url.

Configuration

Since MiniUrl follows the best practices including the 12 factor app, the microservice is entirely configurable via environment variables. Available variables are:

General

BASE_REDIRECT_URL (required) - the shortened urls' base path e.g https://youtu.be, https://bit.ly or https://example.com/u

API_PREFIX (default: "/miniurl") - MiniUrl's prefix for the api routes (e.g for saving a url, one would POST to ${API_PREFIX}/url)

URL_MATCH_PATTERN (default: "**") - a micromatch-complaint glob pattern for restricting the saved urls (for example, if you don't want your MiniUrl to save links other than your domain such as https://evil-fisching.com)

URL_LIFETIME (default: "7 days") - a human-readible time (see the ms docs for available options) stating the url lifetime (after which it expires). Note that the expiration mechanism runs at most once per minute and at least once per hour and so slight deviation may occur.

PORT (default: "80") - the Node.js process port. In most cases your shouldn't change this

Storage

STORAGE_DRIVER (required) - MiniUrl's storage driver. available options are

  • InMemory (for development purposes only)

  • Sqlite (for development purposes only)

    SQLITE_STORAGE_FILENAME (default: ./db.sqlite) - the Sqlite storage path

  • Redis

    REDIS_STORAGE_HOST (required) - the database host (e.g https://my-redis-database.com)

    REDIS_STORAGE_PASSWORD (required) - the Postgres database password

    REDIS_STORAGE_PORT (default: 6379) - the database port

    REDIS_STORAGE_USERNAME (default: undefined) - the database username

  • Postgres

    POSTGRES_STORAGE_HOST (required if STORAGE_DRIVER is Postgres) - the Postgres database's host (e.g https://my-database.com)

    POSTGRES_STORAGE_USER (required if STORAGE_DRIVER is Postgres) - the Postgres database's username

    POSTGRES_STORAGE_PASSWORD (required if STORAGE_DRIVER is Postgres) - the Postgres database's password

    POSTGRES_STORAGE_DATABASE (required if STORAGE_DRIVER is Postgres) - the Postgres database's name (e.g postgres)

Auth

AUTH_DRIVER (default: BearerToken) - MiniUrl's auth driver. Currently, the only available option is BearerToken.

AUTH_BEARER_TOKEN (default: ) - The bearer token to use when selecting the BearerToken auth driver.

Issues and Questions

Issues & Features

If you found a bug or have an idea for a feature, feel free to open an issue.

Questions

You may open an issue for questions, but it's usually faster to send a message on our Slack

Contribution

Refer to our contribution guide.

License

MIT

FOSSA Status

Copyright (c) 2020-present, Snir Shechter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].