SecureLink is a modern, secure URL shortening service. It provides features like authentication-protected links and email notifications.
- Secure Short Links: Create shortened URLs with optional authentication protection
- User Authentication: Secure user registration and login system
- Access Control: Control who can access your shortened links
- Email Notifications: Get notified when protected links are accessed
- Dashboard: User-friendly dashboard to manage all your links
- TanStack Router - Type-safe routing
- TanStack Query - Data fetching and state management
- React Hook Form - Form handling with validation
- React Toastify - Toast notifications
- Zod - Schema validation
- Hono - Fast web framework for Cloudflare Workers
- Better Auth - Authentication library
- Drizzle ORM - Type-safe database ORM
- Cloudflare D1 - SQLite-compatible database
- Cloudflare Workers - Serverless runtime
- Cloudflare D1 - Database
- Vite - Build tool and dev server
- TypeScript - Type safety
- Node.js (v18 or higher)
- npm or yarn
- Cloudflare account
- Wrangler CLI
git clone <repository-url>
cd secure-link
npm install
npm install -g wrangler
wrangler login
Rename .env.sample
file in the root directory to .env
and add the mentioned tokens:
CLOUDFLARE_ACCOUNT_ID=your_account_id
CLOUDFLARE_DATABASE_ID=your_database_id
CLOUDFLARE_API_TOKEN=your_api_token
BETTER_AUTH_SECRET=your_better_auth_secret
BETTER_AUTH_URL=base_url_of_your_app
wrangler d1 create secure-link-db
npm run db:generate
For development:
npm run db:migrate:dev
For production:
npm run db:migrate:prod
npm run dev
This will start:
- Vite dev server for the frontend
- Local Cloudflare Workers environment
- Local D1 database
The application will be available at http://localhost:5173
For development database:
npm run db:studio:dev
For production database:
npm run db:studio:prod
After modifying the schema in worker/db/schema.ts
:
npm run db:generate
npm run db:migrate:dev