kutt icon indicating copy to clipboard operation
kutt copied to clipboard

Kutt v3 is under development

Open poeti8 opened this issue 1 year ago • 12 comments
trafficstars

Yes, the day has come.

I decided to devote my time to this project again. I'm humbled by all the stars, the count of forks, the amount of users, and bittersweetly, by the number of issues, and I want to make sure it's as easy and simple to use as it could be for everyone.

Yesterday, I read about goo.gl and how they are killing all its links. So I understand how important it is for users to own their own links, and I made a reliable and easy self-hosted Kutt as my main goal for the next version.

Here are the key things I've planned for the version 3:

  • Seamless installation.
    • Install with minimal knowledge required.
    • See where people struggled the most and solve them.
  • Assume the barest functionality.
    • Use sqlite by default, and only use Postgres if a user wants to.
    • Only use redis, emails, and other features if a user enables them explicitly.
    • Minimize dependencies as much as possible.
  • Better logs and error messages.
  • Focus on private instances.
  • Remove anything Google.
  • Replace Next.js. There's no way I'll upgrade to Next.js 14 since I dislike it so much. I plan to move away from React too. Nothing's wrong with React, I just think something more lightweight would suit this project. I like to try htmx.
  • Add an admin page to manage links and users.
  • Improve performance. This one is for the Kutt.it instance itself to make sure it can handle millions of links with no sweats.
  • Enable signup on kutt.it again (after I found a way to prevent spam.)
  • Write new guides and improve documentation. Make video walkthroughs.
  • And finally, go through open issues, and fix those that I think have high priority.

There are much more to add. I'll hopefully work on them once I've completed the important ones listed above. If you think I'm missing something, let me know.

This is not short and quick, and it would probably make some time to finish. You can follow the progress on the v3 branch.

poeti8 avatar Jul 31 '24 10:07 poeti8

Make the bullet points a checklist!

better-sqlite3 is the best pure SQLite npm library for node, BUT node recently added builtin SQLite: https://nodejs.org/api/sqlite.html Maybe we could use that and eventually work towards runtime agnosticism

trgwii avatar Aug 08 '24 10:08 trgwii

Make the bullet points a checklist!

I've made a Kanban board and put everything I could think of.

better-sqlite3 is the best pure SQLite npm library for node, BUT node recently added builtin SQLite: https://nodejs.org/api/sqlite.html Maybe we could use that and eventually work towards runtime agnosticism

Nice! I'll try it out.

poeti8 avatar Aug 09 '24 06:08 poeti8

I am pleasantly surprised! This is awesome! I have been using Kutt for a long time, and I am very satisfied with everything that exists. I hope that V3 won't break the existing data or that there will be a recommended data migration guide.

If possible, I would love to see the UI incorporate i18n!

sqkkyzx avatar Aug 14 '24 16:08 sqkkyzx

Data migration should be fully supported

trgwii avatar Aug 14 '24 20:08 trgwii

Yeahhhhh we're so back with this one!

muelsyse-az avatar Aug 21 '24 01:08 muelsyse-az

IMO the project is already very well polished and you have done great work. Installation with docker is super simple already and getting the .env setup is also already simple.

The only minor pain points I see are: lack of admin user management which you already identified as: "Add an admin page to manage links and users." links do not show who was author/creator of url author/creator cant control whether other users may edit or delete url urls dont have any associated text field for notes to provide extra info on url purpose/usage lack of csv output, or import/export function to quickly get all data out of instance.

Thank you

chrislawso avatar Sep 01 '24 22:09 chrislawso

We can not thank enough for the effort you put into this. Do you plan to write MySQL wrappers for Postgres-only functions to support them both? For example MySQL also supports UUID fields, you can generate them inside JS instead of using postgres internal UUID function. Wish I know JS, I'd be so happy to contribute into this project.

kenarsuleyman avatar Sep 06 '24 14:09 kenarsuleyman

@kenarsuleyman It should be easy to add support for MySQL as well. I'll make sure to include it in the v3 release.

poeti8 avatar Sep 11 '24 11:09 poeti8

Support for SQLite and MySQL has been added to version 3 now. You can test them in the version 3 branch and see if everything works fine for you.

cc @kenarsuleyman

poeti8 avatar Oct 08 '24 06:10 poeti8

I am pleasantly surprised! This is awesome! I have been using Kutt for a long time, and I am very satisfied with everything that exists. I hope that V3 won't break the existing data or that there will be a recommended data migration guide.

If possible, I would love to see the UI incorporate i18n!

I noticed that if you're not planning to use React and switch to htmx, it seems that adding i18n is not as easy? But that's okay, once v3 stabilizes and you release the official version, I'll try to fork and localize it locally.

sqkkyzx avatar Oct 08 '24 13:10 sqkkyzx

The admin page is really important. Managing links gets complicated and I sometimes get abuse reports of my instance being used for phishing. Glad to see progress is being made

nocturn9x avatar Oct 08 '24 14:10 nocturn9x

I noticed that if you're not planning to use React and switch to htmx, it seems that adding i18n is not as easy? But that's okay, once v3 stabilizes and you release the official version, I'll try to fork and localize it locally.

It should be even easier. It will be handled on the server side.

poeti8 avatar Oct 09 '24 04:10 poeti8

The v3 branch looks very good! I haven't looked deep into it yet, is it ready for personal use in your opinion?

ThomasBaruzier avatar Nov 07 '24 11:11 ThomasBaruzier

@ThomasBaruzier Thanks! I'm already using it in production for Kutt. Although, it's not always up to date with the latest commit. You can use it for personal use, but beware that some bugs might have crawled up here and there.

poeti8 avatar Nov 07 '24 11:11 poeti8

@poeti8 How do we build v3? There is no build script in package.json

ThomasBaruzier avatar Nov 07 '24 15:11 ThomasBaruzier

@ThomasBaruzier There is no build step anymore! Just start the app.

poeti8 avatar Nov 07 '24 19:11 poeti8

@poeti8 Thanks! I see that you cannot create an account without having a mail server up and running. With the previous version, I got it to work by creating verification codes in the DB. Here, I cannot go beyond the original login screen, so I can't execute this trick. Is there any way to create an account directly in the SQLite database or to bypass the requirement for a mail server?

ThomasBaruzier avatar Nov 08 '24 07:11 ThomasBaruzier

@ThomasBaruzier I have a plan to create an admin account when you start Kutt for the first time so there would be no need to manually set anything. However, it's not implemented yet. So what you can for now is to enable the mail functionality temporarily and perform the old trick.

poeti8 avatar Nov 08 '24 11:11 poeti8

@poeti8 Thank you for the answer. Unfortuantely, I cannot perform the old trick, as this new version does not let me input a code:

IMG_20241108_122707

npm run dev

> [email protected] dev
> npm run migrate && node --watch-path=./server server/server.js


> [email protected] migrate
> knex migrate:latest

Already up to date
> Ready on http://localhost:3002
Error: connect ECONNREFUSED ::1:6293
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16) {
  errno: -111,
  code: 'ESOCKET',
  syscall: 'connect',
  address: '::1',
  port: 6293,
  command: 'CONN'
}

ThomasBaruzier avatar Nov 08 '24 11:11 ThomasBaruzier

@ThomasBaruzier The error is for the email, so the user should already be created in the database and you can verified it from there.

poeti8 avatar Nov 08 '24 12:11 poeti8

@ThomasBaruzier There is no build step anymore! Just start the app.

To try v3 are the manual setup instructions accurate with only changing to clone or download v3 code, not previous? Are the requirements continuing to be same? "You need to have Node.js, PostgreSQL and Redis installed." https://github.com/thedevs-network/kutt?tab=readme-ov-file#manual

I also see there is a dockerfile at https://github.com/thedevs-network/kutt/blob/v3/Dockerfile so I tried building the docker images and hit an error with the v3 branch. Is there something else that needs to be performed to do a docker build process?

=> => transferring context: 1.19MB                                                    0.1s
 => [2/8] RUN apk add --update bash                                                    6.3s
 => [3/8] WORKDIR /usr/src/app                                                         5.1s 
 => [4/8] COPY package*.json ./                                                        5.1s
 => [5/8] RUN npm install                                                             31.7s
 => [6/8] COPY . .                                                                     0.6s
 => [7/8] RUN chmod +x ./wait-for-it.sh                                                6.7s
 => ERROR [8/8] RUN npm run build                                                      4.9s
------
 > [8/8] RUN npm run build:
0.844 npm error Missing script: "build"
0.844 npm error
0.844 npm error To see a list of scripts, run:
0.844 npm error   npm run
0.847 
0.847 npm error A complete log of this run can be found in: /root/.npm/_logs/2024-11-10T05_18_21_841Z-debug-0.log
------
Dockerfile:19
--------------------
  17 |     
  18 |     # Build files
  19 | >>> RUN npm run build
  20 |     
  21 |     EXPOSE 3000
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

chrislawso avatar Nov 10 '24 05:11 chrislawso

@chrislawso The documentation and the docker image are still reflecting the version two, I'll update them after I'm done with the code for the version 3. No the requirements are not the same, you'd only need Node.js, the other ones are optional.

poeti8 avatar Nov 11 '24 05:11 poeti8

Are the data structures for the database going to remain backwards compatible with v2 databases? At the very least include migrations to upgrade to v3?

Fireant456 avatar Nov 12 '24 22:11 Fireant456

@Fireant456 Yes of course, there are migrations scripts that should make the transition smooth.

poeti8 avatar Nov 13 '24 07:11 poeti8

@poeti8 I updated the repo and everything is fixed and beautiful Thank you deeply

ThomasBaruzier avatar Dec 03 '24 11:12 ThomasBaruzier

Oops, I still have an issue when trying to use a shortened link:

TypeError: getStatsLimit is not a function
    at module.exports (/home/tyra/docker/kutt/repo/server/queues/visit.js:28:31)
    at Object.add (/home/tyra/docker/kutt/repo/server/queues/queues.js:29:7)
    at redirect (/home/tyra/docker/kutt/repo/server/handlers/links.handler.js:525:17)

Commenting the if causing this error bypasses the issue for now

ThomasBaruzier avatar Dec 03 '24 11:12 ThomasBaruzier

@ThomasBaruzier Should be fixed now

poeti8 avatar Dec 04 '24 05:12 poeti8

@poeti8 Hey sorry to ask for it here but it seems the most live thread COuld you please approve and release the shortest change ever (1 char) in this PR? https://github.com/thedevs-network/kutt/pull/773

dpevunov-cp avatar Dec 09 '24 10:12 dpevunov-cp

Version 3 is out now

poeti8 avatar Jan 08 '25 18:01 poeti8