Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adityaoberai/url-shortener-appwrite
A free-to-use, self-hostable URL shortener, made entirely with Appwrite
https://github.com/adityaoberai/url-shortener-appwrite
appwrite appwrite-database appwrite-function css html nodejs url-shortener
Last synced: about 19 hours ago
JSON representation
A free-to-use, self-hostable URL shortener, made entirely with Appwrite
- Host: GitHub
- URL: https://github.com/adityaoberai/url-shortener-appwrite
- Owner: adityaoberai
- License: bsd-3-clause
- Created: 2025-01-28T21:35:21.000Z (2 days ago)
- Default Branch: main
- Last Pushed: 2025-01-29T14:48:28.000Z (1 day ago)
- Last Synced: 2025-01-29T15:20:05.881Z (1 day ago)
- Topics: appwrite, appwrite-database, appwrite-function, css, html, nodejs, url-shortener
- Language: JavaScript
- Homepage: https://67994c1ba299ca0c4bcd.appwrite.global/
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# URL Shortener
A URL shortener app that offers a landing page, creation of short links, listing of all store URLs, and copy and delete actions for all short URLs
## 🧰 Usage
### GET `/`
- Returns an HTML landing page as a static file.
### GET `/styles`
- Returns an CSS file for the HTML landing page as a static file.
### GET `/:shortCode`
- Redirects to the full URL affiliated with the short code.
### GET `/listUrls`
- Gets list of all stored URLs and short codes.
**Response**
Sample `200` Response:
```json
{
"ok": true,
"data": [
{
"url": "https://appwrite.io",
"$id": "appwrite"
},
{
"url": "https://twitter.com/adityaoberai1",
"$id": "twitter"
},
{
"url": "https://appwrite.io/education",
"$id": "edu"
}
]
}
```### POST `/`
- Add URL and short code (as the document ID) to the database.
**Request**
```json
{
"short": "appwrite",
"url": "https://appwrite.io"
}
```**Response**
Sample `200` Response:
```json
{
"ok": true,
"data": {
"short": "appwrite",
"url": "https://appwrite.io"
}
}
```### DELETE `/:shortCode`
- Deletes the short code and affiliated full URL from the database.
**Response**
Sample `200` Response:
```json
{
"ok": true
}
```## ⚙️ Configuration
| Setting | Value |
| ----------------- | ------------- |
| Runtime | Node (22.0) |
| Entrypoint | `src/main.js` |
| Build Commands | `npm install` |
| Permissions | `any` |
| Timeout (Seconds) | 15 |
| Specifiation | s-1vcpu-512mb |
| Scopes | `databases.write`, `databases.read`, `collections.write`, `collections.read`, `attributes.write`, `documents.write`, `documents.read` |## 🔒 Environment Variables
No environment variables required mandatorily. There are two **optional** environment variables, however:
- `APPWRITE_DB_ID`: ID of Appwrite Database which will contain collection of short codes and URLs
- `APPWRITE_COLLECTION_ID`: ID of Appwrite Collection which will contain short codes and URLs