Folders

API Reference: Folders

Folders are a central organizational concept in FoxNose, designed to help you structure and manage your content efficiently. Think of folders as enhanced database tables that can be nested and support multiple content types. Unlike traditional systems, FoxNose folders can contain different types of data while maintaining clear organization and access controls.

FoxNose offers two distinct folder types, each optimized for different use cases:

  • Composite folders - Flexible containers for mixed content types
  • Collection folders - Structured containers with enforced data models

Understanding the differences between these folder types will help you choose the right approach for your specific needs.

Composite Folders

Composite folders are designed for flexibility and variety. They allow you to store different types of content together, each with its own structure and purpose.

Key Characteristics

  • Mixed Content Types: Store documents, forms, pages, and components together
  • Flexible Schemas: Each resource can have a different structure
  • Nested Schemas: Components can reference and inherit from other components
  • Moderate Scale: Best suited for small to medium-sized datasets

Nested Schemas

One of the most powerful features of composite folders is nested schemas. This allows you to create reusable components that other components can reference, eliminating duplicate field definitions:

πŸ“ Components
β”œβ”€β”€ πŸ“„ Contact Form (name, email, phone, message)
β”œβ”€β”€ πŸ“„ Seo Data (title, description, keywords, og_image)
└── πŸ“„ Landing Page β†’ References: Contact Form + Seo Data
    β”œβ”€β”€ Hero Section (headline, subtitle, cta_button)
    β”œβ”€β”€ Contact Form (nested: name, email, phone, message)
    └── SEO Data (nested: title, description, keywords, og_image)

When you save the Landing Page, FoxNose validates against the complete merged schema, ensuring all nested fields are properly structured.

When to Use Composite Folders

Composite folders work best when you need:

  • Diverse Content: Mixing different types of content (pages, forms, components)
  • Flexible Structure: Different resources need different fields and formats
  • Component Reuse: Common elements shared across multiple resources
  • Rapid Development: Quick iteration without strict schema constraints

Collection Folders

Collection folders are designed for consistency and scale. They enforce a single data model across all resources, ensuring uniformity and enabling powerful search capabilities.

Key Characteristics

  • Uniform Structure: All resources follow the same data model
  • Strict Hierarchy: Collection folders can only contain other collection folders
  • Advanced Search: Full query syntax with joins and complex filtering
  • Scalable: Optimized for large datasets and complex relationships

When to Use Collection Folders

Collection folders are ideal for:

  • Large Datasets: Hundreds or thousands of similar records
  • Consistent Structure: All resources share the same fields and format
  • Complex Queries: Need to search and filter across multiple related collections
  • Business Processes: Managing workflows, applications, and structured business data

Strict Referencing System

Collections support a strict reference system that creates dependency relationships between resources. This is particularly useful when certain data cannot exist independently and must be owned by a parent resource.

Example 1: Beauty Salon Appointments

Managing appointment scheduling where time slots must belong to specific specialists and cannot exist independently. Time slots are meaningless without being assigned to a specific specialist.

πŸ“ Specialists
β”œβ”€β”€ πŸ“„ Maria
β”œβ”€β”€ πŸ“„ Anna
└── πŸ“ Slots
    β”œβ”€β”€ πŸ“„ 10:00 Available (belongs to Maria)
    β”œβ”€β”€ πŸ“„ 11:00 Booked - Haircut (belongs to Maria)
    β”œβ”€β”€ πŸ“„ 14:30 Booked - Hair Color (belongs to Maria)
    β”œβ”€β”€ πŸ“„ 15:00 Available (belongs to Anna)
    └── πŸ“„ 16:00 Booked - Manicure (belongs to Anna)

Example 2: Medical Center Consultations

Organizing medical appointments where consultation slots are tied to specific doctors and their specializations. Medical consultations must belong to a particular doctor.

πŸ“ Doctors
β”œβ”€β”€ πŸ“„ Dr. Smith
β”œβ”€β”€ πŸ“„ Dr. Johnson
└── πŸ“ Appointments
    β”œβ”€β”€ πŸ“„ Mon 9:00 - Heart Checkup (belongs to Dr. Smith)
    β”œβ”€β”€ πŸ“„ Mon 11:00 - Cardiac Screening (belongs to Dr. Smith)
    └── πŸ“„ Tue 15:00 - Skin Analysis (belongs to Dr. Johnson)

Example 3: Online Learning Platform

Structuring educational content where lessons and assignments must belong to specific courses and cannot exist without their parent course context. Course materials only make sense within their specific course context.

πŸ“ Courses
β”œβ”€β”€ πŸ“„ JavaScript Basics
β”œβ”€β”€ πŸ“„ Advanced React
└── πŸ“ Lessons
    β”œβ”€β”€ πŸ“„ Variables & Functions (belongs to JavaScript Basics)
    β”œβ”€β”€ πŸ“„ DOM Manipulation (belongs to JavaScript Basics)
    β”œβ”€β”€ πŸ“„ Component Architecture (belongs to Advanced React)
    └── πŸ“„ State Management (belongs to Advanced React)

In these examples:

  • Deleting the parent automatically handles dependent resources
  • API endpoints reflect the ownership: /specialists/TnMHhM4QTDeu/slots/aooxoscltikj

The strict referencing ensures data integrity for business processes where relationships are critical and prevents orphaned data that doesn't make sense without its parent context.

When to Use Each Folder Type

Understanding when to use each folder type becomes clearer with practical examples that show both approaches:

Choosing the Right Folder Type

Use CaseComposite FoldersCollection Folders
Website Componentsβœ… Different layouts and structures❌ Too restrictive
Configuration Filesβœ… Each config has unique structureβœ… Multiple entities with same config structure
Interface Translationsβœ… Different sections, shared terms❌ Too much structural variety
Custom Fields Management❌ Inconsistent field structureβœ… Standardized field definitions
Landing Pagesβœ… Flexible layouts❌ Each page is unique
Support Tickets❌ Inconsistent trackingβœ… Standard process needed
Product Catalog❌ Hard to search/filterβœ… Complex attributes and filtering
Online Learning❌ Inconsistent course structureβœ… Standardized lesson management
Project Management❌ Varied project typesβœ… Consistent tracking and reporting

Key Decision Factors:

  • Choose Composite Folders: When you need flexibility, varied structures, and component reuse
  • Choose Collection Folders: When you need consistency, scalability, and advanced search capabilities
  • The choice depends on whether you prioritize adaptability (composites) or standardization (collections)

Example 1: Configuration Management

Use Composite Folders when storing global application settings where each configuration type has different structure and requirements.

πŸ“ App Config (Composite)
β”œβ”€β”€ πŸ“„ Database Config (host, port, credentials, pool_size)
β”œβ”€β”€ πŸ“„ API Config (endpoints, rate_limits, timeout)
β”œβ”€β”€ πŸ“„ Email Config β†’ References: Server Settings
β”‚   β”œβ”€β”€ SMTP Settings (nested: host, port, encryption)
β”‚   └── Templates (welcome_template, reset_template)
└── πŸ“„ UI Config (theme, layout, feature_flags)

Use Collection Folders when managing individual user configurations that follow the same structure pattern.

πŸ“ User Settings (Collection: UserConfig Model)
β”œβ”€β”€ πŸ“„ User john_doe (theme: dark, language: en, notifications: true)
β”œβ”€β”€ πŸ“„ User jane_smith (theme: light, language: es, notifications: false)
└── πŸ“„ User alex_chen (theme: auto, language: zh, notifications: true)

Example 2: Interface Translations

Use Composite Folders when managing application translations where different sections need different terms but share common vocabulary.

πŸ“ App Translations (Composite)
β”œβ”€β”€ πŸ“„ Common Terms (save, cancel, delete, confirm)
β”œβ”€β”€ πŸ“„ Navigation Menu β†’ References: Common Terms
β”‚   β”œβ”€β”€ Menu Items (home, about, contact)
β”‚   └── Actions (nested: save, cancel from Common Terms)
β”œβ”€β”€ πŸ“„ User Dashboard (welcome_message, stats_labels)
└── πŸ“„ Error Messages (validation_errors, system_errors)

Example 3: Custom Field Management

Use Collection Folders when managing custom fields for entities like clients, projects, or products where each field follows the same structure but can have different types and configurations.

πŸ“ Projects (Collection: Project Model)
β”œβ”€β”€ πŸ“„ Project Alpha
β”œβ”€β”€ πŸ“„ Project Beta
└── πŸ“ Custom Field Sets (Collection: FieldSet Model)
    β”œβ”€β”€ πŸ“„ Alpha Field Set (belongs to Project Alpha)
    β”œβ”€β”€ πŸ“„ Beta Field Set (belongs to Project Beta)
    └── πŸ“ Field Values (Collection: FieldValue Model)
        β”œβ”€β”€ πŸ“„ Alpha Field Set Values
        └── πŸ“„ Beta Field Set Values

This approach solves a common problem in relational databases where adding custom fields to existing entities is complex and inflexible. With collections, you can easily define field schemas using "one of" patterns for different field types while maintaining consistency across three levels of dependent data.

Example 4: Website Components

Use Composite Folders when managing reusable interface components with varying structures that share common elements.

πŸ“ Components (Composite)
β”œβ”€β”€ πŸ“„ Contact Form (name, email, phone, message)
β”œβ”€β”€ πŸ“„ Seo Data (title, description, keywords, og_image)
└── πŸ“„ Landing Page β†’ References: Contact Form + Seo Data
    β”œβ”€β”€ Hero Section (headline, subtitle, cta_button)
    β”œβ”€β”€ Contact Form (nested: name, email, phone, message)
    └── SEO Data (nested: title, description, keywords, og_image)

Search and Filtering Capabilities

Both folder types support search operations, but with different capabilities:

FeatureComposite FoldersCollection Folders
Basic Filteringβœ… Standard field-based filtersβœ… Standard field-based filters
Full-Text Searchβœ… Search across all contentβœ… Search across all content
Advanced Queries❌ Limited to basic operationsβœ… Complex conditions and operators
Join Operations❌ Cannot combine multiple foldersβœ… Combine data from related collections
Component Specification⚠️ Must specify component typeβœ… Uniform structure, no specification needed
Relationship Queries⚠️ Only through reference fieldsβœ… Search based on strict references

Key Takeaways:

  • Composite folders are great for basic search within varied content types
  • Collection folders excel at complex queries across structured, related data
  • Choose collections when you need advanced search capabilities and structured data relationships

Was this page helpful?