FreeMarker Template is used to extract portlet preferences and render HTML elements on the server side. Headless API is used to perform client-side operations using AJAX calls to retrieve and manipulate folder and document data dynamically.