InsForge: AI Backend-as-a-Service
InsForge is an open-source Backend-as-a-Service platform for AI coding agents. Built around PostgreSQL, it provides authentication, database APIs, file storage, a model gateway, edge functions, site deployment, payment integrations, and more, allowing applications to skip most backend boilerplate.
Pigsty provides the app/insforge configuration template, which runs InsForge OSS stateless services in Docker Compose while placing the most critical state in PostgreSQL managed by Pigsty. This lets you continue using Pigsty’s high availability, backup and recovery, monitoring, ingress domains, and infrastructure capabilities instead of hiding the database in an ephemeral container volume.
The current template targets InsForge OSS v2.2.6, uses external PostgreSQL, and exposes three services by default: the InsForge Dashboard/API, PostgREST, and Deno Runtime.
Quick Start
Run the following on a fresh Linux x86 / ARM server with a compatible operating system:
After installation, the default access URLs are:
http://<your_ip_address>:7130http://isf.pigsty
The default administrator account is [email protected] / pigsty. In production, you must change the administrator account, administrator password, JWT secret, encryption key, and database password.
To access InsForge through isf.pigsty, add the following entry to /etc/hosts on the machine running your browser:
To expose the service to the public internet, use a real domain and HTTPS certificate, and modify infra_portal as described below.
Checklist
- Prepare a fresh Linux server with at least
2C4G; use an SSD/NVMe disk. - Confirm that the server has a static private IPv4 address and can access GHCR / Docker Hub, or that a registry mirror is configured.
- After running
./configure -c app/insforge, change the default passwords, domains, and keys inpigsty.yml. - Generate new
JWT_SECRETandENCRYPTION_KEYvalues separately withopenssl rand -base64 32. - Keep
POSTGRES_PASSWORDconsistent with the password ofdbuser_insforgeinpg_users. - For public access, configure a real domain, an HTTPS certificate, and firewall access rules.
- Confirm that PostgreSQL extension packages are installed correctly, and run
pig pb infoafter deployment.
Architecture
The InsForge template separates the database from the application containers by default:
Components:
- InsForge App:
ghcr.io/insforge/insforge-oss:v2.2.6, providing the Dashboard and main API on port7130. - PostgREST:
postgrest/postgrest:v12.2.12, generating REST APIs from PostgreSQL schemas; exposed on host port5430. - Deno Runtime:
ghcr.io/insforge/deno-runtime:latest, the edge function runtime, listening on port7133. - PostgreSQL: Managed by Pigsty for persistent state, backup, monitoring, and high availability.
Configuration Template
conf/app/insforge.yml defines a single-node, self-hosted InsForge template. The default topology includes:
insforge: The node running the InsForge, PostgREST, and Deno Runtime containers.pg-meta: The PostgreSQL database cluster managed by Pigsty, including the roles, database, and extensions required by InsForge.infra: Infrastructure services such as Nginx ingress, Grafana, and VictoriaMetrics.etcd: The distributed configuration store required by Patroni.
Key configuration excerpts:
Important Parameters
app.yml copies the app/insforge directory to /opt/insforge and uses apps.insforge.conf to override /opt/insforge/.env. Common parameters include:
| Parameter | Default | Description |
|---|---|---|
JWT_SECRET | Sample secret | JWT signing secret; must be replaced in production, preferably with a random value of at least 32 characters |
ENCRYPTION_KEY | Sample secret | Encrypts runtime credentials; must be replaced in production and managed separately from JWT_SECRET |
ROOT_ADMIN_USERNAME | [email protected] | Root administrator account |
ROOT_ADMIN_PASSWORD | pigsty | Root administrator password; must be replaced in production |
POSTGRES_HOST / POSTGRES_PORT | 10.10.10.10 / 5432 | Pigsty PostgreSQL endpoint |
POSTGRES_DB | insforge | InsForge database |
POSTGRES_USER | dbuser_insforge | Application user that connects InsForge to PostgreSQL |
POSTGRES_PASSWORD | DBUser.Insforge | Application user password; must be replaced in production |
INSFORGE_VERSION | v2.2.6 | InsForge OSS image tag |
DENO_RUNTIME_VERSION | latest | Deno Runtime image tag |
APP_PORT | 7130 | External InsForge App port |
POSTGREST_PORT | 5430 | External PostgREST port |
DENO_PORT | 7133 | External Deno Runtime port |
ACCESS_API_KEY | Empty | Optional MCP / API access key; generated by InsForge when empty |
ACCESS_ANON_KEY | Empty | Optional anonymous frontend access key; should begin with anon_ when set |
OPENROUTER_API_KEY | Empty | Optional OpenRouter model gateway key |
AWS_S3_BUCKET / S3_* | Empty | Optional object storage configuration |
DENO_DEPLOY_TOKEN | Empty | Optional Deno Deploy integration |
VERCEL_TOKEN / FLY_API_TOKEN | Empty | Optional site deployment and compute platform integrations |
STRIPE_* / RAZORPAY_* | Empty | Optional payment integrations |
Generate production secrets with:
When changing the database password, keep the application and database definitions synchronized. For example:
Once ENCRYPTION_KEY has been used for production data, keep it stable. Changing it may make stored runtime credentials such as API keys, OAuth tokens, and function secrets impossible to decrypt.
Database and Permissions
The default InsForge database is named insforge and owned by dbuser_insforge. The template creates the following roles:
| Role | Login | Purpose |
|---|---|---|
dbuser_insforge | Yes | Application user that connects InsForge to PostgreSQL; granted superuser in the template |
anon | No | PostgREST anonymous role |
authenticated | No | PostgREST authenticated-user role |
project_admin | No | Administrative role with service-key semantics and BYPASSRLS |
files/insforge.sql configures PostgREST role privileges, default privileges, ACLs for project_admin, and the helper function public.reload_postgrest_schema(). The function executes:
This notifies PostgREST to reload its schema.
The upstream InsForge PostgreSQL image preinstalls insforge_pg_utils. The current Pigsty template does not depend on this extension package. Instead, it uses pgcrypto, http, and pg_cron already provided by Pigsty, while application migrations by InsForge manage runtime schemas.
Service Ports and Persistence
The default Docker Compose services are:
| Service | Container | Host Port | Description |
|---|---|---|---|
| InsForge App | insforge | 7130 | Dashboard and main API |
| PostgREST | insforge-postgrest | 5430 | Automatically generated REST API |
| Deno Runtime | insforge-deno | 7133 | Edge function runtime |
The default Docker volumes are:
| Volume | Mount Point | Description |
|---|---|---|
storage-data | /insforge-storage | Local file storage |
insforge-logs | /insforge-logs | Application logs |
deno_cache | /deno-dir | Deno module cache |
By default, Docker containers connect to the Pigsty node at 10.10.10.10:5432. The template HBA rule permits 172.16.0.0/12, covering Docker’s default bridge and common custom bridge networks.
Domain and Ingress
The template adds an InsForge entry to infra_portal by default:
To use a real domain such as insforge.example.com, replace the placeholder in bulk:
Then apply the Nginx ingress configuration:
To request an HTTPS certificate, first ensure that the domain resolves to the current node, then add or modify certbot under infra_portal.insforge:
Then run:
Operations
InsForge is installed in /opt/insforge. Common commands include:
For offline environments, save the images in advance:
Default artifact locations:
/tmp/docker/insforge/postgrest.tgz/tmp/docker/insforge/insforge.tgz/tmp/docker/insforge/deno.tgz/tmp/insforge.tgz
Load the images on the target machine:
Data and Backup
InsForge state is divided into two categories:
- Business data, users, project metadata, permissions, and related state are stored in the Pigsty PostgreSQL database
insforge. - Local files and logs are stored in the Docker volumes
storage-dataandinsforge-logs.
By default, the template schedules a full PostgreSQL backup every day at 1:00 AM:
After deployment, check the backup status:
If file storage is configured to use S3 / MinIO, file objects are managed by that object storage system. If you keep local volumes, include them separately in your host-level backup strategy.
Troubleshooting
Check container status:
View logs:
Check whether PostgreSQL is reachable from the container:
Check whether the HBA rules include the Docker network:
Check whether the roles exist:
Check for port conflicts:
Common issues:
- Cannot log in: Confirm that
ROOT_ADMIN_USERNAME/ROOT_ADMIN_PASSWORDwere written to/opt/insforge/.envby the template, and check theinsforgecontainer logs. - PostgREST fails to start: Confirm that the
anon,authenticated, andproject_adminroles exist, and thatJWT_SECRETmatches the InsForge App setting. - Database connection fails: Confirm that
POSTGRES_HOST,POSTGRES_PORT, andPOSTGRES_PASSWORDmatch thepg_usersconfiguration, and check that HBA permits the Docker network. - File upload or download errors: When using S3 / MinIO, check
AWS_S3_BUCKET,S3_ENDPOINT_URL,S3_FORCE_PATH_STYLE, and the access-key configuration.
References
- InsForge project: https://github.com/InsForge/InsForge
- Pigsty template: https://github.com/pgsty/pigsty/blob/main/conf/app/insforge.yml
- Docker Compose: https://github.com/pgsty/pigsty/blob/main/app/insforge/docker-compose.yml
- Database baseline: https://github.com/pgsty/pigsty/blob/main/files/insforge.sql
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)