Skip to content

pheralb/slug

Repository files navigation

Slug Logo

An open-source URL shortener built with T3 Stack.

Dashboard   ❖   Roadmap   ❖   Contribute   ❖   Create issue   ❖   X/Twitter

Next.js Badge Turso Badge Check workflow GitHub stars GitHub releases GitHub issues GitHub license

πŸ‘¨β€πŸš€ Introduction

Slug is a service that offers to shorten urls in a simple, fast and secure way. It's built with T3 Stack, a web development stack made by Theo focused on simplicity, modularity, and full-stack typesafety.

This project uses the following technologies:

⚠️ This is a community project, not associated with Vercel.

πŸš€ Getting Started

Requirements:

Steps:

  1. Fork this project:
  1. Clone the repository:
git clone [email protected]:YOU_USER/slug.git
  1. Install dependencies:
# Install pnpm globally if you don't have it:
npm install -g pnpm

# and install dependencies:
pnpm install
  1. Create a .env file with the following content:

🚧 The environment variables must match the following schema.

# Database:
DATABASE_URL= # "file:./dev.db"
TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=

# Auth.js =>
AUTH_SECRET=

# Github Provider =>
GITHUB_ID=
GITHUB_CLIENT_SECRET=

# Google Provider =>
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

Database:

Auth.js:

Github Credentials:

Google Credentials:

  1. Generate a new migration file with Prisma:
pnpm db:migrate
  1. Insert the migration data into the Turso database. To do this, go to package.json, modify the db:push command with the name of the migration folder (2024xxxxxxxxxx_init) and run it in your terminal:
pnpm db:push
  1. Run:
  • Development server:
pnpm dev

and open http://localhost:3000 with your browser πŸš€

  • Prisma Studio:
pnpm db:studio

and open http://localhost:5555 with your browser ✨

πŸ”­ Roadmap

This is the roadmap I will be following for the complete migration to v3:

  • βœ… = Stable, completed.
  • πŸ”” = Stable, but unexpected errors may appear.
  • βš™οΈ = In progress.

⬆️ Known issues:

  • βš™οΈ Fix issue when logging in with different provider but with the same email. Redirect to an existing route in the app (authjs error).

⬆️ Dependencies:

  • βœ… Update @prisma/adapter-libsql, @prisma/client & prisma to the stable version when it's released.
  • βš™οΈ Update authjs to the stable version (v5) when it's released.

⬆️ Auth:

  • βœ… Sign In with Github.
  • πŸ”” Sign In with Google.

πŸ”” Only for users who have not previously logged in with an existing email address in their Github account. This is an issue that will be worked on soon.

⬆️ Middleware:

  • βœ… Redirect with /* and /s/*.
  • βœ… Separate public, protected & authentication routes.

⬆️ Dashboard (main):

  • βœ… Create a new short URL.
  • βœ… List all shorted URLs.
  • βœ… Delete a shorted URL.
  • βœ… Update a shorted URL.`

⬆️ Dashboard (tags):

  • βœ… Add search links by tags in the dashboard.
  • πŸ”” Create a new tag.
  • βœ… Delete a tag.
  • βš™οΈ Update the tags of a link.

πŸ”” Add option to change tag color.

⬆️ Dashboard (settings):

  • βœ… Change name.
  • βœ… Change email.
  • βœ… Delete account.
  • βœ… Download all links data.

✌️ Contributing

☁️ Deploy on Vercel

πŸ”‘ License