Building an Advanced Private Airtable Alternative: Deploying NocoDB with an Existing PostgreSQL Database on a VPS
Introduction: The Rise of Open-Source No-Code Databases
In the modern corporate landscape, rapid application development and agile data management are paramount. Platforms like Airtable have revolutionized how teams collaborate on data, offering a spreadsheet-like interface on top of a relational structure. However, for enterprises handling sensitive data, proprietary third-party SaaS solutions pose substantial challenges regarding data sovereignty, compliance (such as GDPR or HIPAA), and escalating licensing costs.
Enter NocoDB, a powerful open-source No-Code platform that transforms any relational database into a smart spreadsheet. Instead of migrating your data to a third-party cloud, NocoDB allows you to connect directly to your existing infrastructure. In this comprehensive guide, we will walk through the advanced deployment of a private, production-ready Airtable alternative by connecting NocoDB to an existing PostgreSQL database hosted on a Virtual Private Server (VPS). This approach guarantees absolute control over your data layer while delivering an elite user experience to your business teams.
---Why NocoDB and PostgreSQL on a Private VPS?
Choosing a self-hosted NocoDB stack over public SaaS alternatives offers distinct architectural and financial advantages for business operations:
- Total Data Ownership: Your data never leaves your infrastructure. It resides safely within your isolated PostgreSQL instances on your own VPS.
- Zero Data Migration: Unlike other tools that require you to import data into their proprietary format, NocoDB acts as a virtual schema layer over your existing PostgreSQL tables. Your existing applications can continue writing to the database seamlessly.
- Granular Access Control: Build enterprise-grade Role-Based Access Control (RBAC) to share specific views, tables, or fields with internal teams or external clients without exposing the entire database.
- Cost Efficiency: Eliminate per-user monthly subscription fees. Your only costs are the flat-rate VPS resources, making scaling to hundreds of users highly economical.
Prerequisites and System Architecture
Before initiating the deployment, ensure your environment meets the following technical baselines:
- A VPS running a modern Linux distribution (e.g., Ubuntu 22.04 LTS or later) with a public IP address.
- Docker and Docker Compose installed and updated to the latest stable versions.
- An active, accessible PostgreSQL (v12 to v16+) database instance containing data or acting as the primary application database.
- A registered Domain Name or Subdomain (e.g.,
nocodb.yourcompany.com) pointed via A Record to your VPS IP address for SSL configuration.
Architectural Note: NocoDB requires its own metadata database to store configurations, user roles, views, and dashboards. It is highly recommended to separate NocoDB's metadata from your primary business production database to avoid schema pollution and maintain operational isolation.---
Step-by-Step Deployment Blueprint
Step 1: Preparing the PostgreSQL Database
First, we need to ensure NocoDB has the proper permissions to interact with your existing PostgreSQL database. Log into your PostgreSQL instance and execute the following SQL commands to create a dedicated user for NocoDB operations:
CREATE USER nocodb_user WITH PASSWORD 'YourSecurePasswordHere';
GRANT ALL PRIVILEGES ON DATABASE your_existing_db TO nocodb_user;
If your database uses strict schema controls, ensure that nocodb_user has privileges to read, write, and alter schemas in the target schema (typically public):
\c your_existing_db;
GRANT ALL PRIVILEGES ON SCHEMA public TO nocodb_user;
Step 2: Configuring the Docker Compose Environment
To ensure a reliable, reproducible deployment, we will use Docker Compose. Create a dedicated directory on your VPS and navigate into it:
mkdir -p /opt/nocodb-stack && cd /opt/nocodb-stack
Create a file named docker-compose.yml and insert the configuration below. In this architecture, NocoDB utilizes a dedicated lightweight PostgreSQL container for its metadata, while connecting externally to your existing production database.
version: '3.8'
services:
nocodb-meta:
image: postgres:15-alpine
container_name: nocodb-metadata-db
environment:
POSTGRES_DB: nocodb_metadata
POSTGRES_USER: postgres
POSTGRES_PASSWORD: MetaSecretPassword123
volumes:
- nocodb_meta_data:/var/lib/postgresql/data
networks:
- nocodb-network
restart: always
nocodb:
image: nocodb/nocodb:latest
container_name: nocodb-app
ports:
- "8080:8080"
environment:
- NC_DB=pg://nocodb-meta:5432?u=postgres&p=MetaSecretPassword123&d=nocodb_metadata
- NC_AUTH_JWT_SECRET=YourSuperLongRandomJWTSecretKeyChangeMe
- NC_PUBLIC_URL=[https://nocodb.yourcompany.com](https://nocodb.yourcompany.com)
depends_on:
- nocodb-meta
networks:
- nocodb-network
restart: always
networks:
nocodb-network:
driver: bridge
volumes:
nocodb_meta_data:
driver: local
Step 3: Launching the Stack
Execute the following command to pull the images and launch the containers in detached mode:
docker compose up -d
Verify that both containers are running optimally by checking the system logs:
docker compose logs -f nocodb
---
Securing NocoDB via Reverse Proxy and SSL
Exposing port 8080 directly to the internet is a severe security risk. To secure enterprise operations, we must route traffic through a reverse proxy like Nginx and enforce HTTPS using Let's Encrypt Certbot.
Nginx Configuration
Create a new Nginx server block configuration file:
sudo nano /etc/nginx/sites-available/nocodb.conf
Add the following production proxy routing template:
server {
listen 80;
server_name nocodb.yourcompany.com;
location / {
proxy_pass [http://127.0.0.1:8080](http://127.0.0.1:8080);
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Extended timeouts for large database queries
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
}
Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/nocodb.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Automating SSL Certification
Run Certbot to acquire and automatically configure an SSL certificate:
sudo certbot --nginx -d nocodb.yourcompany.com
Select the option to automatically redirect all HTTP traffic to HTTPS, securing all data in transit between your users and the VPS.
---Connecting Your Existing PostgreSQL Database
With NocoDB successfully deployed and secured via HTTPS, navigate to [https://nocodb.yourcompany.com](https://nocodb.yourcompany.com) in your browser. Follow these steps to map your production data:
- Create the Root Admin Account: Set up your initial administrator credentials. This user controls global system permissions.
- Create a New Project: Select "Create New Project" and choose "Connect to External Database".
- Input Database Credentials: Select PostgreSQL as the database type and fill out your connection parameters:
- Host: Enter your VPS private IP or external database endpoint.
- Port: 5432 (or your custom PostgreSQL port).
- User/Password: Use the
nocodb_usercredentials created in Step 1. - Database Name:
your_existing_db.
- Sync Schema: Click "Test Connection" and then "Submit". NocoDB will instantly parse your PostgreSQL tables, indexes, and relationships, presenting them as an interactive spreadsheet UI.
Advanced Enterprise Features and Best Practices
To operate a private Airtable alternative at an enterprise scale, implement these advanced adjustments:
1. Handling Automatic Schema Sync
If external applications modify your PostgreSQL schema (e.g., adding a column via a migration script), NocoDB needs to be synchronized. Navigate to Source Settings within the NocoDB UI and click "Sync Schema" to keep your spreadsheet view perfectly aligned with your physical database design without manual reconfiguration.
2. Optimizing Performance with Database Indexing
NocoDB performs complex filtering, sorting, and text searches. To prevent performance degradation when dealing with tables containing hundreds of thousands of rows, ensure your primary foreign keys and frequently searched text columns have proper B-Tree or GIN indexes configured directly inside PostgreSQL.
3. Automating System Backups
While your business data resides in your primary database, you must secure your NocoDB metadata (views, formulas, team configurations). Implement a daily cron job on the VPS to back up the metadata volume:
#!/bin/bash
BACKUP_DIR="/opt/nocodb-stack/backups"
mkdir -p $BACKUP_DIR
docker exec -t nocodb-metadata-db pg_dumpall -U postgres | gzip > "$BACKUP_DIR/nocodb_meta_$(date +%F).sql.gz"
find $BACKUP_DIR -type f -mtime +7 -delete # Retain backups for 7 days
---
Conclusion
By marrying the robust, enterprise-grade capabilities of PostgreSQL with the intuitive, frictionless user interface of NocoDB, you create a powerful, self-hosted data ecosystem. This private 'Airtable' empowers non-technical business units to manipulate data, generate views, and build automations safely, while data architects and developers retain absolute control over the underlying database infrastructure. Deploying this solution on a private VPS reduces SaaS spend, enhances performance, and strictly enforces corporate data compliance—positioning your organization's infrastructure securely for the future.
