NocoDB Database Block
What is NocoDB?
NocoDB is like having a powerful spreadsheet that's actually a database. It transforms any database into a smart, collaborative workspace that looks and feels like Airtable or Google Sheets, but with the power of a real database underneath. Perfect for teams who want database power without the complexity.
When to Use NocoDB
✅ Perfect for:
- Team collaboration on structured data
- Converting existing databases to user-friendly interfaces
- Project management and tracking systems
- CRM and customer management
- Content management systems
- Quick prototyping with real database backend
❌ Not ideal for:
- Simple file storage needs
- Real-time gaming or chat applications
- High-frequency trading systems
- Applications requiring custom database schemas
- Systems needing complex stored procedures
How It Works
- Connect to NocoDB: Provide your NocoDB server details and API key
- Select Table: Choose which table/view to work with
- Perform Operation: Create, read, update, or delete records
- Handle Relations: Work with linked records and relationships
Real-World Examples
📋 Project Management System
New Task Created → Add to NocoDB Tasks Table → Assign to Team Member → Track ProgressTeams can manage projects with custom fields, deadlines, and status tracking
👥 Customer Relationship Management
New Lead → Add to Contacts Table → Link to Company → Track Interactions → Convert to CustomerManage customer relationships with linked data and custom views
📝 Content Management
Create Article → Add to Articles Table → Link to Author → Set Category → Publish StatusManage blog posts, articles, or any content with relationships and metadata
🛍️ Inventory Management
New Product → Add to Products Table → Link to Supplier → Track Stock → Generate ReportsKeep track of inventory with automatic calculations and alerts
Easy Setup Guide
🔌 Step 1: NocoDB Connection
Server Information:
- Base URL: Your NocoDB server address (like
https://your-nocodb.com) - API Token: Generate from NocoDB account settings
- Project ID: Your project identifier
- Table Name: The table you want to work with
// Connection details
Base_URL = "https://your-nocodb.com"
API_Token = "your-api-token-here"
Project_ID = "project_xyz"
Table_Name = "customers"⚙️ Step 2: Choose Your Operation
GET - Retrieve Records:
Table: "tasks"
Filter: "status eq 'In Progress'"
Sort: "created_at desc"
Limit: 50POST - Create New Record:
Table: "customers"
Data: {
"name": "{{customer_name}}",
"email": "{{customer_email}}",
"company": "{{company_name}}",
"status": "Active"
}PATCH - Update Existing Record:
Table: "tasks"
Record ID: "{{task_id}}"
Data: {
"status": "Completed",
"completed_at": "{{current_timestamp}}"
}DELETE - Remove Record:
Table: "old_records"
Record ID: "{{record_id}}"Common NocoDB Operations
📝 Creating Records
Add New Customer:
Table: "customers"
Data: {
"name": "{{customer_name}}",
"email": "{{email}}",
"phone": "{{phone}}",
"address": "{{address}}",
"created_date": "{{today}}",
"status": "Active",
"priority": "Medium"
}Create Project Task:
Table: "tasks"
Data: {
"title": "{{task_title}}",
"description": "{{task_description}}",
"project_id": "{{project_id}}",
"assigned_to": "{{user_id}}",
"priority": "{{priority_level}}",
"due_date": "{{due_date}}",
"status": "To Do"
}Add Product to Inventory:
Table: "products"
Data: {
"name": "{{product_name}}",
"sku": "{{product_sku}}",
"category_id": "{{category_id}}",
"supplier_id": "{{supplier_id}}",
"cost_price": {{cost_price}},
"selling_price": {{selling_price}},
"stock_quantity": {{initial_stock}},
"reorder_level": {{min_stock}}
}🔍 Reading and Filtering Data
Get Active Customers:
Table: "customers"
Filter: "(status,eq,Active)"
Sort: "name"
Fields: "id,name,email,phone,company"Find Overdue Tasks:
Table: "tasks"
Filter: "(due_date,lt,{{today}})~and(status,neq,Completed)"
Sort: "due_date"
Limit: 20Get Products Low in Stock:
Table: "products"
Filter: "(stock_quantity,le,reorder_level)"
Sort: "stock_quantity"
Fields: "name,sku,stock_quantity,reorder_level"Search Records:
Table: "customers"
Filter: "(name,like,%{{search_term}}%)~or(email,like,%{{search_term}}%)"
Sort: "created_date desc"✏️ Updating Records
Update Customer Information:
Table: "customers"
Record ID: "{{customer_id}}"
Data: {
"phone": "{{new_phone}}",
"address": "{{new_address}}",
"last_updated": "{{current_timestamp}}",
"notes": "{{additional_notes}}"
}Complete Task:
Table: "tasks"
Record ID: "{{task_id}}"
Data: {
"status": "Completed",
"completed_date": "{{today}}",
"completion_notes": "{{notes}}"
}Update Inventory:
Table: "products"
Record ID: "{{product_id}}"
Data: {
"stock_quantity": {{new_quantity}},
"last_restocked": "{{today}}",
"supplier_id": "{{supplier_id}}"
}🔗 Working with Relationships
Link Records:
// Link task to project
Table: "tasks"
Record ID: "{{task_id}}"
Data: {
"project_id": "{{project_id}}", // This creates the link
"assigned_to": "{{user_id}}" // Link to user
}Get Related Data:
// Get tasks with project and user information
Table: "tasks"
Fields: "id,title,status,project_id.name,assigned_to.name"
Filter: "(project_id,eq,{{project_id}})"Working with Views and Filters
📊 Using Views
Create Custom Views:
// NocoDB views can be created in the UI, then accessed via API
View: "high_priority_tasks"
// This view might filter for priority = "High" and status != "Completed"Access View Data:
Table: "tasks"
View: "my_assigned_tasks"
// Gets only tasks assigned to current user🔍 Advanced Filtering
Multiple Conditions:
Filter: "(status,eq,Active)~and(priority,eq,High)~and(due_date,gte,{{today}})"
// Active AND High Priority AND due today or laterOR Conditions:
Filter: "(status,eq,Urgent)~or(priority,eq,Critical)"
// Status is Urgent OR Priority is CriticalDate Filtering:
Filter: "(created_date,gte,{{start_date}})~and(created_date,lte,{{end_date}})"
// Records created within date rangeNested Filtering:
Filter: "((priority,eq,High)~or(priority,eq,Critical))~and(status,neq,Completed)"
// (High OR Critical priority) AND not completedWorking with Workflow Data
🎯 Lead Management Workflow
// Step 1: Create new lead
Table: "leads"
Data: {
"name": "{{lead_name}}",
"email": "{{lead_email}}",
"source": "{{lead_source}}",
"status": "New",
"created_date": "{{today}}"
}
// Step 2: Assign to sales rep
Table: "leads"
Record ID: "{{lead_id}}"
Data: {
"assigned_to": "{{sales_rep_id}}",
"status": "Assigned"
}
// Step 3: Track interactions
Table: "interactions"
Data: {
"lead_id": "{{lead_id}}",
"type": "Email",
"notes": "{{interaction_notes}}",
"date": "{{today}}"
}📦 Order Processing Workflow
// Step 1: Create order
Table: "orders"
Data: {
"customer_id": "{{customer_id}}",
"order_date": "{{today}}",
"status": "Pending",
"total_amount": {{order_total}}
}
// Step 2: Add order items
Table: "order_items"
Data: {
"order_id": "{{order_id}}",
"product_id": "{{product_id}}",
"quantity": {{quantity}},
"unit_price": {{price}}
}
// Step 3: Update inventory
Table: "products"
Record ID: "{{product_id}}"
Data: {
"stock_quantity": {{current_stock - ordered_quantity}}
}
// Step 4: Update order status
Table: "orders"
Record ID: "{{order_id}}"
Data: {
"status": "Processing",
"processed_date": "{{today}}"
}Best Practices
⚡ For Performance
- Use Specific Fields: Only request fields you need
- Limit Results: Use reasonable limits to avoid timeouts
- Filter Efficiently: Use indexes and avoid complex nested filters
- Batch Operations: Group multiple updates when possible
🔒 For Security
- Use API Tokens: Keep your tokens secure and rotate regularly
- Validate Data: Check data before sending to NocoDB
- Set Permissions: Configure proper user permissions in NocoDB
- Sanitize Input: Clean user input to prevent injection attacks
🎯 For Data Organization
- Consistent Naming: Use clear, consistent field names
- Proper Relations: Set up relationships between related tables
- Use Views: Create views for common data queries
- Regular Cleanup: Remove old or unnecessary records
📊 For Workflow Integration
- Error Handling: Handle API errors gracefully
- Data Validation: Validate data before operations
- Logging: Keep track of operations for debugging
- Backup Strategy: Regular backups of important data
Common Use Cases
👥 Team Project Management
// Projects table
{
"name": "Website Redesign",
"description": "Complete overhaul of company website",
"start_date": "2023-01-01",
"end_date": "2023-03-31",
"status": "In Progress",
"manager_id": "user_123"
}
// Tasks table (linked to projects)
{
"title": "Design homepage mockup",
"project_id": "project_456",
"assigned_to": "user_789",
"priority": "High",
"status": "In Progress",
"due_date": "2023-01-15"
}🛒 E-commerce Inventory
// Products table
{
"name": "Wireless Headphones",
"sku": "WH-001",
"category_id": "electronics",
"cost_price": 45.00,
"selling_price": 79.99,
"stock_quantity": 150,
"reorder_level": 20
}
// Orders table
{
"customer_id": "customer_123",
"order_date": "2023-01-15",
"status": "Shipped",
"total_amount": 159.98,
"shipping_address": "123 Main St"
}📚 Content Management
// Articles table
{
"title": "Getting Started with NocoDB",
"author_id": "author_456",
"category_id": "tutorials",
"content": "Article content here...",
"status": "Published",
"publish_date": "2023-01-15",
"featured": true
}
// Categories table
{
"name": "Tutorials",
"description": "How-to guides and tutorials",
"color": "#007bff",
"active": true
}Troubleshooting
❌ API Issues
Authentication Failed:
- Check your API token is correct and not expired
- Verify base URL includes protocol (https://)
- Ensure you have proper permissions for the table
Table Not Found:
- Verify table name matches exactly (case-sensitive)
- Check if table exists in the specified project
- Ensure you have access to the table
🔧 Common Problems
Filter Not Working:
- Check filter syntax carefully
- Use proper field names (case-sensitive)
- Verify filter operators (eq, neq, like, etc.)
- Test filters in NocoDB UI first
Relationship Issues:
- Ensure linked fields are properly configured
- Use correct field names for relationships
- Check if related records exist
Performance Issues:
- Add appropriate limits to queries
- Use specific field selection
- Avoid overly complex filters
- Consider using views for common queries
Node Display
The NocoDB block shows:
- Table Name: Which NocoDB table you're working with
- Operation Type: GET, POST, PATCH, DELETE
- Records Count: Number of records affected
- Filter Applied: Active filters or search criteria
- Connection Status: Connected, error, or unauthorized
Ready to transform your database into a collaborative workspace? NocoDB makes working with data as easy as using a spreadsheet!