backstage / community-plugins

Community plugins for Backstage
Apache License 2.0
157 stars 177 forks source link

πŸ”Œ Plugin: url-shortener #221

Open MarAvFe opened 1 year ago

MarAvFe commented 1 year ago

πŸ”– Summary

A URL-shortener which you enable a path to detect. You go to localhost:8080/short/ABC123 and backstage retrieves that the ABC123 url exists and redirects the browser to localhost:8080/my/full/path/and/likely/long/link

🌐 Project website (if applicable)

It could be implemented with https://github.com/ai/nanoid

✌️ Context

Whenever a new entity is registered, a short URL can be generated and stored in DB as a key-value format. Then in the router component you add a prefix path like /short where the rest of the path will be matched to a long link in the db.

Optionally, you can generate these short links only on demand on the entity page; adding a button to Generate short URL which stores the reference and returns the short url.

πŸ‘€ Have you spent some time to check if this plugin request has been raised before?

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

benjdlambert commented 1 year ago

Sounds good! is this something that you want to contribute? :pray:

MarAvFe commented 1 year ago

I am, yes! For what I've checked, I'm planning on a front and backend parts.

Frontend would be a list with all the created short links and a few statistics like the total, and the top 10 recently used. Or it could simply be that "Create" button on the software catalog, kind of how badges plugin works.

Backend would be:

benjdlambert commented 1 year ago

Sounds good! I will assign you to the ticket! πŸ‘

shailahir commented 1 year ago

I have worked on it a little. Please checkout https://github.com/shailahir/backstage-plugin-shorturl and https://github.com/shailahir/backstage-plugin-shorturl-backend @MarAvFe @benjdlambert

freben commented 5 months ago

transferring to the community plugins repo

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

billabongrob commented 1 month ago

any chance we can get this opened back up? This is a cool plugin idea.

MarAvFe commented 1 month ago

Yes! I had forgotten this. By the time I opened it, the task exceeded my backstage knowledge and I couldn't work on it. But I recently did my first collab to backstage and understand the contributing guides.

I was looking at it and @shailahir's code is mostly done! It might only be a matter of creating PR for front and backend.

I'll just add some optional config tweaks and submit the PR.

drodil commented 1 month ago

I was thinking this at one point to add as a tool to https://github.com/drodil/backstage-plugin-toolbox .. Maybe I will at some point now that I have good reference implementation πŸ˜…

avila-m-6 commented 1 month ago

I'd advise against that to keep the DB isolated. For a big team, if your shortlink is lost once, you lose trust in the library. And your references are immediately outdated.

Actually, this prompted me an idea. To have a frontend module with a "error redirecting" screen where you can error handle that case and lead the user for support.

billabongrob commented 1 month ago

One other consideration while we’re all excited about this would be associating a user/group as a β€œresponsible” party for the record. Could allow for modification/deletion permissions down the line.