Deploying Shelf
Introduction
Shelf is a modern, self-hosted asset management and inventory tracking system designed for small to medium organizations. It provides an intuitive interface for tracking physical assets, equipment, and inventory with features like QR code labels, custom fields, location tracking, and custody management.
Built with Remix on the frontend and a modern Node.js backend, Shelf offers a responsive user experience that works well on both desktop and mobile devices. The QR code integration allows for quick asset lookups by scanning labels, making it ideal for equipment check-out systems and inventory audits.
Key highlights of Shelf:
- QR Code Labels: Generate and print QR codes for asset tracking
- Custom Fields: Define custom attributes for different asset types
- Location Tracking: Organize assets by locations and sub-locations
- Custody Management: Track who has which equipment
- Categories and Tags: Flexible asset organization
- Asset Images: Attach photos to asset records
- CSV Import/Export: Bulk data management
- Search and Filtering: Find assets quickly
- Activity Log: Track asset history and changes
- 100% Open Source: Licensed under AGPL-3.0
This guide walks through deploying Shelf on Klutch.sh using Docker, setting up your asset database, and organizing your inventory.
Why Deploy Shelf on Klutch.sh
Deploying Shelf on Klutch.sh provides several advantages:
Simplified Deployment: Klutch.sh handles container orchestration without complex setup.
Persistent Storage: Attach persistent volumes for database and asset images.
HTTPS by Default: Klutch.sh provides automatic SSL certificates for secure access.
Mobile Access: Access your asset database from anywhere for quick lookups.
Custom Domains: Use your own domain for a professional asset management system.
Prerequisites
Before deploying Shelf on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your Shelf configuration
- Basic familiarity with Docker and containerization concepts
- A PostgreSQL database
Preparing Your Repository
Create a GitHub repository with your Shelf configuration.
Repository Structure
shelf-deploy/├── Dockerfile└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM ghcr.io/shelf-nu/shelf:latest
# Environment variablesENV NODE_ENV=productionENV DATABASE_URL=${DATABASE_URL}ENV SESSION_SECRET=${SESSION_SECRET}ENV SERVER_URL=${SERVER_URL}
# SMTP configuration (optional)ENV SMTP_HOST=${SMTP_HOST:-}ENV SMTP_PORT=${SMTP_PORT:-587}ENV SMTP_USER=${SMTP_USER:-}ENV SMTP_PWD=${SMTP_PWD:-}ENV SMTP_FROM=${SMTP_FROM:-}
# Expose the web interface portEXPOSE 3000Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | - | PostgreSQL connection string |
SESSION_SECRET | Yes | - | Secret for session encryption |
SERVER_URL | Yes | - | Public URL of your Shelf instance |
SMTP_HOST | No | - | SMTP server for email notifications |
SMTP_PORT | No | 587 | SMTP server port |
SMTP_USER | No | - | SMTP username |
SMTP_PWD | No | - | SMTP password |
SMTP_FROM | No | - | Email sender address |
INVITE_EXPIRY_TTL_DAYS | No | 7 | Days until invite links expire |
Deploying Shelf on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 3000
Set Up Database
Shelf requires a PostgreSQL database. Deploy a PostgreSQL instance or use a managed database service.
Generate Session Secret
Generate a secure session secret:
openssl rand -hex 32Push Your Repository to GitHub
Initialize and push your repository:
git initgit add Dockerfile .dockerignoregit commit -m "Initial Shelf deployment configuration"git remote add origin https://github.com/yourusername/shelf-deploy.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project with a descriptive name like “shelf” or “asset-management”.
Create a New App
Within your project, create a new app. Connect your GitHub account and select your Shelf repository.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
DATABASE_URL | postgresql://user:password@host:5432/shelf |
SESSION_SECRET | Your generated secret |
SERVER_URL | https://your-app-name.klutch.sh |
Attach Persistent Volumes
Add the following volume:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/app/public/uploads | 10 GB | Asset images and attachments |
Deploy Your Application
Click Deploy to start the build process.
Access Shelf
Once deployment completes, access your Shelf instance at https://your-app-name.klutch.sh.
Initial Configuration
Creating Your Account
- Navigate to your Shelf instance
- Click Sign Up to create an admin account
- Verify your email if SMTP is configured
- Log in to access the dashboard
Setting Up Locations
- Go to Locations in the sidebar
- Click New Location
- Enter location name and description
- Create sub-locations for detailed organization
Creating Categories
- Go to Categories
- Click New Category
- Set category name and color
- Categories help organize different asset types
Adding Custom Fields
- Go to Custom Fields
- Click New Custom Field
- Configure:
- Field name
- Field type (text, number, date, boolean, option)
- Required/optional
- Assign to categories
Managing Assets
Adding Assets
- Click New Asset
- Enter asset details:
- Title and description
- Category
- Location
- Custom field values
- Upload images
- Save the asset
QR Code Labels
- Open an asset
- Click the QR code icon
- Print or download the QR code
- Attach to the physical asset
- Scan with mobile to view asset details
Custody Tracking
- Open an asset
- Click Assign Custody
- Select the person or team
- Add notes if needed
- Track check-outs and returns
Bulk Import
- Go to Settings > Import
- Download the CSV template
- Fill in asset data
- Upload and import
Troubleshooting
Database Connection Error
Symptoms: Application fails to start or shows database errors.
Solutions:
- Verify
DATABASE_URLis correct - Ensure database server is accessible
- Check database user permissions
- Run migrations if needed
Images Not Loading
Symptoms: Asset images don’t display.
Solutions:
- Verify persistent volume is mounted
- Check file permissions
- Ensure
SERVER_URLis correct
QR Codes Not Scanning
Symptoms: Mobile scanning fails to open asset page.
Solutions:
- Verify
SERVER_URLmatches your actual URL - Ensure HTTPS is working
- Check QR code print quality
Additional Resources
Conclusion
Deploying Shelf on Klutch.sh gives you a modern asset management system that makes tracking equipment and inventory straightforward. With QR code labels, custom fields, and custody tracking, Shelf provides the tools you need to keep your physical assets organized and accountable.