A serverless-native MongoDB package designed for modern cloud applications
Unlike MongoDB Realm or other cloud platforms, we do not offer a graphical interface where you can configure services through a dashboard. Instead, everything is code-based and developer-driven, offering full flexibility through configuration files and source code.
This documentation is structured to guide both experienced Realm users and newcomers alike — whether you’re migrating or starting clean.
| Feature | Status |
|---|---|
| Realm-compatible schema | ✅ Supported (unchanged) |
| Authentication strategy | ✅ Local Email/Password only |
| OAuth / API Keys / etc. | 🚫 Not supported (for now) |
| User data accessibility | ✅ Stored in your main DB |
| Device Sync | 🚫 Not supported (for now) |
| Functions | ✅ Supported (unchanged) |
| Triggers | ✅ Supported (unchanged) |
| HTTP Endpoints | ✅ Supported (unchanged) |
⚠️ Already have an existing Realm project?
You can skip ahead to the Migration Guide to quickly adapt your project to Flowerbase.
If you're starting fresh, you’ll learn how to:
- Scaffold a minimal Node.js + TypeScript backend
- Install and configure
@flowerforce/flowerbase - Set up authentication, data models, rules, and custom logic
- Deploy your app and connect it to any frontend (React, Vue, mobile, etc.)
Create a new project directory and initialize it with npm:
mkdir my-app
cd my-app
npm init -yInstall the @flowerforce/flowerbase library, which provides the tools required for managing your data with MongoDB Atlas:
npm install @flowerforce/flowerbaseAdd Typescript
npm install --save-dev typescript @types/node ts-nodeAdd tsconfig.json file
npx tsc --initIn your packages.json, inside the script section add this:
{
"start": "ts-node index.ts"
}Inside your project root, create the main source directory:
mkdir srcWithin the src folder, add a new file named index.ts:
touch src/index.tsEnsure the following environment variables are set in your .env file or deployment environment:
| Variable | Description | Example |
|---|---|---|
PROJECT_ID |
A unique ID to identify your project. This value can be freely invented — it's preserved mainly for compatibility with the old Realm-style project structure. | my-flowerbase-app |
PORT |
The port on which the server will run. | 3000 |
DB_CONNECTION_STRING |
MongoDB connection URI, including username, password, and database name. | mongodb+srv://user:pass@cluster.mongodb.net/mydb |
APP_SECRET |
Secret used to sign and verify JWT tokens (choose a strong secret). | supersecretkey123! |
HOST |
The host address the server binds to (usually 0.0.0.0 for public access). |
0.0.0.0 |
HTTPS_SCHEMA |
The schema for your server requests (usually https or http). |
http |
Example:
PROJECT_ID=your-project-id
PORT=3000
DB_CONNECTION_STRING=mongodb+srv://username:password@cluster.mongodb.net/dbname
APP_SECRET=your-jwt-secret
HOST=0.0.0.0
HTTPS_SCHEMA=http🛡️ Note: Never commit .env files to source control. Use a .gitignore file to exclude it.
In your index.ts file, import the initialize function from the @flowerforce/flowerbase package and invoke it:
// src/index.ts
import { initialize } from '@flowerforce/flowerbase';
const projectId = process.env.PROJECT_ID ?? "my-project-id"
const port = process.env.PORT ? Number(process.env.PORT) : undefined
const mongodbUrl = process.env.DB_CONNECTION_STRING
const jwtSecret = process.env.APP_SECRET
const host = process.env.HOST
initialize({
projectId,
port,
mongodbUrl,
jwtSecret,
host
})This initializes the Flowerbase integration, connecting your application to MongoDB Atlas.
After setting up the base Flowerbase integration, you can now configure advanced features to control how your backend behaves.
📁 my-app/
|
├── 📁 src/
| |
│ ├── 📄 index.ts
| |
│ ├── 📁 auth/
| | |
│ │ └── 📄 custom_user_data.json
| | |
│ │ └── 📄 providers.json
| |
│ ├── 📁 data_sources/
| | |
│ │ └── 📁 mongodb-atlas/
| | |
│ │ └── 📁 your_db_name/
| | |
│ │ └── 📁 collection1/
| | | |
│ │ | └── 📄 rules.json
│ │ |
│ │ └── 📁 collection2/
| | |
│ │ └── 📄 rules.json
│ │
│ ├── 📁 functions/
│ │ |
│ │ └── 📄 exampleFunction.ts
│ │ |
│ │ └── 📄 config.json
│ │
│ ├── 📁 triggers/
│ │ |
│ │ └── 📄 trigger1.json
│ │ |
│ │ └── 📄 trigger2.json
│ │
│ ├── 📁 http_endpoints/
│ │ |
│ │ └── 📄 config.json
│ │
└── 📄 .env
| Area | Description | Link |
|---|---|---|
| 🧠 Functions | Overview of server-side functions in Realm | Functions Documentation |
| ⏰ Triggers | Triggers that run on database events or schedules | Triggers Documentation |
| 👤 User Management | Managing users, authentication, and providers | Users Documentation |
| 🌐 Custom Endpoints | HTTP endpoints to expose backend functionality via API | Custom Endpoints |
| 🔐 Rules & Permissions | Define fine-grained access control for collections | Rules Documentation |
The authentication system in @flowerforce/flowerbase reimplements the classic email/password login method (called local-userpass), similar to the one used by MongoDB Realm.
In MongoDB Atlas (Realm), users were stored in a separate internal authentication database, not directly accessible via the standard MongoDB collections.
However, with Flowerbase:
-
Users are stored directly in a MongoDB collection (by default named auth_users), but this can be customized in the server project via a JSON configuration file, as shown later in this guide.
-
The document structure remains identical to the previous Realm implementation
-
No changes are required to migrate the user data — existing user documents will continue to work as-is. However, all users will be required to reset their passwords since it is not possible to extract passwords from the old MongoDB authentication system.
The only authentication mode currently re-implemented in @flowerforce/flowerbase is:
- Local Email/Password (local-userpass)
Other methods (OAuth, API key, anonymous, etc.) are not supported yet.
{
"_id": ObjectId("2scgsb3gev99gsty2ev3g2g323d2hs"),
"email": "myuser@flowerbase.example",
"password": "your-encrypted-password",
"status": "confirmed",
"identities": [
{
"id": "example-id",
"provider_type": "local-userpass",
"provider_id": "example-provider-id",
"provider_data": {
"email": "myuser@flowerbase.example",
}
}
]
}You can specify the MongoDB collection used to store authentication users by configuring the auth_collection field inside the auth/providers.json file.
Example
{
"api-key": {
"name": "api-key",
"type": "api-key",
"disabled": true
},
"local-userpass": {
"name": "local-userpass",
"type": "local-userpass",
"disabled": false,
"auth_collection": "my-users-collection" //custom collection name
"config": {
"autoConfirm": true,
"resetPasswordSubject": "reset",
"resetPasswordUrl": "https://my.app.url/password-reset",
"runConfirmationFunction": false
}
}
}
If you're configuring the project from scratch, you can skip ahead to the Build step.
🔄 Migration Guide - Migrating Your Realm Project
Follow these steps to rebuild your backend in a clean and modern Node.js environment:
Follow these steps to export and download your Realm app from MongoDB Cloud.
Go to https://cloud.mongodb.com/ and sign in with your credentials.
From the dashboard, choose the project that contains the Realm app you want to download.
- In the left-hand sidebar, under the Services section, click on "Triggers".
- Then click the "View All Apps" button in the top-right corner.
From the list of applications, click on the app name you wish to export.
In the left sidebar, under the Manage section, click on "Deployment".
Click on the "Export App" tab at the top of the page.
Scroll to the bottom and click the "Download App" button.
This will download a .zip file containing your Realm app's full structure and configuration.
✅ You are now ready to migrate or inspect your Realm app locally!
- In your existing project folder, initialize a new Node.js project, Run:
npm init -y- Install Flowerbase
npm install @flowerforce/flowerbase- Add Typescript
npm install --save-dev typescript @types/node ts-node- Add
tsconfig.jsonfile
npx tsc --init- Create an index.ts file
Inside your project, create index.ts:
touch index.ts- In your
packages.json, inside the script section add this:
{
"start": "ts-node index.ts"
}Initialize the Flowerbase App
In index.ts, add:
import { initialize } from '@flowerforce/flowerbase';
const projectId = process.env.PROJECT_ID ?? "my-project-id"
const port = process.env.PORT ? Number(process.env.PORT) : undefined
const mongodbUrl = process.env.DB_CONNECTION_STRING
const jwtSecret = process.env.APP_SECRET
const host = process.env.HOST
initialize({
projectId,
port,
mongodbUrl,
jwtSecret,
host
})Ensure the following environment variables are set in your .env file or deployment environment:
| Variable | Description | Example |
|---|---|---|
PROJECT_ID |
A unique ID to identify your project. This value can be freely invented — it's preserved mainly for compatibility with the old Realm-style project structure. | my-flowerbase-app |
PORT |
The port on which the server will run. | 3000 |
DB_CONNECTION_STRING |
MongoDB connection URI, including username, password, and database name. | mongodb+srv://user:pass@cluster.mongodb.net/mydb |
APP_SECRET |
Secret used to sign and verify JWT tokens (choose a strong secret). | supersecretkey123! |
HOST |
The host address the server binds to (usually 0.0.0.0 for public access). |
0.0.0.0 |
HTTPS_SCHEMA |
The schema for your server requests (usually https or http). |
http |
Example:
PROJECT_ID=your-project-id
PORT=3000
DB_CONNECTION_STRING=mongodb+srv://username:password@cluster.mongodb.net/dbname
APP_SECRET=your-jwt-secret
HOST=0.0.0.0
HTTPS_SCHEMA=http🛡️ Note: Never commit .env files to source control. Use a .gitignore file to exclude it.
Once your migration or first configuration is complete, it’s time to build and deploy the backend so it can be accessed by your frontend or external clients.
If you're using for example TypeScript:
npx tscYou can deploy the application using any Node.js-compatible platform. Once deployed, you'll receive a public URL (e.g. https://your-app-name.up.example.app).
This URL should be used as the base URL in your frontend application, as explained in the next section.
You can use the official realm-web SDK to integrate MongoDB Realm into a React application.
This serves as a sample setup — similar logic can be applied using other official Realm SDKs (e.g. React Native, Node, or Flutter).
npm install realm-webCreate a file to initialize and export the Realm App instance:
// src/realm/realmApp.ts
import * as Realm from "realm-web";
// Replace with your actual Realm App ID and your deployed backend URL
const app = new Realm.App({
id: "your-realm-app-id", // e.g., my-app-abcde
baseUrl: "https://your-deployed-backend-url.com" // e.g., https://your-app-name.up.example.app
});
export default app;🔗 The baseUrl should point to the backend URL you deployed earlier using Flowerbase. This tells the frontend SDK where to send authentication and data requests.