An open-source URL shortener built with T3 Stack.
Dashboard Β Β βΒ Β Roadmap Β Β βΒ Β Contribute Β Β βΒ Β Create issue Β Β βΒ Β X/Twitter
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:
- create-t3-app - The best way to start a full-stack, typesafe Next.js app.
- Next.js 14 App Router - The React Framework for the Web.
- Auth.js v5 - Authentication for the Web.
- Prisma - A next-generation Node.js and TypeScript ORM.
- Turso (SQLite) + libSQL - SQLite for Production.
- Next.js Server Actions - Asynchronous functions that are executed on the server.
- TailwindCSS + shadcn/ui & Radix Primitives - Design System.
- Prettier with prettier-plugin-tailwindcss - Code Formatter.
- Lucide Icons + svgl - Beautiful SVG icons & logos for the web.
β οΈ This is a community project, not associated with Vercel.
Requirements:
- Node.js (+v18.x) installed.
- pnpm (v8+) installed.
- Turso CLI installed (for Windows users, it's necessary to activate WSL 2).
- Visual Studio Code with the recommended extensions installed (ESLint, Prettier, Tailwind CSS IntelliSense).
Steps:
- Fork this project:
- Clone the repository:
git clone [email protected]:YOU_USER/slug.git
- Install dependencies:
# Install pnpm globally if you don't have it:
npm install -g pnpm
# and install dependencies:
pnpm install
- 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:
- Get Auth.js Secret.
AUTH_URL
is the URL of your Auth.js API, for example,/api/auth
. You can change it in theauth.ts
file.
Github Credentials:
Google Credentials:
- Generate a new migration file with Prisma:
pnpm db:migrate
- Insert the migration data into the Turso database. To do this, go to
package.json
, modify thedb:push
command with the name of the migration folder (2024xxxxxxxxxx_init) and run it in your terminal:
pnpm db:push
- 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 β¨
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.
- β slug.vercel.app.