
Instant is an open-source, real-time backend platform for web applications. It provides a client-side database with built-in support for authentication, relational queries, transactions, file storage, and real-time data synchronization. Instant serves as a self-hosted alternative to Firebase and removes the need to manage custom backend APIs or WebSocket infrastructure.
This article explains how to deploy Instant on a Linux server using Docker Compose. It covers directory setup, environment configuration, Traefik reverse proxy integration for automatic HTTPS, and backend API verification using a sample database workflow.
Before you begin, you need to:
instant.example.com).Instant runs as a containerized backend service built from the official source repository. The project directory stores the source code, Docker Compose configuration, and environment variables.
Create a project directory for Instant and navigate into it.
Clone the official Instant repository. InstantDB does not publish pre-built Docker images or versioned releases, so the server is built from source using the official repository.
The repository is cloned into a folder named app to keep the project path clean.
Navigate to the server directory.
Rename the default docker-compose.yml file to keep it as a backup.
Create the environment configuration file.
Add the following configuration:
Replace the placeholders:
Save and close the file.
The deployment stack consists of three services: Traefik handles reverse proxy and automatic TLS certificate management via Let's Encrypt, PostgreSQL stores application data with logical replication enabled, and the Instant server runs the backend application.
Create the Docker Compose configuration file.
Add the following configuration:
Save and close the file.
In the above manifest:
pg_hint_plan extension required for query optimization.8888 available internally for Traefik routing without exposing it directly to the host network../postgres-data bind mount stores database files on the host persistently../letsencrypt bind mount retains TLS certificates between container restarts./var/run/docker.sock) enables Traefik to detect and configure routes for running containers automatically.8888.Start the containers in detached mode.
The --build flag builds the Instant server image from source on first run.
Verify that all containers are running.
The output displays three running containers with Traefik listening on ports 80 and 443, PostgreSQL reporting a healthy status, and the Instant server exposing port 8888.
View the logs for the services.
The output shows PostgreSQL initialization messages, the Instant server startup sequence, and Traefik registering routes for the configured domain.
For more information on managing a Docker Compose stack, see the How to Use Docker Compose article.
The Instant backend exposes a REST API for application management and real-time data operations. Traefik routes HTTPS traffic to the backend and automatically provisions TLS certificates from Let's Encrypt.
Verify that the Instant backend is accessible. Replace instant.example.com with your configured domain name.
Output:
The backend completes initialization after the containers start. If the curl command returns a connection error, wait a few moments for initialization to complete and run the command again. Let's Encrypt certificate provisioning may also take up to a minute on first access.
Open your web browser and navigate to https://instant.example.com, replacing instant.example.com with your configured domain name.
The page displays the welcome message, confirming HTTPS routing through Traefik is working correctly.
Instant uses PostgreSQL as its persistent store for application data. The following steps confirm database connectivity and query functionality by creating a test table, inserting sample data, and querying it from the PostgreSQL container.
Connect to the PostgreSQL container.
The prompt changes to instant=# on successful connection.
Create a sample table.
Insert test records into the table.
Output:
Query the stored data.
The output displays both inserted rows with their auto-generated IDs and timestamps reflecting the current time.
Exit the database shell.
Review the backend logs to confirm that the server is running without errors.
The logs display initialization messages and confirm the server is accepting connections.
You have successfully deployed Instant on your Linux server using Docker Compose with PostgreSQL as the backend database and Traefik for automatic HTTPS. The setup provides a self-hosted real-time backend platform with persistent storage, authentication support, and relational query capabilities. Instant eliminates the need for custom backend APIs and WebSocket infrastructure while providing Firebase-like functionality. For advanced configuration, client SDK integration, and API reference, refer to the official Instant documentation.
0 Comments
Be the first to comment and share your perspective with the community.