Skip to content

ram-a-dhan/slinky

Repository files navigation

Slinky - URL Shortener

Requirements

  • node >= 18.x.x
  • pnpm >= 10.30.3

Initialization

Install the dependencies:

pnpm install

Setup

Dotenv

Copy .env file from .env.example:

cp .env.example .env

Database

For production, change .env database URL to Turso and fill the token:

TURSO_DB_URL=libsql://example-db.turso.io
TURSO_AUTH_TOKEN=example-token-123

Migrate the database:

pnpm run db:migrate

Use Drizzle Studio to check database:

pnpm run db:studio

Google Sign-In

Make a new OAuth Consent Screen project at Google Cloud Console and add the credentials to your .env:

GOOGLE_CLIENT_ID=your-client-id-123
GOOGLE_CLIENT_SECRET=your-client-secret-123

Add the Google Redirect URI from the .env to Google Cloud Console's client's Authorized Redirect URIs:

http://dev.slin.ky:3000/api/auth/google/callback

For production, change the redirect URI:

GOOGLE_REDIRECT_URI=http://<YOUR.PRODUCTION.DOMAIN>/api/auth/google/callback

Google Safe Browsing

Enable Safe Browsing API in API & Services at Google Cloud Console and get the API Key:

GOOGLE_SAFE_BROWSING_API_KEY=your-api-key

Cloudflare Captcha

Get the Turnstile site key and secret key from the Cloudflare Dashboard and put them into the .env:

TURNSTILE_SITE_KEY=your-site-key
TURNSTILE_SECRET_KEY=your-secret-key

Vercel Storage

Setup a Vercel Blob and make use of Vercel CLI:

pnpm add -g vercel
vercel link
vercel storage create
vercel env pull

After pulling the env, copy them from .env.local to .env:

BLOB_READ_WRITE_TOKEN=your-read-write-token
VERCEL_OIDC_TOKEN=your-vercel-oidc-token

Miscellaneous

For production, change the base URL to your production base URL:

BASE_URL=<YOUR.PRODUCTION.DOMAIN>

Development Server

Edit your hosts file:

sudo nano /etc/hosts 

Add this line:

127.0.0.1       dev.slin.ky

Start dev server on http://dev.slin.ky:3000:

pnpm dev

Production

Build for production:

pnpm build

Preview production build:

pnpm preview

About

Slinky - Fast & Free URL Shortener

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors