MCPcopy Index your code
hub / github.com/CordlessWool/shrtn

github.com/CordlessWool/shrtn @v2.10.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.10.1 ↗ · + Follow
96 symbols 295 edges 54 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Shrtn – host your own URL shortener

You will find more details about the setup on https://shrtn.io/setup.

Docker Setup Instructions

  1. Install Docker: Download from Docker's official website.
  2. Run the Docker Container:

From Docker Hub:

docker run -d -p 3001:3001 \
--name your-shrtn-container \
-v ./data:/data \
-e ORIGIN=http://localhost:3001 \
-e MAIL_FROM=noreply@example.com \
cordlesswool/shrtn

From GitHub Container Registry (ghcr.io):

docker run -d -p 3001:3001 \
--name your-shrtn-container \
-v ./data:/data \
-e ORIGIN=http://localhost:3001 \
-e MAIL_FROM=noreply@example.com \
ghcr.io/cordlesswool/shrtn
  1. Access the Application: Navigate to http://localhost:3001.

Setup from Downloaded Package

  1. Download and Extract: Get the package from the releases page and extract it.
  2. Install Dependencies and Start: bash bun install --production bun run db:migrate node ./index.js
  3. Access the Application: Navigate to http://localhost:3001.

Environment Variables

To configure the application, set the following environment variables. Default values are provided for convenience.

# Database connection string
DATABASE_URL=file:sqlite_file_name.db

# Base URL for the public-facing site, could also be provided by request headers
ORIGIN=http://localhost:5173

# Using SMTP to send emails
MAIL_PROVIDER=smtp
MAIL_HOST=smtp.example.com
MAIL_FROM=noreply@example.com
MAIL_PORT=465
MAIL_USER=noreply@example.com
MAIL_PASS=secure_password

# Using Mailgun to send emails
MAIL_PROVIDER=mailgun
MAILGUN_API_KEY=your_mailgun_api_key
MAILGUN_DOMAIN=your_mailgun_domain
MAILGUN_URL=https://api.mailgun.net

# Using Mailpit to send emails
MAIL_PROVIDER=mailpit
MAILPIT_DOMAIN=http://localhost:8025

# Time-to-live settings for temporary and user-generated content
## Possible values: HOUR, DAY, WEEK, MONTH, YEAR, EVER
PUBLIC_TTL_TEMP=YEAR  # Temporary content expires after 30 days
PUBLIC_TTL_USER=EVER # User-generated content expires after 1 year

Database

With the Version 2 the package switched from better-sqlite3 to libSQL. This means you can now use a higher variety of databases.

In combination with Cloudflare you will now be able to use Cloudflare D1.

Cloudflare Worker

In version 2, support for Cloudflare workers was added. There is a wrangler file in the source directory.

Remember to adapt the envs to your needs.

Extension points exported contracts — how you extend this code

Locals (Interface)
(no doc)
src/app.d.ts
Link (Interface)
(no doc)
src/lib/definitions.ts

Core symbols most depended-on inside this repo

getDB
called by 15
src/lib/server/db/index.ts
isIPv4InRange
called by 10
src/lib/helper/link.ts
toTTLSTEP
called by 8
src/lib/helper/defaults.ts
isIPv6InRange
called by 6
src/lib/helper/link.ts
combine
called by 6
e2e/helper/general.ts
createUUID
called by 3
src/lib/helper/identifiers.ts
ttlFromStep
called by 3
src/lib/helper/form.ts
isPublicLink
called by 3
src/lib/helper/link.ts

Shape

Function 92
Enum 2
Interface 2

Languages

TypeScript100%

Modules by API surface

src/lib/helper/form.ts10 symbols
src/lib/helper/link.ts9 symbols
e2e/helper/login.ts9 symbols
e2e/helper/shortener.ts7 symbols
src/lib/server/auth.ts6 symbols
src/lib/server/mail/provider/mailgun.ts3 symbols
src/lib/server/db/index.ts3 symbols
src/lib/helper/defaults.ts3 symbols
src/lib/helper/auth.server.ts3 symbols
e2e/helper/navigation.ts3 symbols
e2e/helper/general.ts3 symbols
src/routes/login/[hash]/+page.server.ts2 symbols

For agents

$ claude mcp add shrtn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact