Deploy ai-business-operating-system

Deploy fully functional AI Business OS with Supabase

Deploy ai-business-operating-system

Just deployed

Deploy and Host Stellar with Railway

Deploy on Railway

Stellar is a self-hosted AI business operating system: ERP records and documents (products, CRM, quotes, invoices, payments, expenses, banking), a POS workspace, team roles, PDF financial reports, and 15 AI business agents that read your own data. This template runs the public Stellar container on Railway and connects it to your Supabase project for Postgres, Auth, and Storage.

About Hosting Stellar

Hosting Stellar means running one stateless Next.js container connected to your Supabase project. Railway pulls the public image and runs a pre-deploy job that applies Prisma migrations, seeds RBAC roles, creates the root admin, and creates the storage buckets and policies with default fonts/logo, then starts the server behind HTTPS. You provide seven values: Supabase URL, anon key, the service-role key, the session-pooler DATABASE_URL, the DIRECT_URL, and the root admin email/password. Supabase provides Postgres, authentication, password reset, and file storage; Railway provides the container, domain, healthchecks, logs, and scaling. No Railway database or volume is needed.

Why Deploy Stellar on Railway?

Railway supplies HTTPS, healthchecks, logs, and scaling; Supabase supplies Postgres, Auth, and Storage while you keep your data.

Common Use Cases

  • Run a self-hosted ERP for a small company.
  • Operate retail stores with the POS workspace.
  • Give finance and sales teams AI-assisted analysis and reporting.
  • Keep business data in your own Supabase project.

Dependencies for Stellar Hosting

  • A Railway account.
  • A Supabase project for Postgres, Auth, and Storage.
  • The public image ghcr.io/app-corp/stellar:latest.
  • Optional AI keys: Google Generative AI, Replicate, Pexels.

Deployment Dependencies

Supabase Setup

1. Project and keys

Create a project near your Railway region. From Project Settings → API, copy the project URL, anon key, and service-role key. Keep the service-role key server-side only.

2. Database connection

Use the Session pooler (IPv4, port 5432):

postgresql://postgres.[project-ref]:[password]@[pooler-host]:5432/postgres?sslmode=require

Copy the full host from Supabase; do not build it from the region. URL-encode reserved password characters. Use this value for both DATABASE_URL and DIRECT_URL. The direct connection is IPv6 unless you have the IPv4 add-on. For transaction pooling, use port 6543 with pgbouncer=true for DATABASE_URL, and keep the session pooler for DIRECT_URL. Never use transaction pooling for migrations.

3. Auth, storage, and email

After Railway assigns a domain, set Authentication → URL Configuration: Site URL https://[your-domain] and redirects https://[your-domain]/auth/confirm and https://[your-domain]/auth/reset-password.

Pre-deploy creates erpblobPublic (public) and erpblob (private), applies the storage access policies, and uploads the default logo and PDF fonts. Private objects are owner-scoped: a user can only read/write their own uploads, while admins use the service-role API. Override NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET / NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET to use different bucket names. For production, configure custom SMTP under Authentication → Emails.

Deploy

  1. Click Deploy on Railway.
  2. Fill in the seven prompted values listed in the Variables table.
  3. Deploy and watch for:
    ✔ release complete
    ✔ root admin ready: [email]
    
  4. Set the Supabase Auth URLs (see Supabase Setup, step 3).
  5. Sign in, change the admin password, then create users and grant roles in User Management and RBAC.

If pre-deploy fails, the new container is not switched in.

Variables

VariableRequiredDescription
NEXT_PUBLIC_SUPABASE_URLYesSupabase project URL; no trailing slash.
NEXT_PUBLIC_SUPABASE_ANON_KEYYesSupabase anon/public key; browser-safe.
SUPABASE_SERVICE_ROLE_KEYYes, sealedServer-side service-role key for admin bootstrap, storage buckets and policies. Never expose it to the browser.
DATABASE_URLYes, sealedSession-pooler URL (IPv4, port 5432) with ?sslmode=require.
DIRECT_URLYes, sealedPrisma migration URL; use the same value as DATABASE_URL.
BOOTSTRAP_ADMIN_EMAILYesRoot admin email; use the address you will sign in with.
BOOTSTRAP_ADMIN_PASSWORDYes, sealedRoot admin password. Never logged.
NEXT_PUBLIC_SUPABASE_STORAGE_URLDerived[supabase-url]/storage/v1/object.
NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKETDerivedPublic assets bucket. Default erpblobPublic.
NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKETDerivedPrivate uploads bucket. Default erpblob.
NEXT_PUBLIC_APP_DOMAINDerivedPublic origin from RAILWAY_PUBLIC_DOMAIN.
NEXT_PUBLIC_APP_LOGODerivedLogo URL in the public bucket.

Optional variables: GOOGLE_GENERATIVE_AI_API_KEY (BYOK agents), REPLICATE_API_TOKEN (AI Image Studio), NEXT_PUBLIC_PEXELS_API_KEY (image search), NEXT_PUBLIC_SUPABASE_CACHE_CONTROL (default 3600), NEXT_PUBLIC_APP_NAME, BOOTSTRAP_ADMIN_RESET_PASSWORD (set true to rotate the root password), GOOGLE_ANALYTICS_ID, Facebook/Instagram publishing keys, and ALLOWED_IMAGE_HOSTS.

Derived values use Railway references: NEXT_PUBLIC_SUPABASE_STORAGE_URL=${{NEXT_PUBLIC_SUPABASE_URL}}/storage/v1/object, NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET=erpblobPublic, NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET=erpblob, NEXT_PUBLIC_APP_DOMAIN=https://${{RAILWAY_PUBLIC_DOMAIN}}, and NEXT_PUBLIC_APP_LOGO=${{NEXT_PUBLIC_SUPABASE_STORAGE_URL}}/public/${{NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET}}/assets/stellar-app-logo.webp.

Pre-Deploy

node migrate/release.mjs
  → prisma migrate deploy
  → seed RBAC roles and permissions
  → create/update root admin
  → create/update buckets, apply storage policies, upload fonts/logo

Every step is idempotent. The container then runs node apps/main/server.js on Railway's PORT. The configured BOOTSTRAP_ADMIN_EMAIL is always promoted to admin; other accounts are never auto-promoted.

After Deploy

  • Change the root admin password.
  • Create users and assign roles.
  • Upload your logo/assets or keep the defaults.
  • Configure SMTP and review Supabase backups/plan limits.
  • Optional custom domain: add it in Railway, override NEXT_PUBLIC_APP_DOMAIN if it differs from RAILWAY_PUBLIC_DOMAIN, update Supabase Auth URLs, and redeploy.
  • Optional AI: add a Google key (and Replicate key for image generation).

Updates and Rollback

The template tracks ghcr.io/app-corp/stellar:latest. Railway redeploys when a new digest is pushed to that tag, so every published build — including major versions — is picked up automatically. Versioned tags are also published for pinning: 1.0.3, 1.0, 1, and sha-[commit].

Pin a release by changing the service image tag to a versioned tag; disable auto-updates in service settings for manual control. Migrations are forward-only, so only roll back to a build that supports your current schema. Docker-image templates do not receive Railway template update notifications; image auto-updates are the update mechanism.

Troubleshooting

SymptomFix
P1001 / DB timeoutUse the Session pooler (5432), not direct IPv6.
prepared statement "s0" already existsTransaction pooler without pgbouncer=true; use session pooling.
Migration auth failureURL-encode the password; confirm DIRECT_URL uses the session pooler.
Storage bootstrap failsCheck the service-role key and bootstrap-storage.mjs logs.
Nobody can sign inSet BOOTSTRAP_ADMIN_EMAIL and BOOTSTRAP_ADMIN_PASSWORD, then redeploy.
Login works but menu empty / 403Sign in with BOOTSTRAP_ADMIN_EMAIL; sign out and back in.
Reset link has wrong hostSet NEXT_PUBLIC_APP_DOMAIN and Supabase Auth Site URL.
Password reset email missingConfigure custom SMTP under Supabase Authentication → Emails.
Uploads or PDF fonts failCheck erpblobPublic/erpblob, the storage.objects policies, fonts/inter-*.ttf, and the service-role key.
must be owner of table objectsThe bootstrap must not run ALTER TABLE storage.objects on hosted Supabase; RLS is already enabled.
Another user cannot open my private fileExpected: erpblob is owner-scoped. Share through the app or use an admin account.
Railway cannot pull imageGHCR package must be public.
Site not indexed / empty sitemapExpected on self-hosted domains.

Support and License

Licensed under the Stellar Self-Host License 1.0. See LICENSE.md for the full terms.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
118
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

Tracklayer
4