查看原文
其他

7.7k stars 快速生成短链接,开源免费!

小奇 爱编程爱技术 2024-02-24
kutt 是一个现代化的URL短链生成项目,完全开源,支持自定义域。缩短网址,管理链接,查看并统计短链的点击率。非常适合分享一些很长的链接的时候,进行缩短链接,使分享网址的 URL 更加的简洁。
该项目基于 MIT 写完全免费且开源,在开源社区Github上已经将获得了 7.7K Stars,可自定义部署,且支持修改源码。

🎨️ 功能特性

  • 开源免费
  • 支持自定义域
  • 缩短URL的私有统计信息
  • 管理员账号查看,删除和禁止链接
  • 缩短链接的自定义URL
  • 设置链接的密码
  • 查看、编辑、删除和管理短链接
  • 能够禁用注册和匿名链接创建私人使用
  • 设置链接的描述
  • 设置链接的过期时间
  • 支持 RESTful API

🧰 源码构建部署

前提依赖安装:
  • Node.js 16+

  • PostgreSQL

  • Redis
1、克隆此仓库或下载最新的 release zip
git clone https://github.com/thedevs-network/kutt.git
2、将 .example.env 复制一份,并修改文件名为 .env,配置文件内容如下:
根据实际情况修改PORT,DEFAULT_DOMAIN,REDIS等配置项。
# App port to run onPORT=3000# The name of the site where Kutt is hostedSITE_NAME=Kutt
# The domain that this website is onDEFAULT_DOMAIN=localhost:3000
# Generated link lengthLINK_LENGTH=6
# Postgres database credential detailsDB_HOST=localhostDB_PORT=5432DB_NAME=postgresDB_USER=DB_PASSWORD=DB_SSL=false
# Redis host and portREDIS_HOST=127.0.0.1REDIS_PORT=6379REDIS_PASSWORD=# Optional: The number for Redis database, between 0 and 15. Defaults to 0.# If you don't know what this is, then you probably don't need to change it.REDIS_DB=0
# Disable registrationDISALLOW_REGISTRATION=false# Disable anonymous link creationDISALLOW_ANONYMOUS_LINKS=false# The daily limit for each userUSER_LIMIT_PER_DAY=50
# Create a cooldown for non-logged in users in minutes# Would be ignored if DISALLOW_ANONYMOUS_LINKS is set to true# Set 0 to disableNON_USER_COOLDOWN=0
# Max number of visits for each link to have detailed statsDEFAULT_MAX_STATS_PER_LINK=5000
# Use HTTPS for links with custom domainCUSTOM_DOMAIN_USE_HTTPS=false
# A passphrase to encrypt JWT. Use a long and secure key.JWT_SECRET=securekey
# Admin emails so they can access admin actions on settings page# Comma seperatedADMIN_EMAILS=
# Invisible reCaptcha secret key# Create one in https://www.google.com/recaptcha/intro/RECAPTCHA_SITE_KEY=RECAPTCHA_SECRET_KEY=
# Google Cloud API to prevent from users from submitting malware URLs.# Get it from https://developers.google.com/safe-browsing/v4/get-startedGOOGLE_SAFE_BROWSING_KEY=
# Your email host details to use to send verification emails.# More info on http://nodemailer.com/# Mail from example "Kutt <support@kutt.it>". Leave empty to use MAIL_USERMAIL_HOST=MAIL_PORT=MAIL_SECURE=trueMAIL_USER=MAIL_FROM=MAIL_PASSWORD=
# The email address that will receive submitted reports.REPORT_EMAIL=# Support email to show on the appCONTACT_EMAIL=
3、安装依赖
npm install
4.1、本地运行执行如下命令:
npm run dev
4.2、生产环境运行:
npm run buildnpm start
5、浏览器访问
http://<server ip>:3000

🔥 Docker部署

1、创建文件目录 kutt
mkdir kuttcd kutt
2、创建 docker-compose.yml 文件,内容如下:
根据服务器实际的情况修改redis,postgres,外挂磁盘等配置项。
docker-compose.yml 使用 Docker Hub 上提供的官方 kutt docker 镜像。

version: "3"
services: kutt: image: kutt/kutt depends_on: - postgres - redis command: ["./wait-for-it.sh", "postgres:5432", "--", "npm", "start"] ports: - "3000:3000" env_file: - .env environment: DB_HOST: postgres DB_NAME: kutt DB_USER: user DB_PASSWORD: pass REDIS_HOST: redis
redis: image: redis:6.0-alpine volumes: - redis_data:/data
postgres: image: postgres:12-alpine environment: POSTGRES_USER: user POSTGRES_PASSWORD: pass POSTGRES_DB: kutt volumes: - postgres_data:/var/lib/postgresql/data
volumes: redis_data: postgres_data:
3、创建 docker 的启动配置文件 .env
# App port to run onPORT=3000# The name of the site where Kutt is hostedSITE_NAME=Kutt
# The domain that this website is onDEFAULT_DOMAIN=127.0.0.1:3000# Generated link lengthLINK_LENGTH=6# Postgres database credential detailsDB_HOST=postgresDB_PORT=5432DB_NAME=postgresDB_USER=DB_PASSWORD=DB_SSL=false
# Redis host and portREDIS_HOST=redisREDIS_PORT=6379REDIS_PASSWORD=REDIS_DB=# Disable registrationDISALLOW_REGISTRATION=false
# Disable anonymous link creationDISALLOW_ANONYMOUS_LINKS=false
# The daily limit for each userUSER_LIMIT_PER_DAY=50
# Create a cooldown for non-logged in users in minutes# Set 0 to disableNON_USER_COOLDOWN=0
# Max number of visits for each link to have detailed statsDEFAULT_MAX_STATS_PER_LINK=5000
# Use HTTPS for links with custom domainCUSTOM_DOMAIN_USE_HTTPS=false
# A passphrase to encrypt JWT. Use a long and secure key.JWT_SECRET=securekey
# Admin emails so they can access admin actions on settings page# Comma seperatedADMIN_EMAILS=
# Invisible reCaptcha secret key# Create one in https://www.google.com/recaptcha/intro/RECAPTCHA_SITE_KEY=RECAPTCHA_SECRET_KEY=
# Google Cloud API to prevent from users from submitting malware URLs.# Get it from https://developers.google.com/safe-browsing/v4/get-startedGOOGLE_SAFE_BROWSING_KEY=
# Your email host details to use to send verification emails.# More info on http://nodemailer.com/# Mail from example "Kutt <support@kutt.it>". Leave empty to use MAIL_USERMAIL_HOST=MAIL_PORT=MAIL_SECURE=trueMAIL_USER=MAIL_FROM=MAIL_PASSWORD=
# The email address that will receive submitted reports.REPORT_EMAIL=
# Support email to show on the appCONTACT_EMAIL=
4、运行 kutt
运行如下命令,启动程序,应用程序使用 3000 端口号。
docker-compose up -d
启动成功,Kutt 是完全免费的,无任何广告。访问界面如下:
程序搭建完成,实际使用需要配置反向代理,设置好反向代理之后,复制生成的短链接,就可以进行正常使用了。

附项目的链接:

开源地址:

https://github.com/thedevs-network/kutt

官网体验地址:

https://kutt.it/
点关注不迷路
本文发表于公众号【爱编程爱技术
关注我们,阅读更多精彩内容

点击上方关注我们,谢谢支持

往期推荐:

Github 绝版开源加速神器,且用且珍惜!
开源的 Steam 管理工具神器
最新开源项目,快速定制节日头像,国庆国旗头像。
13k+ Stars 开源免费的 Github 加速器,突破地域限制!
国产开源 AI 富文本编辑器
继续滑动看下一个

7.7k stars 快速生成短链接,开源免费!

小奇 爱编程爱技术
向上滑动看下一个

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存