# NocoDB

No-code database platform that turns any database into a smart spreadsheet.

## Overview

NocoDB is an open-source no-code platform that transforms any database into a smart spreadsheet interface. It provides a user-friendly way to manage data, create forms, build APIs, and collaborate on database operations without requiring extensive technical knowledge.

## Features

- **Smart Spreadsheet Interface**: Transform databases into intuitive spreadsheets
- **Form Builder**: Create custom forms for data entry
- **API Generation**: Auto-generated REST APIs for all tables
- **Collaboration**: Real-time collaboration with team members
- **Access Control**: Role-based permissions and sharing
- **Data Visualization**: Charts and dashboard creation
- **Webhooks**: Integration with external services
- **Import/Export**: Support for CSV, Excel, and other formats
- **Multi-Database Support**: Works with PostgreSQL, MySQL, SQLite, and more

## Access

- **Default Port**: 8090
- **URL**: `http://localhost:8090`
- **Database**: PostgreSQL (dedicated `root_db` instance)

## Configuration

### Environment Variables

- `NOCODB_PORT`: External port mapping (default: 8090)
- `NC_DB`: Database connection string for PostgreSQL backend

### Database Backend

NocoDB uses a dedicated PostgreSQL instance (`root_db`) with the following configuration:
- **Database Name**: `root_db`
- **Username**: `postgres`
- **Password**: `password`
- **Host**: `root_db` (internal container name)

### Volumes

- `nc_data`: Application data and configuration storage
- `db_data`: PostgreSQL database files

## Getting Started

1. **Access NocoDB**: Navigate to `http://localhost:8090`
2. **Initial Setup**: Complete the onboarding process
3. **Create Project**: Start with a new project or connect existing databases
4. **Add Tables**: Import data or create new tables
5. **Configure Views**: Set up different views (Grid, Form, Gallery, etc.)
6. **Set Permissions**: Configure user access and sharing settings

## Common Use Cases

### Content Management
- Create content databases for blogs and websites
- Manage product catalogs and inventories
- Track customer information and interactions

### Project Management
- Task and project tracking systems
- Team collaboration workspaces
- Resource and timeline management

### Data Collection
- Custom forms for surveys and feedback
- Event registration and management
- Lead capture and CRM systems

### Integration with Other Services

NocoDB can integrate well with other Changemaker Lite services:

- **n8n Integration**: Use NocoDB as a data source/destination in automation workflows
- **Listmonk Integration**: Manage subscriber lists and campaign data
- **Documentation**: Store and manage documentation metadata

## API Usage

NocoDB automatically generates REST APIs for all your tables:

```bash
# Get all records from a table
GET http://localhost:8090/api/v1/db/data/v1/{project}/table/{table}

# Create a new record
POST http://localhost:8090/api/v1/db/data/v1/{project}/table/{table}

# Update a record
PATCH http://localhost:8090/api/v1/db/data/v1/{project}/table/{table}/{id}
```

## Backup and Data Management

### Database Backup

Since NocoDB uses PostgreSQL, you can backup the database:

```bash
# Backup NocoDB database
docker exec root_db pg_dump -U postgres root_db > nocodb_backup.sql

# Restore from backup
docker exec -i root_db psql -U postgres root_db < nocodb_backup.sql
```

### Application Data

Application settings and metadata are stored in the `nc_data` volume.

## Security Considerations

- Change default database credentials in production
- Configure proper access controls within NocoDB
- Use HTTPS for production deployments
- Regularly backup both database and application data
- Monitor access logs and user activities

## Performance Tips

- Regular database maintenance and optimization
- Monitor memory usage for large datasets
- Use appropriate indexing for frequently queried fields
- Consider database connection pooling for high-traffic scenarios

## Troubleshooting

### Common Issues

**Service won't start**: Check if the PostgreSQL database is healthy
```bash
docker logs root_db
```

**Database connection errors**: Verify database credentials and network connectivity
```bash
docker exec nocodb nc_data nc
```

**Performance issues**: Monitor resource usage and optimize queries
```bash
docker stats nocodb root_db
```

## Official Documentation

For comprehensive guides and advanced features:
- [NocoDB Documentation](https://docs.nocodb.com/)
- [GitHub Repository](https://github.com/nocodb/nocodb)
- [Community Forum](https://community.nocodb.com/)