# NocoDB No-Code Database

> NocoDB turns any database into a smart spreadsheet with API generation.

- Category: Database Stacks
- Difficulty: beginner
- Components: nocodb, postgres
- Tags: nocodb, no-code, airtable-alternative, spreadsheet, api
- Source: https://docker.recipes/databases/nocodb-database-platform

## Overview

NocoDB is an open-source no-code platform that transforms any database into a smart, collaborative spreadsheet interface while automatically generating REST and GraphQL APIs. Created as an Airtable alternative, NocoDB bridges the gap between traditional databases and user-friendly spreadsheet interfaces, making database management accessible to non-technical users while providing powerful APIs for developers. This Docker stack combines NocoDB with PostgreSQL 16 to create a production-ready no-code database environment. PostgreSQL serves as the robust backend storage engine, providing ACID compliance and enterprise-grade reliability, while NocoDB creates the intuitive spreadsheet interface on top. The combination leverages PostgreSQL's advanced features like JSON support and full-text search through NocoDB's visual interface, eliminating the need for complex SQL queries. This stack is ideal for teams wanting to democratize database access without sacrificing data integrity or performance. Business users can create and manage data through familiar spreadsheet-like interfaces, while developers can integrate with generated APIs. The PostgreSQL foundation ensures the system can scale from prototype to production, supporting complex relationships and queries that simpler no-code solutions cannot handle.

## Features

- Automatic REST and GraphQL API generation from database tables with real-time documentation
- Spreadsheet-like interface with drag-and-drop column management and data validation
- Multiple view types including grid, gallery, kanban, and calendar views for different data perspectives
- Form builder for external data collection with customizable fields and validation rules
- PostgreSQL's JSON/JSONB support through NocoDB's interface for flexible schema design
- Role-based access control with granular permissions at table and column levels
- Real-time collaboration features with change tracking and user activity logs
- Webhook support for automated workflows and third-party integrations

## Use cases

- Small businesses replacing Airtable or Google Sheets with a self-hosted solution
- Development teams creating admin panels and CRUD interfaces without frontend coding
- Non-profit organizations managing donor databases and volunteer coordination systems
- Educational institutions tracking student data and course management
- Startup MVPs requiring rapid database prototyping with instant API access
- Project management teams needing custom workflows beyond traditional tools
- Content management systems with user-friendly interfaces for non-technical editors

## Prerequisites

- Docker and Docker Compose installed on the host system
- Minimum 1GB RAM available (PostgreSQL requirement plus NocoDB overhead)
- Port 8080 available on the host for NocoDB web interface access
- Environment variables configured: POSTGRES_USER, POSTGRES_PASSWORD, NC_AUTH_JWT_SECRET, NC_PUBLIC_URL
- Basic understanding of database concepts for effective table design
- SSL certificate and reverse proxy setup recommended for production deployments

## docker-compose.yml

```yaml
services:
  nocodb:
    image: nocodb/nocodb:latest
    container_name: nocodb
    environment:
      - NC_DB=pg://postgres:5432?u=${POSTGRES_USER}&p=${POSTGRES_PASSWORD}&d=nocodb
      - NC_AUTH_JWT_SECRET=${NC_AUTH_JWT_SECRET}
      - NC_PUBLIC_URL=${NC_PUBLIC_URL}
      - NC_DISABLE_TELE=true
    ports:
      - "8080:8080"
    volumes:
      - nocodb_data:/usr/app/data
    depends_on:
      postgres:
        condition: service_healthy
    networks:
      - nocodb-network

  postgres:
    image: postgres:16-alpine
    container_name: nocodb-db
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=nocodb
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - nocodb-network

volumes:
  nocodb_data:
  postgres_data:

networks:
  nocodb-network:
    driver: bridge
```

## .env

```bash
# NocoDB
POSTGRES_USER=nocodb
POSTGRES_PASSWORD=nocodb_password
NC_AUTH_JWT_SECRET=your-jwt-secret
NC_PUBLIC_URL=http://localhost:8080
```

## Usage notes

- UI at http://localhost:8080
- Create tables like spreadsheets
- Auto-generates REST & GraphQL APIs
- Supports views, forms, galleries
- Can connect to existing databases

## Troubleshooting

- NocoDB fails to connect to database: Verify PostgreSQL container is healthy and environment variables match between services
- Permission denied errors in NocoDB: Check that nocodb_data volume has correct ownership and write permissions
- API requests return 401 unauthorized: Regenerate NC_AUTH_JWT_SECRET and restart nocodb container
- PostgreSQL container exits with 'database system was interrupted': Remove postgres_data volume and restart to reinitialize database
- NocoDB interface loads but shows connection errors: Ensure NC_DB connection string format matches PostgreSQL credentials exactly
- Slow performance with large datasets: Increase PostgreSQL shared_buffers and work_mem through environment variables or custom postgresql.conf

