Skip to content
master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ksana.in

ksana.in

✂️ Open source URL shortener, free to use and without ads

Deployment Website Up

Features

  • Fully open source
  • Mobile First UI (best view in your mobile device)
  • Full authentication flow
    • Login (with Email or third parties: Google, GitHub and Twitter)
    • Register manual using email
    • Forget Password and set new password
  • Simple hit stats on every short URL
  • Share the link using Native Share API for mobile device and fallback to WA, Twitter and Facebook share.
  • Copy the link using new Clipboard API, fallback to old school copy-to-clipboard mechanism

Screenshots

Homepage Homepage Homepage

Installation

Copy file .env.local.example to .env.local and change value with your own supabase url and anonymous key. You can get it after register and create your own project on Supabase.io.

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Creating table on Supabase

Go to the SQL tab and execute this query on the editor.

create table urls (
  id bigint generated by default as identity primary key,
  user_id uuid references auth.users not null,
  real_url text check (char_length(real_url) > 1),
  slug text check (char_length(slug) > 1),
  hit integer default 0,
  inserted_at timestamp with time zone default timezone('utc'::text, now()) not null,
  updated_at timestamp with time zone default timezone('utc'::text, now()) not null
);

create table users (
  id bigint generated by default as identity primary key,
  user_id uuid references auth.users not null,
  created_at timestamp with time zone default timezone('utc'::text, now()) not null,
  updated_at timestamp with time zone default timezone('utc'::text, now()) not null
);

Click RUN to execute the query

Add triggers for "updated_at" field, copy this code on the same SQL editor

create extension if not exists moddatetime schema extensions;

-- this trigger will set the "updated_at" column to the current timestamp for every update
create trigger handle_updated_at before update on public.urls
  for each row execute procedure moddatetime (updated_at);
  
create trigger handle_updated_at_users before update on public.users
  for each row execute procedure moddatetime (updated_at);

Click RUN to execute the query

Additional settings for Authentication

  • on Authentication setting, change Site URL to /callback. e.g: https://ksana.in/callback, for development just set it to http://localhost:3000/callback
  • To support Google Login, in Authentication setting page, set the Google Client ID and Google Secret
  • Increase JWT expiry time to 604800 for longer session. It's on on Authentication setting menu

Add environment variables on Vercel

You can found all required environment variables on .env.local.example

Register you own Splitbee

Ksana.in using Splitbee for Analytic, if you plan to deploy it by yourself, you might need to register your own Splitbee account.

Can I deploy to my own domain?

The code is open for learning purpose. But in case you didn't like the default domain (ksana.in), feel free to deploy to your own domain. Since Ksana.in is using a free plan from Supabase, it have many limitation in term of size. If you plan to use it in the bigger frequency, I suggest to deploy it with your own Supabase plan.

The Apps based on Ksana.in's codebase

Credits

Support me


Copyright ©️ 2021 by Irfan Maulana

About

✂️ Layanan pemendek tautan yang mudah, gratis & tanpa iklan

Topics

Resources

License

Languages