This is a simple app that allows you to create a one-time link for a user to access a resource.
- Create one-time links for secure sharing of sensitive information
- End-to-end encryption using AES-256
- Support for text content and file uploads (up to 10MB)
- AWS S3 integration for secure file storage
- Custom SMTP server support
- PostgreSQL database for reliable storage
- Automatic data deletion after 24 hours or first access
- Simple and intuitive user interface
- Node.js (v14 or later)
- pnpm package manager
- PostgreSQL database
- AWS Account with S3 access
-
Clone the repository:
git clone https://github.com/byigitt/onetimelink.git cd onetimelink
-
Install dependencies:
pnpm install pnpm add @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
-
Set up the database:
- Create a PostgreSQL database
- Run the schema file from
db/schema.sql
-
Set up AWS S3:
- Create an S3 bucket in your AWS account
- Create an IAM user with S3 access
- Note down the access key and secret key
-
Create a
.env
file in the root directory with the following:# Database Configuration DATABASE_URL=postgresql://user:password@localhost:5432/onetimelink # SMTP Configuration SMTP_HOST=your-smtp-server.com SMTP_PORT=587 SMTP_USER=your-email@domain.com SMTP_PASS=your-password # AWS S3 Configuration AWS_REGION=your-region AWS_ACCESS_KEY_ID=your-access-key AWS_SECRET_ACCESS_KEY=your-secret-key AWS_BUCKET_NAME=your-bucket-name # File Size Limit (10MB in bytes) MAX_FILE_SIZE=10485760 # App URL NEXT_PUBLIC_BASE_URL=http://localhost:3000
-
Configure S3 CORS policy:
{ "CORSRules": [ { "AllowedHeaders": ["*"], "AllowedMethods": ["GET", "PUT", "POST"], "AllowedOrigins": ["your-domain.com"], "ExposeHeaders": [] } ] }
-
Start the development server:
pnpm dev
-
Open http://localhost:3000 in your browser.
- Enter the text content or upload a file (max 10MB).
- Optionally provide an email address for automatic link delivery.
- Click "Generate Link" to create a one-time access link.
- Share the generated link with the intended recipient.
- The link will expire after 24 hours or first access.
- Set up a PostgreSQL database in your production environment
- Configure your SMTP server details
- Set up AWS S3 bucket and IAM user
- Deploy to your preferred platform (Vercel, Railway, etc.)
- Set the environment variables in your deployment platform
DATABASE_URL
: PostgreSQL connection stringSMTP_HOST
: SMTP server hostnameSMTP_PORT
: SMTP server port (usually 587 or 465)SMTP_USER
: SMTP account username/emailSMTP_PASS
: SMTP account passwordAWS_REGION
: AWS region for S3 bucketAWS_ACCESS_KEY_ID
: AWS IAM access keyAWS_SECRET_ACCESS_KEY
: AWS IAM secret keyAWS_BUCKET_NAME
: S3 bucket nameMAX_FILE_SIZE
: Maximum file size in bytes (default: 10MB)NEXT_PUBLIC_BASE_URL
: Your application's base URL
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js for the React framework
- Tailwind CSS for styling
- Shadcn UI for UI components
- PostgreSQL for database
- AWS S3 for file storage
- Nodemailer for email handling