Explore Related Tools
Hand-picked utilities and calculators related to this tool.
Cloud Functions become truly powerful when they react to events happening in your Firebase services.
You can listen to document creation, updates, and deletions.
// Trigger when a new document is created in "messages"
exports.onMessageCreate = functions.firestore
.document('messages/{messageId}')
.onCreate((snap, context) => {
const newValue = snap.data();
console.log('New message:', newValue.text);
});Useful for creating user profiles in Firestore immediately after registration.
exports.createUserAccount = functions.auth.user().onCreate((user) => {
// Logic to add user to Firestore
return admin.firestore().collection('users').doc(user.uid).set({
email: user.email,
createdAt: admin.firestore.FieldValue.serverTimestamp()
});
});Triggered when a file is uploaded or deleted (e.g., to generate thumbnails).
exports.generateThumbnail = functions.storage.object().onFinalize((object) => {
// Logic to process the image
});Hand-picked utilities and calculators related to this tool.
