Skip to main content
Activepieces uses a relational database to store workflows, executions, users, and all application data. PostgreSQL is required for production deployments.

Database Support

PostgreSQL

ProductionFully supported relational database with:
  • ACID compliance
  • Replication support
  • Advanced querying
  • Horizontal scaling
Minimum: PostgreSQL 14Recommended: PostgreSQL 15 or 16

SQLite

Development OnlyEmbedded database for local development:
  • No server setup needed
  • File-based storage
  • Limited concurrency
Not suitable for production. Use PostgreSQL instead.

PostgreSQL Setup

Using Docker Compose

The easiest way is to use the provided Docker Compose configuration:
docker-compose.yml
Start PostgreSQL:

Manual Installation

Create Database

1

Connect to PostgreSQL

2

Create database

3

Create user (optional)

4

Verify connection

Database Configuration

Configure Activepieces to connect to PostgreSQL:

Basic Configuration

.env

Connection URL

Alternatively, use a connection URL:
.env
The connection URL format is: postgresql://[user[:password]@][host][:port][/database][?param1=value1&...]

SSL Configuration

Enable SSL for secure connections:
.env
With connection URL:
.env
SSL modes:
  • disable: No SSL
  • require: SSL required
  • verify-ca: Verify CA certificate
  • verify-full: Verify CA and hostname

Connection Pooling

Configure connection pool for better performance:
.env
Pool size guidelines:
  • Development: 5-10
  • Production (single instance): 10-20
  • Production (multiple instances): Calculate total_connections / instance_count

Database Migrations

Activepieces uses TypeORM for database migrations. Migrations run automatically on startup.

Migration Process

When Activepieces starts:
  1. Connects to the database
  2. Checks for pending migrations
  3. Applies migrations in order
  4. Logs migration results
Migrations are located in:
  • Community Edition: packages/server/api/src/app/database/migration/
  • Enterprise Edition: packages/server/api/src/app/ee/database/migrations/

Manual Migration

To run migrations manually:

Database Entities

Activepieces creates the following tables (source: database-connection.ts:60):
  • flow: Workflow definitions
  • flow_version: Workflow versions
  • flow_run: Execution logs
  • project: Projects (workspaces)
  • user: User accounts
  • file: File storage metadata
  • trigger_event: Trigger events
  • app_connection: OAuth and API connections
  • piece_metadata: Integration metadata
  • tag: Tags for organizing pieces
  • piece_tag: Many-to-many piece-tag relationships
  • app_event_routing: Event routing rules
  • trigger_source: Webhook trigger sources
  • store_entry: Key-value storage
  • table: Database tables
  • field: Table columns
  • record: Table rows
  • cell: Table cell values
  • project_member: Team members
  • project_role: Custom roles
  • api_key: API keys
  • audit_event: Audit logs
  • custom_domain: Custom domains
  • oauth_app: Custom OAuth apps
  • signing_key: JWT signing keys

Database Maintenance

Backups

Create a full database backup:

Restore

1

Stop Activepieces

2

Drop database

3

Create new database

4

Restore backup

5

Restart Activepieces

Vacuum and Analyze

Regularly optimize the database:
Automate with cron:

Performance Tuning

PostgreSQL Configuration

Edit postgresql.conf for better performance:
postgresql.conf
Restart PostgreSQL after changes:

Indexes

Activepieces creates indexes automatically, but you can verify:

Monitoring

Monitor database performance:

High Availability

PostgreSQL Replication

Setup master-replica replication:
1

Configure Master

Edit postgresql.conf on master:
Edit pg_hba.conf:
2

Create replication user

3

Setup replica

Create standby.signal file:

Using Managed Services

Cloud PostgreSQL services with built-in HA:

AWS RDS

Multi-AZ deployments with automatic failover
.env

Google Cloud SQL

High availability with regional replication
.env

Azure Database

Zone-redundant HA with read replicas
.env

SQLite (Development)

For local development only:
.env
SQLite limitations:
  • Single concurrent writer
  • No network access
  • Limited scalability
  • File corruption risk
Never use in production!
SQLite database location: activepieces.db in the working directory.

Troubleshooting

Check PostgreSQL is running:
Verify port is open:
Test connection:
Check pg_hba.conf:
Allow connections:
Reload PostgreSQL:
Check active connections:
Increase max_connections:
postgresql.conf
Adjust pool size:
.env
Check database size:
Vacuum to reclaim space:
Enable data retention:
.env

Next Steps

Storage

Configure file storage with S3

Scaling

Scale your database

Backup Strategy

Implement backup automation

Monitoring

Setup database monitoring