Skip to main content
Zipline provides two powerful features for managing users: invite codes for controlling who can register, and quotas for limiting storage and resource usage per user.

Invite Codes

Invite codes allow you to control who can register for your Zipline instance. This is useful for private instances or limiting access to trusted users.

Configuration

Enable invites in your database configuration:
  • invitesEnabled: Enable the invite system
  • invitesLength: Length of generated invite codes (default: 6 characters)
  • featuresUserRegistration: Allow registration without invite codes
If featuresUserRegistration is false, users must have an invite code to register.

Invite Code Structure

Invite codes are stored in the database:
Fields:
  • code: The unique invite code (e.g., “abc123”)
  • uses: How many times this code has been used
  • maxUses: Maximum number of uses (null = unlimited)
  • expiresAt: When the invite expires (null = never)
  • inviterId: The user who created this invite

Creating Invites

Administrators can create invite codes through the admin panel or API:
Response:

Using Invite Codes

When registering, users provide the invite code:
The registration process validates the invite code at src/server/routes/api/auth/register.ts:52:
Users can share invite links:
This redirects to the registration page with the code pre-filled:

User Quotas

Quotas limit how much storage or how many files/URLs each user can create. This helps manage server resources and prevents abuse.

Quota Types

Zipline supports three types of file quotas:

By Bytes

Limit total storage size (e.g., 1GB, 10GB)

By Files

Limit number of files (e.g., 100 files)

No Limit

No quota restrictions
Additionally, you can limit the number of shortened URLs per user.

Database Schema

Setting Quotas

Administrators can set quotas for users:
For file count quotas:
To remove quotas:

Quota Enforcement

Quotas are checked before file uploads at src/lib/api/upload.ts:32:

URL Quotas

URL quotas are checked when shortening URLs:

Byte Size Formats

Quota sizes support human-readable formats:
  • "100mb" = 100 megabytes
  • "1gb" = 1 gigabyte
  • "500kb" = 500 kilobytes
  • "1tb" = 1 terabyte
These are parsed using the bytes library.

Admin Management

Viewing User Quotas

Administrators can view quota usage:
Response:

Managing Invites

List all invites:
Delete an invite:

Use Cases

Private Instance with Invites

Create limited-use invites for friends:

Tiered Storage Plans

Free tier:
Premium tier:
Unlimited tier:

Temporary Access

Create time-limited invites for temporary users:
Set temporary quotas:

Best Practices

  • Set reasonable defaults: Start with conservative quotas and adjust based on usage
  • Monitor usage: Regularly review user quota consumption
  • Communicate limits: Make quota limits clear to users
  • Plan for growth: Design quotas that can scale with your infrastructure
  • Use expiring invites: Set expiration dates on invite codes for security
  • Limit invite uses: Prevent invite code sharing by setting maxUses

Troubleshooting

”Invalid invite code” Error

  • Check the code hasn’t expired (expiresAt)
  • Verify the code hasn’t reached max uses
  • Ensure invites are enabled (invitesEnabled: true)
  • Confirm the code exists in the database

Quota Exceeded Errors

  • Check current usage with GET /api/users/:userId
  • Verify quota settings are correct
  • Ensure quota values are properly formatted (“1gb” not “1GB”)
  • Delete old files to free up quota

User Can’t Register

  • If featuresUserRegistration is false, they need an invite code
  • Check that the invite code is valid and not expired
  • Verify invites are enabled in configuration
  • Ensure username isn’t already taken