Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vuthanhtrung2010/url-shortener
An ultra fast & flexible URL shortener using PostgreSQL database
https://github.com/vuthanhtrung2010/url-shortener
link-shortener next14 nextjs postcss postgresql postgresql-database prisma-orm sentry tailwindcss typescript url-shortener
Last synced: 29 days ago
JSON representation
An ultra fast & flexible URL shortener using PostgreSQL database
- Host: GitHub
- URL: https://github.com/vuthanhtrung2010/url-shortener
- Owner: vuthanhtrung2010
- Created: 2024-06-05T01:26:42.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-27T08:26:37.000Z (about 1 month ago)
- Last Synced: 2024-09-27T09:21:39.439Z (about 1 month ago)
- Topics: link-shortener, next14, nextjs, postcss, postgresql, postgresql-database, prisma-orm, sentry, tailwindcss, typescript, url-shortener
- Language: TypeScript
- Homepage: https://links.devtrung.tech
- Size: 2.69 MB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Support Server
# Important notes and thank β€οΈ
First of all, thanks for using this Source Code, it was and is a ton of work to create and maintain it!
That's why I'm asking everyone to [**donate a little bit of money**](https://ko-fi.com/devtrung) (via Paypal through ko-fi) or if that's not possible, then join my [Discord Server](https://discord.gg/5q6zxM5vnT)!# Installation Guide π₯
## β Hosting Requirements
Click to expand
- [nodejs](https://nodejs.org) version 20 or higher, I recommend the latest STABLE version
- A VPS would be advised, so you don't need to keep your PC/Laptop/RasPi 24/7 online!
- At least 256MB of RAM & 0.5vCPU with at least 2GB storage.## π€ Website Requirements
Click to expand
1. Download the [Source Code](https://github.com/vuthanhtrung2010/url-shortener)
* Either by: `git clone https://github.com/vuthanhtrung2010/url-shortener`
* Or by downloading it as a zip from a branch
## π€ Configuration and Starting
Click to expand
**NOTE:** _You can do the exact same configuration inside of the `.env.example` file, just make sure to rename it to `.env` or use environment variables!_
1. Ensure that you have installed all node modules by running `npm i`
2. Ensure that you have renamed `.env.example` to `.env` and added environment variables
3. Now run `npm run build` then run `npm start` or `npm start` or `pm2 start npm --name URL-Shortener -- start` if you using a VPS to run the website as production mode. You can also run the website as developer mode by `npm run dev` or `pm2 start "npm run dev" --name URL-Shortener`. Might add `npx` to the prefix of `pm2` if you are not using the runtime version!
4. Now go to the `/login` route and login to your Spotify Account!
5. Enjoy!## β Where to get which Api-Key(s)
Click to expand
**NOTE:** _You can do the exact same configuration inside of the `.env.example` file, just make sure to rename it to `.env` or use environment variables!_
1. `./.env`
- `DATABASE_URL` get from your self hosted database. See full list of supported database by prisma ORM [here](https://www.prisma.io/docs/orm/reference/supported-databases).
- `PASSWORD_HASH` your hased desired password for `/dashboard` to create/update/delete URLs, do `npm run hash` or `pnpm hash` and type your password, fill in the variable to the variable named `PASSWORD_HASH` in `.env` file.
- `PORT` is your port number the website listening to. Default listening port will be 3000.
- `SENTRY_AUTH_TOKEN` (optional for who want to track errors/performance): Get it from [Sentry Dashboard](https://sentry.io/settings/auth-tokens/).
- `SENTRY_DSN_ADDRESS` (optional for who want to track errors/performance): Get it from your Sentry project.2. `./src/config.tsx`
- `name` fill your name. Make sure it is sort.
- `profilePicture` the link to your profile picture, default profile picture is in `./public/assets/pfp.webp`. If you have different file name/extension after uploading, replace it.
- `links` is all your links with the image, image located at `./public/assets/links`. Put your files there and replace the sub variable.
- `baseURL` your base URL. Must be filled in to prevent error. You could use ShareX to shorten your URL too! Put it as your main route. Eg: `https://links.devtrung.tech`, `https://links.devtrung.tech/` **NOT** `https://yourdomain.com/sth`.## Want to use ShareX to Shorten URLs?
Click to expand
1. Get ShareX from https://getsharex.com/
2. Change the line have variable `RequestURL` your real URL. Eg: `https://links.devtrung.tech/api/create`.
3. Open the file and choose yes when it asks you to use default URL Shortener is your URL Shortener.# Contributing
> If you want to help improve the code, fix spelling or design Errors or if possible even code errors, you may create PULL REQUESTS.
> Please create pull request compare to beta branch, else you will get instant close!
> Please consider, that [**VΕ© ThΓ nh Trung**](https://github.com/vuthanhtrung2010) is the main Developer of this project!