Write Code, Skip Servers
Write JavaScript functions that run securely in the cloud. Triggers, background jobs, scheduled tasks — all the server-side logic you need without managing servers.
How Cloud Code Works
Write functions in JavaScript. Deploy to Back4app. Call from any client or trigger automatically on data changes.
Functions
On-demand when called
calculate()Triggers
Auto-run on data change
afterSave()Jobs
Scheduled (cron)
dailyReport()Every Type of Backend Logic
From simple API endpoints to complex scheduled workflows — Cloud Code handles it all.
Function Endpoints
Define custom functions that clients can call directly. Perfect for complex business logic that doesn't fit into simple CRUD operations.
- Define with Parse.Cloud.define()
- Receive parameters from clients
- Return any data format
- Access full Parse SDK and Node.js APIs
- Call external services and APIs
Your logic, our infrastructure.
Automatic Data Hooks
Run code automatically when data changes. Validate before saving, send notifications after updates, or modify queries before execution.
- beforeSave — Validate and transform data
- afterSave — Side effects after successful save
- beforeDelete / afterDelete — Cleanup logic
- beforeFind — Modify queries dynamically
- beforeLogin / afterLogout — Auth hooks
Data validation without client-side trust.
Long-Running Tasks
Run heavy operations in the background without blocking API responses. Process large datasets, generate reports, or batch update records.
- Up to 15 minutes execution time
- No request timeout concerns
- Progress tracking and logging
- Trigger manually or from other functions
- Chain multiple jobs for complex workflows
Heavy lifting without the wait.
Cron-Like Scheduling
Run jobs on a schedule using cron expressions. Daily reports, weekly cleanups, hourly syncs — all automated.
- Standard cron expression syntax
- Timezone-aware scheduling
- Dashboard UI for schedule management
- Execution history and logs
- Automatic retries on failure
Set it and forget it.
Parse.Cloud.beforeSave("User", ...)Write Cloud Code with AI
Describe the logic you need, and the AI generates, deploys, and tests your Cloud Functions. Focus on what your code should do, not how to write it.
Real-World Cloud Code
Copy-paste examples for common use cases.
Cloud Function
CallableCustom endpoint callable from SDKs
// Define a cloud function
Parse.Cloud.define("calculateOrderTotal", async (request) => {
const { orderId } = request.params;
const user = request.user;
// Verify user is authenticated
if (!user) {
throw new Error("Must be logged in to calculate order total");
}
// Query order items
const Order = Parse.Object.extend("Order");
const query = new Parse.Query(Order);
query.equalTo("objectId", orderId);
query.include("items");
const order = await query.first({ useMasterKey: true });
if (!order) {
throw new Error("Order not found");
}
// Calculate total with tax
const items = order.get("items") || [];
const subtotal = items.reduce((sum, item) =>
sum + (item.get("price") * item.get("quantity")), 0
);
const tax = subtotal * 0.08;
const total = subtotal + tax;
// Update order with calculated total
order.set("subtotal", subtotal);
order.set("tax", tax);
order.set("total", total);
await order.save(null, { useMasterKey: true });
return { subtotal, tax, total };
});What Can You Build?
Cloud Functions power critical backend logic across industries.
Data Validation
Enforce business rules server-side. Validate inputs, check constraints, and reject invalid data before it's saved.
Payment Processing
Integrate with Stripe, PayPal, or other processors. Handle webhooks, validate payments, update order status.
Email Notifications
Send transactional emails on data changes. Welcome emails, order confirmations, password resets.
Third-Party APIs
Connect to external services. Weather data, social media, analytics, AI services — all from your backend.
Report Generation
Generate PDFs, spreadsheets, or data exports. Run as background jobs for large datasets.
Data Sync
Keep data in sync with external systems. CRM updates, inventory sync, analytics pipelines.
Frequently Asked Questions
What language do Cloud Functions use?
What are triggers (beforeSave, afterSave, etc.)?
How do I schedule recurring jobs?
Can Cloud Functions call external APIs?
How do I debug Cloud Functions?
Are there execution time limits?
Can I use npm packages in Cloud Functions?
Deploy Your First Function Today
Write server-side logic without managing servers. No credit card required.