Skip to content

unfolding-io/AstroLinky

Repository files navigation

AstroLinky = Astro Powered URL Shortener with QR

License: CC BY-ND 4.0

👉 Demo

This is a simple URL shortener repo, perfect for creating shortened URLs on your subdomain that redirect to other links.

Features

  • Custom or Auto-Generated URLs: Choose your own URL slugs or let the app auto-generate them.
  • Click Counter: Track the number of clicks for each URL.
  • QR Code Generator: Generates SVG QR codes for easy sharing.
  • Powered by Astro DB + Turso: Leverages Astro DB for quick, serverless data management.
  • Optional Public URL Shortener Interface: Enable a public-facing interface for users to create their own short URLs (can be toggled on or off).  

 

Note: This URL shortener is designed for small-scale use and has not been stress-tested or fully optimized for high traffic. It supports a single admin user defined in the .env file and uses node-jsonwebtoken for authentication. There is currently no brute-force protection, so use with caution. For added security, consider customizing the admin URL and/or enhancing middleware for your needs.

 

Getting Started

Prerequisites

  • Turso CLI for database management. Install it here.

Setup Instructions

  1. Authenticate with Turso

    $ turso auth login
  2. Create the Database

    $ turso db create <my_database_name>
  3. Retrieve Database Info

    $ turso db show <my_database_name>

    Copy the database URL and add it to .env as:

    ASTRO_DB_REMOTE_URL=<your_database_url>
  4. Generate the Token

    $ turso db tokens create <my_database_name>

    Add the generated token to .env as:

    ASTRO_DB_APP_TOKEN=<your_database_token>
  5. Push Database to Production

    $ npm run db:push
  6. Set Up Environment Variables

     USERNAME=AdminUser007
     PASSWORD=My-great-p@ssw0rd
     SECRET_KEY=XozzHgfaassdds!asdmas
     IS_PUBLIC=1
     SHOW_GITHUB=1

    IS_PUBLIC will unlock the public frontpage url-shortner.

  7. Set Up Environment Variables

     $ npm run dev

AtroLinky routes:

  • /
  • /login
  • /admin

☕️ Want to Caffeinate your Developer?

By caffeinating your developer, you're not just getting the best out of them; you're also ensuring a cheerful and energetic work environment.😊

buymeacoffee

📸 Screenshots

AstroLinky Astro Url Shortener AstroLinky Astro Url Shortener AstroLinky Astro Url Shortener AstroLinky Astro Url Shortener

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published