Username: admin
Password: admin
NB: Performing post, put, delete methods in the demo will not reflect in the database.
DASH - Distributed Address Shortening Hub is a decentralized application designed to shorten URLs. It leverages Cloudflare network to ensure fast and reliable short links.
- Decentralized: Utilizes cloudflare and it's vast network for fast serving.
- Secure: Self hosted, so you manage your data.
- User-Friendly: Simple and intuitive interface for easy URL shortening.
-
Login to cloudflare, create a worker project named
dash-apiand create another pages project nameddash-web -
Generate a Cloudflare api token following this link: https://link.shovon.me/wrangler-token
-
Create a KV in cloudflare and copy the id. Follow this for more info: https://link.shovon.me/kv-id
-
Crate an account on NeonDB and get the connection string. Follow this guide if needed: https://link.shovon.me/neon-string
-
Create a JWT secret from here (length 32): https://link.shovon.me/gen-jwt or run this in terminal
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
-
Create a new repo using this template
-
Goto the repo Settings -> Secrets and variables -> Actions. On Repository secrets section add these secrets
| Name | Value | Requirement |
|---|---|---|
| CLOUDFLARE_API_TOKEN | Token generated from requirements step 2 | Required |
| CLOUDFLARE_KV_ID | KV ID from requirements step 3 | Required |
| NEON_DATABASE_URL | DB URL string from requirements step 4 | Required |
| JWT_SECRET | JWT secret from requirements step 5 | Required |
| DEFAULT_USER | Default username for login | Required |
| DEFAULT_PASSWORD | Default password for login | Required |
| API_CUSTOM_DOMAIN | Custom domain for the short link | Optional |
- Goto the
Actionstab on the repo, selectDeploy API and Webaction, selectRun workflow, branch main,Run workflow
-
Clone this repo locally and run
pnpm install -
Open
apps/api/wrangler.toml, replace the{{KV_ID}}from with KV ID from requirements step 3. If you are going to use a custom domain for the short link, uncomment line 4 and replace{{CUSTOM_DOMAIN}}with your custom domain. -
Create a
.envfile inapps/api/and fill in NEON_DATABASE_URL, DEFAULT_USER and DEFAULT_PASSWORD -
Put the Neon database string on worker secret using:
pnpm db:set -
Put the JWT secret on worker using:
pnpm jwt:secret:set -
Run
pnpm worker:deploy:apito deploy the api -
Create a
.envfile inapps/web/and fill in NEXT_PUBLIC_WORKER with the custom domain or the worker url got from previous command -
Run
pnpm pages:deploy:webto deploy the web client
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch- Make your changes and commit them:
git commit -m "Description of changes"- Push to the branch:
git push origin feature-branch- Create a pull request.
This project is licensed under the GPL 3.0 License. See the COPYING file for details.
For any questions or feedback, please open an issue