βš™οΈ AppML Environment & Setup
Estimated reading: 4 minutes 74 views

πŸ“ AppML Folder Structure Best Practices – Organize Your AppML Projects Smartly

🧲 Introduction – Why Folder Organization Matters in AppML Projects

Even though AppML is a lightweight, no-build framework, maintaining a well-organized folder structure is essential for scalability, clarity, and debugging efficiency. A clean directory layout allows you to separate models, views, controllers, and assets, making it easier to manage data-driven applicationsβ€”especially as your project grows.

🎯 In this article, you’ll learn:

  • The ideal folder structure for AppML projects
  • How to organize models, controllers, and views
  • Folder naming conventions for better readability
  • Real examples for single-page and multi-page AppML apps
  • Tips to future-proof your file organization

πŸ—‚οΈ Recommended Folder Structure for AppML Projects

Here is a modular folder structure that works for most small to medium AppML applications:

/appml-project/
β”œβ”€β”€ index.html
β”œβ”€β”€ /data/
β”‚   └── products.json
β”œβ”€β”€ /controller/
β”‚   └── appml-controller.js
β”œβ”€β”€ /model/
β”‚   └── schema.json
β”œβ”€β”€ /views/
β”‚   └── product-view.html
β”œβ”€β”€ /css/
β”‚   └── styles.css
β”œβ”€β”€ /js/
β”‚   └── custom-scripts.js
└── /assets/
    β”œβ”€β”€ /images/
    └── /icons/

πŸ’‘ Tip: Place reusable HTML blocks or templates inside /views, and API-returned models inside /data.


πŸ“¦ Folder Breakdown and Naming Best Practices

πŸ“ FolderπŸ“˜ Description
/data/Stores JSON, XML, or server-returned data files
/controller/Contains custom controller logic (JavaScript)
/model/Holds static schema definitions (optional)
/views/Stores modular HTML templates or AppML-rendered views
/css/Stylesheets for layout, theme, responsiveness
/js/Custom JS not managed by AppML (optional)
/assets/Static resources like images, icons, fonts

πŸ§ͺ Example: Connecting Folder Paths in HTML

Let’s say you’re loading a product list with AppML using this structure:

<!-- index.html -->
<div appml-data="data/products.json" appml-controller="controller/appml-controller.js">
  <h3>{{name}}</h3>
  <p>Price: ${{price}}</p>
</div>

βœ… Make sure relative paths are correct so AppML can load the model and apply controller logic.


πŸ” Reusable Views and Modular HTML Blocks

Use the /views/ folder to maintain reusable HTML templates. For example, product cards or form components:

<!-- views/product-view.html -->
<div>
  <h2>{{title}}</h2>
  <p>{{description}}</p>
</div>

Then you can include this inside your main page with AppML includes:

<div appml-include-html="views/product-view.html"></div>

🧰 Tips for Organizing Multi-Page AppML Projects

If you’re building a larger site or admin dashboard:

  • πŸ”Ή Create subfolders for each module or feature.
  • πŸ”Ή Group models and controllers by feature.
  • πŸ”Ή Keep all AppML-related files in a dedicated root folder (/appml/).
/admin-dashboard/
β”œβ”€β”€ /appml/
β”‚   β”œβ”€β”€ /products/
β”‚   β”‚   β”œβ”€β”€ data.json
β”‚   β”‚   └── controller.js
β”‚   β”œβ”€β”€ /orders/
β”‚   β”‚   β”œβ”€β”€ order-data.json
β”‚   β”‚   └── order-controller.js
β”‚   └── shared/
β”‚       └── view-header.html

πŸ“Œ Summary – Recap & Next Steps

Creating a well-structured AppML project folder enhances code readability, simplifies updates, and enables collaborative development. It’s a best practice that pays off as your app scales.

πŸ” Key Takeaways:

  • Store data in /data/, logic in /controller/, and views in /views/
  • Use consistent naming and relative paths for easier maintenance
  • Organize by feature for large, multi-module applications
  • Keep custom JavaScript and styles in separate folders (/js/ and /css/)

βš™οΈ Whether you’re building a small product list or a large admin panel, clean folder structure is your foundation for success.


❓ FAQs – AppML Project Folder Organization


❓ Do I need to follow a specific folder structure in AppML?
βœ… No, but following a modular structure helps keep your project maintainable and scalableβ€”especially for larger apps.


❓ Where should I place my JSON data files?
βœ… Place them in a /data/ or /model/ folder to keep them organized and easily referenced using appml-data.


❓ Can I load AppML views from other HTML files?
βœ… Yes! Use appml-include-html="views/filename.html" to dynamically include HTML templates or fragments.


❓ What’s the best place to store controller files?
βœ… Store all logic scripts in a /controller/ folder. Reference them using appml-controller="controller/logic.js".


❓ How do I organize multi-feature apps?
βœ… Create subfolders inside /appml/ or /modules/ for each feature (e.g., /users/, /products/, /reports/) and group their data and controllers inside them.


Share Now :
Share

AppML – Folder Structure Best Practices

Or Copy Link

CONTENTS
Scroll to Top