In dev.fun, functions are your app’s backend brain & extend your apps functionalities
They run logic securely in the background — whether or not you’re making API calls.
You can create them with just a prompt and use them anywhere in your app.
What Are Functions For?
Use a function when you want to:
- Run secure backend logic (e.g., pick a winner, calculate scores)
 
- Reuse the same logic in multiple places
 
- Make APIs calls and use secret keys
 
- Chain interactions together for complex flows
 
Example Prompts
plain textCreate a function called rollDice that returns a number between 1 and 6.
plain textCreate a function called greetPlayer that takes a name and returns "Hello, {name}!".
Why Use Backend Functions?
Frontend logic can be manipulated by malicious users.
Anything affecting:
- Gameplay fairness
 
- Payments
 
- Win conditions
 
…should always run in a function.
Functions also let you:
- Take user input
 
- Process it in the backend
 
- Return a result to update the UI
 
When Can Functions Run?
You can trigger them when a user:
- Clicks a button
 
- Submits a form
 
- Reaches a condition (e.g., certain score or state)
 
You can also chain functions together:
plain textRun checkWinner after rollDice finishes.
This creates full flows: Input → Logic → Result → UI update.
Managing Functions in Your App
- All your app’s functions live in Configuration → Functions
 
- Not sure what one does? Switch to Brainstorm Mode and ask:
 
“Explain what my checkWinner function does.”
The AI will tell you:
- What it does
 
- What inputs it takes
 
- What it affects or returns
 
Summary – When to Use Functions
- Secure backend logic
 
- API calls & secret keys
 
- Reusable & chained logic
 
- Dynamic, input-driven features
 
Functions give your app real power — without you ever writing backend code.
You just describe what it should do, and dev.fun builds the brain for it.