Skip to main content
1Space contains multiple parts. Some require a cloud provider, others can be self-hosted. This guide will help you deploy 1Space on your own infrastructure. Glance, you will need to deploy the following components:
  • Infrastructure
    • Postgres (third-party or self-hosted)
    • Temporal (cloud or self-hosted)
    • Minio (or other S3-compatible storage provider)
    • PowerSync (cloud or self-hosted)
    • logto (cloud or self-hosted)
    • axiom (optional)
  • Backend services
    • @1space/backend (on your own server)
    • @1space/backend-worker (on your own server)
    • @1space/backend-cf (on cloudflare-workers)
  • Frontend service
    • @1space/web (simple SPA, can be hosted on any static file server)

Preparation

Postgres

You need to have a Postgres database running. The postgres database will be used by @1space/backend, @1space/backend-worker and PowerSync. After setup, prepare a connection string (DATABASE_URL) for the Postgres database. You will need it later.
DATABASE_URL=postgres://user:password@host:port/1space
If you are self-hosting PowerSync, Temporal or logto, you may also need to setup a separate Postgres database for them.

Temporal

You need to have a Temporal cluster running. The Temporal cluster will be used by @1space/backend and @1space/backend-worker. After setup, prepare the TEMPORAL_ADDRESS and TEMPORAL_NAMESPACE for the Temporal cluster. You will need it later.
TEMPORAL_ADDRESS=localhost:7233
TEMPORAL_NAMESPACE=1space

Minio (or other S3-compatible storage provider)

You need to have a S3-compatible storage provider. You can use some cloud storage providers like AWS S3, or self-hosted storage providers like Minio. Prepare the S3_ENDPOINT, S3_ACCESS_KEY and S3_SECRET_KEY for the S3-compatible storage provider. You will need it later.
S3_ENDPOINT=http://localhost:9000
S3_ACCESS_KEY=minio
S3_SECRET_KEY=minio123

PowerSync

You need to have a PowerSync instance running. You can either use the cloud version of the PowerSync, or self-host your own PowerSync instance. If you are using the cloud version of the PowerSync, make sure your Postgres database is accessible from the internet, and should be setup with TLS to be accepted by the PowerSync. After setup, prepare the POWERSYNC_ENDPOINT for the PowerSync. You will need it later.
POWERSYNC_ENDPOINT=http://localhost:8080

logto

You need to have a logto instance running. You can either use the cloud version of the logto, or self-host your own logto instance. After setup, prepare the LOGTO_ENDPOINT for the logto. You will need it later.
LOGTO_ENDPOINT=https://localhost:3001
And you need to create several applications in the logto to get the LOGTO_APP_ID. (TODO: Add more details about how to setup logto)
LOGTO_APP_ID=your-logto-app-id
JWKS_URI=https://localhost:3001/oidc/jwks

axiom (optional)

If you want to use the axiom for the data analysis, you need to have an axiom account. Prepare the AXIOM_TOKEN and AXIOM_DATASET variables for the axiom. You will need it later.
AXIOM_TOKEN=your-axiom-token
AXIOM_DATASET=1space

Cloudflare account

Some of our backend logic is running on Cloudflare Workers. Though we have a plan to support self-hosting without Cloudflare Workers, currently you need to have a Cloudflare account first. And you may need to on Workers Paid plan.

Deployment

@1space/backend and @1space/backend-worker

@1space/backend and @1space/backend-worker are the main backend services of 1Space. @1space/backend provide the API for the frontend service and the @1space/backend-worker provide the background job processing. Both of these services can be deployed multiple instances for high availability. But I believe you only need one instance for the beginning. These service need the following environment variables:
DATABASE_URL=...
JWKS_URI=...
TEMPORAL_ADDRESS=...
AXIOM_DATASET=...
AXIOM_TOKEN=...
REQUESTER_ENDPOINT=...
(REQUESTER_ENDPOINT is the endpoint of the @1space/backend-cf service, which will be deployed in the next step.) Run the following command to start the @1space/backend and @1space/backend-worker:
docker run -p 3335:3335 -e ... ghcr.io/1space-app/backend
docker run -e ... ghcr.io/1space-app/backend-worker
And inside the backend container, run the following command to run database migrations:
cd /app/packages/api && pnpm migrations:apply

@1space/backend-requester

@1space/backend-requester is a required service for @1space/backend. Deploy it in the nearly same way as @1space/backend (TODO: more docs)

@1space/web

@1space/web is the frontend service of 1Space. It is a simple SPA, and can be hosted on any static file server. Run pnpm build:web to build the frontend service, and then host the ./apps/web/dist directory on your static file server.

@1space/magic-static

@1space/magic-static is an additional frontend service of 1Space. It can be deployed in your normal infrastructure, or using Cloudflare Workers. (TODO: more docs)