βοΈ AppML β Client vs Server Operations: What Runs Where and Why It Matters
π§² Introduction β Understanding AppMLβs Execution Model
When building dynamic applications with AppML (Application Modeling Language), it’s important to understand which parts of your app run on the client (browser) and which ones require server-side interaction. This helps optimize performance, improve scalability, and choose the right architecture for your use case.
π― In this article, you’ll learn:
- The difference between client-side and server-side operations in AppML
- Which tasks are handled in the browser and which require backend support
- Real examples of data fetching, form submission, and CRUD workflows
- Best practices for balancing performance and security
π» What Is a Client Operation in AppML?
Client-side operations are handled directly in the browser using HTML and JavaScript (via appml.js
). These operations do not require interaction with a server (unless data is fetched externally).
β Examples of Client-Side Operations:
π§ Task | π Description |
---|---|
Loading local JSON/XML files | AppML fetches and renders static files |
Rendering HTML templates | Replaces {{ }} placeholders with data |
Filtering data (in-memory) | Using appml-controller and onshow |
Displaying dynamic tables/lists | Rendering loops over local data sets |
Example:
<div appml-data="data/products.json">
<h4>{{name}}</h4>
<p>${{price}}</p>
</div>
β This works entirely on the client, as the JSON file is fetched and processed in the browser.
π What Is a Server Operation in AppML?
Server-side operations require communication with a backend script (like PHP or ASP) to fetch, update, delete, or validate data stored on a server or in a database.
π Examples of Server-Side Operations:
π§ Task | π Description |
---|---|
Fetching MySQL records | Server-side PHP/ASP script returns JSON |
Submitting forms to update database | Requires server validation and response |
Login/authentication | Must be handled securely on the backend |
Pagination for large datasets | Often done on the server for performance |
Example:
<div appml-data="get_products.php">
<h4>{{name}}</h4>
<p>${{price}}</p>
</div>
Here, get_products.php
fetches and returns data from a MySQL database, which AppML renders on the client.
π Comparison: Client vs Server in AppML
π§© Operation | π₯οΈ Client Side | π Server Side |
---|---|---|
Load static JSON | β Supported | β Not needed |
Load database records | β | β Required (PHP/ASP) |
Display list/grid | β Via templates | β If paginated via server |
Form validation | β Basic via controller | β Strong validation |
Save/update/delete records | β | β With backend logic |
Authentication/login | β | β Only on server |
π§ When to Use Server-Side with AppML
Use server-side AppML operations when:
- Your app needs to interact with a relational database (e.g., MySQL, PostgreSQL).
- Youβre building secure forms that require validation and data sanitization.
- Your data sets are too large to handle in-browser (e.g., 10,000+ records).
- You need user authentication, session management, or role-based access.
β οΈ Remember: Never trust client-side data for secure operations. Always validate on the server.
π¦ AppML Controller Role β Bridge Between Client and Server
AppML controllers (appml-controller
) can handle client-side logic and trigger server actions.
Example: Using Controller to Filter Server Data
myAppML.onshow = function() {
myAppML.sqlfilter = "category='electronics'";
};
This filter is sent to the server, which modifies the SQL query accordingly.
π Summary β Recap & Key Takeaways
Knowing the division of tasks between the client and server in AppML helps you structure efficient, secure, and responsive applications.
π Key Takeaways:
- Client-side: Load static files, render templates, filter in-memory data
- Server-side: Interact with databases, process forms, handle authentication
- Controllers help manage logic and trigger server actions
- Always validate data and manage sessions securely on the backend
βοΈ A balanced use of client and server operations is key to scalable AppML applications in 2025.
β FAQs β AppML Client and Server Behavior
β Can I build a full app in AppML without a server?
β
Yes, if your data is stored in static JSON or XML. You only need a server for database or form processing.
β When do I need PHP or ASP with AppML?
β
If you’re connecting to a database like MySQL or performing dynamic operations like save/delete/update, youβll need PHP or ASP.
β Can AppML filter data on the client side?
β
Yes, for small to medium datasets. Use myAppML.filter
inside a controller script to filter JSON before rendering.
β Is login authentication possible with only AppML?
β No. Authentication requires server-side scripting for security.
β Can I submit forms in AppML without JavaScript?
β
Yes, but the formβs action must point to a server-side script that handles submission and returns updated JSON.
Share Now :