Nubase

Turn AI-written code into real apps — an open-source, self-hostable backend with Database, Auth, Storage, Memory, Functions, Assets, AI Gateway, and cron built for AI coding agents.

451stars
40forks
Apache License 2.0
Java

Nubase is an AI-native backend platform that closes the gap between AI-generated code and a deployed application. Where most AI coding sessions produce a demo that still requires weeks of infrastructure work, Nubase gives a coding agent — or a human developer — a single self-hostable service that provides all eight primitives a modern app needs: Database, Auth, Storage, Assets, Functions, AI Gateway, Memory, and scheduled cron jobs. Each project in Nubase gets its own isolated PostgreSQL database, JWT secret, and role system, so teams can spin up and tear down AI projects without cross-contamination.

The Memory module is Nubase’s most distinctive contribution: instead of bolting a vector store onto an existing platform, Nubase treats durable memory as a first-class pillar alongside Auth and the database. Memory entries are written through an LLM-powered fact-extraction pipeline that decides for each candidate whether to ADD, UPDATE, DELETE, or ignore it, and retrieved via a custom score-fusion algorithm that blends pgvector cosine similarity with PostgreSQL full-text BM25 rankings and optional entity boosts — closely mirroring the design of the mem0 open-source memory library but implemented natively in Java with tight transactional guarantees.

For AI coding agents specifically, Nubase exposes an MCP bridge (the nubase_cli npm package) that gives agents structured tools for inspecting schema, executing SQL, managing auth, deploying edge functions, publishing static frontends to the built-in CDN, scheduling cron jobs, and reading or writing memory — all scoped to a project token. This means an agent running inside Claude Code or Codex can build, deploy, and manage a full-stack application end to end without touching external hosting accounts. The all-in-one Docker image bundles PostgreSQL, Redis, the Spring Boot backend, and the Next.js Studio dashboard into a single container that can be production-ready in one command.

Built on Spring Boot 3.2 with a PostgREST-compatible REST layer, Supabase-style Auth (signup, MFA/TOTP, OTP, magic links, OAuth, SAML SSO), S3-compatible object storage, and a Cloudflare Workers–compatible edge function executor, Nubase targets self-hosters and AI product teams who want Supabase-grade primitives without the single-project limitation of the Supabase self-hosted stack.

What You Get

  • Isolated project databases — each project receives its own dedicated PostgreSQL database with per-project JWT secrets, RLS enforcement, and a PostgREST-compatible /rest/v1 REST API for full CRUD and filtering
  • Built-in Memory pillar — LLM-powered fact extraction (ADD/UPDATE/DELETE/NONE decisions), hybrid retrieval via pgvector + BM25 + entity boost score fusion, entity store, and append-only history all in one /mem/v1 API
  • Supabase-style Auth — signup/login, refresh-token rotation, MFA/TOTP, OTP, magic links, anonymous sign-in, OAuth (Google, GitHub, WeChat), and SAML SSO with anon/authenticated/service_role roles
  • Edge Functions and Assets — deploy backend logic to /functions/v1/** (local executor or Cloudflare Workers for Platforms) and publish generated frontends to a per-project CDN at /assets/v1/** with Cache-Control and ETag semantics
  • AI Gateway — OpenAI- and Anthropic-compatible proxy endpoints with per-project API key management and token/cost usage tracking
  • MCP bridge for AI agentsnubase_cli exposes tools for schema inspection, SQL execution, RLS export, memory read/write, function deploy, asset publish, and cron management — letting agents operate the entire platform through MCP without any separate infrastructure accounts
  • Cron scheduler — recurring jobs that invoke an edge function or named database function on a crontab schedule, managed with run history via MCP or Studio
  • All-in-one Docker image — PostgreSQL 15 + pgvector, Redis, the Spring Boot backend, and the Next.js Studio dashboard bundled into one container, production-ready in a single docker run command

Common Use Cases

  • AI agent deploys a full-stack app — a Claude Code or Codex agent scaffolds a todos app, creates tables with RLS, deploys an edge function, publishes the generated frontend to the Assets CDN, and stores the deployment in Memory — all through MCP tools without leaving the coding session
  • Persistent user memory for AI products — a product team builds a personal assistant that remembers user preferences, diet restrictions, and past interactions using the /mem/v1 API; Nubase extracts and deduplicates facts automatically across sessions
  • Multi-project SaaS backend — a small startup runs multiple isolated customer projects on one Nubase instance, each with its own database, auth roles, and storage buckets, managed from a single Studio dashboard
  • Rapid AI prototype to production — a developer generates an app with an AI coding tool, uses Nubase as the backend target to provision data models and auth, then ships a working demo with real persistence and user accounts in under an hour
  • Scheduled data pipelines via cron — a team configures recurring cron jobs that call edge functions to aggregate analytics, send notification emails, or sync external data — managed through MCP or the Studio UI with full run history
  • AI Gateway cost tracking — a platform team routes all LLM calls from their agents through Nubase’s AI Gateway to get per-project token usage and cost breakdowns without managing separate API key infrastructure

Under The Hood

Architecture Nubase follows a modular Spring Boot monolith organized into eight vertical slices (auth, postgrest, mem, functions, assets, deploy, cron, platform) each with its own controller, service, repository, and entity layers under src/main/java/ai/nubase/. The multi-tenancy control plane lives in postgrest/multidb/ and centres on RoutingDataSource, a Spring AbstractRoutingDataSource subclass that maintains a ConcurrentHashMap of per-project HikariDataSource pools keyed by project ID from ThreadLocal context. Project database credentials are AES-encrypted at rest in the metadata database (EncryptionService). Every inbound request carries an apikey that PostgrestRequestContext resolves to a project and role before JDBC is routed to the correct per-project database — cleanly separating the metadata control plane from the isolated project data planes.

Tech Stack The backend is Java 17 with Spring Boot 3.2 (spring-boot-starter-web, spring-boot-starter-security, spring-boot-starter-data-jpa, spring-boot-starter-data-redis). Flyway manages schema migrations; HikariCP (via Druid) handles per-project connection pools; JJWT 0.12.3 and auth0 java-jwt handle JWT signing and verification; jbcrypt covers password hashing; jsqlparser rewrites inbound PostgREST-style queries. The Memory module uses Spring AI 1.1.2 for embedding model abstraction and pgvector via native SQL. Storage talks to S3-compatible backends (AWS S3, Cloudflare R2, MinIO) using AWS SDK v2. Edge functions proxy to Deno Deploy–style local executors or Cloudflare Workers for Platforms via OkHttp3. The frontend is a Next.js (pnpm workspace) Studio dashboard. The all-in-one image is assembled with a multi-stage Dockerfile. Code formatting uses Spotless (maven plugin).

Code Quality The test suite spans 106 test files covering unit, integration (@SpringBootTest with Spring context), and regression classes. Integration tests (*IT.java) cover Auth flows (PKCE, MFA/TOTP, magic link), PostgREST REST API, edge function invocation, cron scheduler race conditions, and memory vector serialization — using Testcontainers-style patterns against live databases. Key algorithmic classes like ScoreFusion have comprehensive pure-unit tests with boundary conditions. Spotless enforces code formatting at compile time. Error handling is explicit with typed exception handlers per module (MultiDatabaseExceptionHandler, EdgeFunctionExceptionHandler). Naming follows standard Java conventions with clear domain vocabulary.

What Makes It Unique Nubase’s most genuinely novel characteristic is the unified Memory primitive alongside standard backend services — not a plugin, not a separate vector-store sidecar, but a transactional service where LLM-powered fact extraction and hybrid pgvector + BM25 + entity-boost score fusion operate within the same Spring transaction as the rest of the database work. The ScoreFusion class mirrors mem0’s scoring algorithm but runs natively in the JVM against the project’s own PostgreSQL, preserving full ACID guarantees. Equally distinctive is the end-to-end AI agent path: a single MCP tool surface (nubase_cli) covers schema, SQL, auth, storage, memory, function deploy, CDN publish, and cron scheduling so an AI coding agent can take a generated app from zero to live — with real auth, real persistence, and a public URL — without leaving the coding session or touching any external hosting account.

Self-Hosting

Licensing Model Apache 2.0 licensed — all features available in self-hosted deployments with no restrictions or license keys required.

Self-Hosting Restrictions

  • No license key required for any feature
  • All eight modules (Database, Auth, Storage, Assets, Functions, AI Gateway, Memory, cron) are fully available in the self-hosted build

Not Yet Implemented

  • Realtime subscriptions (planned)
  • Managed backups and point-in-time recovery (PITR)
  • High-availability orchestration
  • Enterprise SSO/SCIM (noted in roadmap but not yet implemented)

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search