Develop your app locally with the CLI development server. No account needed, no setup required—just start building.
Make sure you’ve installed the CLI, then run:
backend server
Your local StaticBackend API is now running at http://localhost:8099
With the local development server, you can:
The local server has the exact same API as production, so your code works the same everywhere.
Initialize StaticBackend in your code with the “dev” region:
import { Backend } from '@staticbackend/js';
// Use "dev" region for local development
const backend = new Backend('any-pub-key', 'dev');
// The library will automatically connect to localhost:8099
The public key can be any value when using the dev server—it’s not validated locally.
By default, data is stored in memory and cleared when the server stops. Perfect for quick tests and experimentation.
backend server
# Data will be lost on restart
To keep your data across restarts, use the --persist-data flag:
backend server --persist-data
This uses SQLite to store data permanently on your local machine. Your development data persists until you manually delete it.
When to use persistent mode:
The server runs on port 8099 by default. Change it if needed:
backend server -p 8088
Update your app to connect to the new port:
const backend = new Backend('any-pub-key', 'dev', 'http://localhost:8088');
The in-memory database has minor limitations:
in and !in query operators have reduced functionalitySolution: Use --persist-data mode for full feature parity with production.
Press Ctrl+C in the terminal where the server is running.
When you’re ready to deploy:
"dev" to "na1" in your code:// Development
const backend = new Backend('any-pub-key', 'dev');
// Production (managed hosting)
const backend = new Backend('your-real-public-key', 'na1');
That’s it! Your app now uses the production backend with zero code changes.
# 1. Develop locally
backend server --persist-data
# 2. Test your app at http://localhost:3000 (or your dev server)
# 3. When ready, change region to 'na1' and deploy
Each project can run its own dev server on different ports:
# Project 1
cd ~/projects/app1
backend server -p 8099
# Project 2 (different terminal)
cd ~/projects/app2
backend server -p 8088
Need help? Join our GitHub Discussions
© 2023 Focus Centric Inc. All rights reserved.