Skip to main content

Secure file sharing with granular access control

DefDrive provides enterprise-grade file sharing with IP whitelisting, subnet restrictions, time-based expiration, and one-time use links. Control exactly who can access your files and when.

Quick start

Get DefDrive running and make your first authenticated file upload in minutes.

1

Set up DefDrive

Clone the repository and configure your environment:
git clone https://github.com/ankitprasad2005/defdrive.git
cd defdrive
cp .env.example .env
Edit .env and set your database connection string and JWT secret.
2

Start the server

Run DefDrive using Docker Compose or locally with Go:
Docker Compose
docker-compose up --build
Local
go mod tidy
go run main.go
The server will start on port 8080 by default.
3

Create an account

Register a new user account:
cURL
curl -X POST http://localhost:8080/api/signup \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "[email protected]",
    "username": "johndoe",
    "password": "securepassword"
  }'
{
  "message": "User created successfully"
}
4

Authenticate and upload a file

Login to get a JWT token, then upload your first file:
Login
curl -X POST http://localhost:8080/api/login \
  -H "Content-Type: application/json" \
  -d '{
    "username": "johndoe",
    "password": "securepassword"
  }'
Upload
curl -X POST http://localhost:8080/api/upload \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -F "file=@/path/to/file.pdf"
You now have a file in DefDrive with default private access. Learn more about access control.

Explore by feature

DefDrive provides powerful access control features for secure file sharing.

Access control

Create expiring links with IP and subnet restrictions for secure file access

File management

Upload, organize, and manage files with storage quota enforcement

User limits

Configure per-user file count and storage limits

One-time links

Generate single-use download links that expire after first access

TTL configuration

Set time-to-live for access links with automatic expiration

CLI tool

Interactive command-line tool for authentication and configuration

Key features

Built for security, scalability, and developer productivity.

JWT authentication

Secure token-based authentication with bcrypt password hashing

IP whitelisting

Restrict file access to specific IP addresses and CIDR subnet ranges

Time-based expiration

Set expiration dates and TTL (time-to-live) for access links

PostgreSQL backend

Reliable data persistence with GORM ORM and auto-migration support

Ready to get started?

Deploy DefDrive in minutes and start sharing files with enterprise-grade access control.

Get started