Skip to content

Latest commit

Β 

History

History
98 lines (65 loc) Β· 1.67 KB

File metadata and controls

98 lines (65 loc) Β· 1.67 KB

πŸ”— Tiny It API

A minimalist and fast URL shortening API built with Bun and Elysia.js. Supports local development with SQLite and cloud-scale production using Azure Table Storage.


🧰 Getting Started

Prerequisites

  • Bun – JavaScript runtime (v1.0+)
  • Docker – For containerized builds
  • Azure Storage Account – For cloud data persistence (Azure Table Storage)

πŸš€ Running the Application

🐳 Docker

To build and run the app in a container:

docker build -t tinyit-api .
docker run -p 3000:3000 \
  -e NODE_ENV=production \
  -e AZURE_CONN_STRING="<your_connection_string>" \
  -e AZURE_TABLE_NAME="<your_table_name>" \
  -e AZURE_PARTITION_KEY="<your_partition_key>" \
  tinyit-api

⚠️ Replace the environment variables with your Azure credentials.


πŸ–₯ Locally with Bun

Install dependencies and run the server:

bun install
bun run dev

To run using Azure Table Storage, set up a .env file:

ENV=production
AZURE_CONN_STRING=UseDevelopmentStorage=true;
AZURE_TABLE_NAME=<your_table_name>
AZURE_PARTITION_KEY=<your_partition_key>

πŸ“˜ Endpoints

✨ PUT /api/shorten

Creates a shortened URL.

Request Body

{
  "url": "https://example.com"
}

Response

{
  "id": "abc123",
  "url": "https://example.com"
}

πŸ” GET /:id

Redirects to the original URL for the given short ID.

Response

{
    "url": "https://example.com"
}

πŸ“ License

MIT Β© 2025 Oneiro Contributors