CLI
Calljmp CLI is designed for mobile developers, offering powerful tools to manage backend services securely. With Calljmp, you can authenticate users, access databases directly, and manage dynamic user permissions, all within the mobile app environment.
Features:
- Local development: Test and develop your mobile backend locally.
- Deployment to Cloudflare: Deploy your backend services to the Cloudflare edge network.
- Environment management: Manage environment variables and secrets securely.
- SQL database access: Directly interact with your SQL database for schema management and data operations.
Installation
To get started with the Calljmp CLI, you need to install it globally via npm:
npm install -g @calljmp/cli
Once installed, you can verify the installation by running:
calljmp --version
Getting started
To initialize Calljmp in your project, navigate to your project directory and run the following command:
Before you can deploy your service, you must have a Calljmp account and be logged in to the Calljmp dashboard at dash.calljmp.com.
If you are using a monorepo, you can supplement the --project
flag with the
path to your project. For example, calljmp setup --project apps/my-app
.
calljmp setup
This command will help you configure your project, add necessary ignores, generate types, and guide you through the login and linking process.
Local development
Run the local development server to test your service locally:
- Name
module
- Type
- string
- Default value
- ./src/service
- Description
Path to the module directory containing your service code in
main.ts
.
- Name
port
- Type
- number
- Default value
- 8787
- Description
Port to run the local server on.
- Name
persist-database
- Type
- boolean
- Default value
- false
- Description
Persist the database between runs.
calljmp start
Manage database
You can synchronize your local database with your cloud database schema:
calljmp database pull
If you want to reset your local database to its initial state:
calljmp database reset
Calljmp comes with a built-in migrations tool to help you manage your database schema. You can run migrations locally or deploy them to the cloud.
calljmp database migrate
Deployment
Deploy your local changes to the cloud:
calljmp deploy
Code generation
Generate TypeScript code for your environment variables, database, and other resources.
- Name
no-hono
- Type
- boolean
- Default value
- false
- Description
Skip generation of Hono-specific types.
calljmp generate
The generate
command is automatically run when you run calljmp setup
. You
can also run it manually to update your types after making changes to your
database or environment variables.
Environment variables
Environment variables are managed in the .env
and .service.env
files. You can add your environment variables there, and they will be available in your code.
CALLJMP_SOME_TOKEN = "not a secret token"
CALLJMP_SECRET_ENCRYPTED_TOKEN = "encrypted secret token"
To add a secret prepend SECRET_
to a variable name. This will encrypt the variable and make it available in your code without the prefix.
import { Service } from './service'
const service = Service()
service.get('/', async c => {
console.debug('Variables', c.env.SOME_TOKEN)
console.debug('Secrets', c.env.ENCRYPTED_TOKEN)
})
export default service
Secrets
You can manage your secrets using the calljmp secrets
command. To list all secrets, run:
calljmp secrets list
Add a secret
Secrets are automatically added through environment variables. To add a secret explicitly, use the following command:
- Name
name
- Type
- string
- Description
The name of the secret to add. If not specified, it will prompt you to enter a name.
- Name
value
- Type
- string
- Description
The value of the secret to add. If not specified, it will prompt you to enter a value.
calljmp secrets add [name] [value]
Delete a secret
To delete a secret, you can use the following command:
- Name
name
- Type
- string
- Description
The name of the secret to delete. If not specified, it will prompt you to select secrets to delete.
calljmp secrets delete [name]