Treelab is a Next.js application built for flexible, hierarchical data management. It allows users to create and organize data trees using custom-defined templates. The project draws inspiration from the excellent desktop application Treeline, while extending the concept to the web with browser-based access, collaborative tree sharing with concurrent editing, version control, and streamlined handling of images and file attachments within nodes.
In practice, Treelab is used daily to track laboratory activities, fabrication processes, present project progress to customers, and manage lightweight databases.
- 🕸️ Hierarchical Data: Organize data in a nested, tree-like structure with full drag-and-drop support for reordering and reparenting nodes.
- 🎨 Custom Templates: Design templates with a rich set of field types (text, date, dropdowns, pictures, tables, attachments, and more) to structure your data nodes.
- 🌲 Multi-Tree Management: Create, edit, rename, and switch between multiple independent data trees.
- 🔄 Import/Export: Export your trees and templates as JSON or ZIP archive for backup or sharing.
- 🤝 Collaborative Sharing: Tree can be shared with other users and concurrently edited.
- ☁️ GitHub Sync: Configure a GitHub Personal Access Token and link your trees to public or private repositories for document versioning and backup.
This software was developed with the assistance of Large Language Models (AI). While every effort has been made to ensure the integrity, efficiency, and logic of the code through rigorous testing and security-focused reviews, users should be aware of the following:
-
Not for High-Risk Data: This application is not designed to store or process highly sensitive, classified, or "mission-critical" information (e.g., government secrets or financial infrastructure). While data is encrypted at rest, it is not a hardened vault.
-
Security Best Practices: For optimal security, Avoid exposing the application directly to the public internet unless needed and deploy this software locally or within a private network/VPN. Automated backup of database and binary data (attachments) is recommended.
-
As-Is Basis: This software is provided "as-is" without any express or implied warranties. The developer assumes no liability for data loss or security breaches resulting from misuse or unforeseen vulnerabilities.
The recommended setup is to use docker with docker-compose which will run treelab together with a mongodb container. This is an example docker-compose.yml
services:
treelab:
ports:
- 3000:3000
image: ghcr.io/asamarco/treelab
container_name: treelab
volumes:
- ./data:/app/data
- ./config.json:/app/config.json
restart: unless-stopped
env_file: .env
depends_on:
- mongo
mongo:
container_name: mongodb
image: mongo:8.0
restart: unless-stopped
network_mode: swag
volumes:
- ./db:/data/dbNOTE: The data folder where the attachments will be saved should have read and write permissions for the user 65532 (standard user in distroless docker images).
chown -D 65532:65532 data/
This application requires some initial setup to connect to its database and define its core behavior.
Create a .env file in the root of your project. This file is for secret keys and should not be committed to version control.
# The connection string for your MongoDB database.
MONGODB_URI="mongodb://..."
# A 32-character secret key used for encrypting sensitive data in the database.
# You can generate one using an online tool or command line (e.g., openssl rand -base64 24).
ENCRYPTION_KEY="your_32_character_secret_encryption_key"
# A 32-character secret key used for signing authentication sessions
JWT_SECRET_KEY=your_super_secret_jwt_key_at_least_32_chars
This file controls the application's runtime behavior.
{
"REQUIRE_AUTHENTICATION": true,
"USERID": "test"
}REQUIRE_AUTHENTICATION:- Set to
trueto enable multi-user mode with login/registration. This is the standard mode for production. - Set to
falseto run the app in a single-user "demo" mode. All data will be associated with theUSERIDspecified below.
- Set to
USERID:- Only used when
REQUIRE_AUTHENTICATIONisfalse. This string will be the user ID for all data created in demo mode.
- Only used when
