<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ayush kumar on Medium]]></title>
        <description><![CDATA[Stories by Ayush kumar on Medium]]></description>
        <link>https://medium.com/@ayushkumarcoc5639?source=rss-69ef44bb621e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vqinioR2OGhV7aYohnG4lA@2x.jpeg</url>
            <title>Stories by Ayush kumar on Medium</title>
            <link>https://medium.com/@ayushkumarcoc5639?source=rss-69ef44bb621e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 21:27:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ayushkumarcoc5639/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[AEM Complete Beginner Documentation]]></title>
            <link>https://medium.com/@ayushkumarcoc5639/aem-complete-beginner-documentation-b766749a999b?source=rss-69ef44bb621e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b766749a999b</guid>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[aem-architect]]></category>
            <category><![CDATA[aem]]></category>
            <dc:creator><![CDATA[Ayush kumar]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 07:23:02 GMT</pubDate>
            <atom:updated>2026-02-19T07:23:02.206Z</atom:updated>
            <content:encoded><![CDATA[<p><em>(Oak + Sling + Architecture — Simple Explanation)</em></p><h3>What is AEM?</h3><p><strong>AEM (Adobe Experience Manager)</strong> is a CMS used to:</p><ul><li>Create websites</li><li>Manage content</li><li>Manage digital assets</li><li>Run workflows</li><li>Deliver content to users</li></ul><p>Think of AEM as:</p><blockquote><em>🏢 A big content factory</em></blockquote><h3>High-Level AEM Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*4eDPtUv-BusswhxD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gotl3STKVb7iX7VC" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/0*Ft9izRX6H46qmreG" /></figure><h3>Main Parts:</h3><pre>User Browser<br>     ↓<br>Dispatcher (Cache)<br>     ↓<br>Publish Server<br>     ↓<br>Author Server<br>     ↓<br>Oak Repository</pre><h3>Core Building Blocks of AEM</h3><p>AEM mainly works on:</p><ol><li>Sling</li><li>Oak</li><li>OSGi</li><li>JCR</li></ol><p>Let’s understand each in simple language 👇</p><h3>What is Sling?</h3><p>Sling is the <strong>web framework</strong> used by AEM.</p><p>It handles:</p><ul><li>URL mapping</li><li>Request processing</li><li>Component rendering</li></ul><h3>Simple Example:</h3><p>When user hits:</p><pre>/content/site/home.html</pre><p>Sling:</p><ol><li>Finds the resource</li><li>Finds its resourceType</li><li>Maps it to component</li><li>Renders HTL file</li></ol><h3>Sling Flow</h3><pre>URL<br>  ↓<br>Sling resolves resource<br>  ↓<br>Component found<br>  ↓<br>HTL renders<br>  ↓<br>HTML returned</pre><h3>What is Oak?</h3><p>Oak is the <strong>database engine of AEM</strong>.</p><p>It stores:</p><ul><li>Pages</li><li>Components</li><li>Templates</li><li>Assets</li><li>Workflows</li><li>Users</li></ul><p>Oak implements JCR.</p><h3>Content Structure in Oak</h3><p>Everything is stored as a tree:</p><pre>/content<br>    /site<br>        /home<br>            jcr:content<br>                title = &quot;Welcome&quot;</pre><p>Oak stores:</p><ul><li>Nodes</li><li>Properties</li><li>Binaries</li></ul><h3>What is JCR?</h3><p>JCR = Java Content Repository (Specification)</p><p>It defines:</p><ul><li>How content is stored</li><li>How to query content</li><li>How versioning works</li></ul><p>Important:</p><blockquote><em>JCR = Rules<br> Oak = Engine implementing those rules</em></blockquote><h3>What is OSGi?</h3><p>OSGi manages:</p><ul><li>Services</li><li>Bundles</li><li>Configurations</li></ul><p>Example:</p><ul><li>Servlet</li><li>Scheduler</li><li>Service class</li></ul><p>Everything in AEM runs as an OSGi bundle.</p><h3>Full Request Lifecycle in AEM</h3><p>Let’s understand what happens when user opens a page.</p><pre>1. User hits URL<br>2. Dispatcher checks cache<br>3. If not cached → request to Publish<br>4. Sling resolves resource<br>5. Oak fetches content<br>6. Component HTL renders<br>7. HTML sent back</pre><h3>How Everything Connects</h3><pre>User Request<br>      ↓<br>Dispatcher<br>      ↓<br>Sling (routing)<br>      ↓<br>Oak (content)<br>      ↓<br>Component (HTL)<br>      ↓<br>Response</pre><h3>Simple Real-World Analogy</h3><p>Think AEM like a restaurant:</p><ul><li>Sling = Waiter (takes order)</li><li>Oak = Kitchen storage</li><li>OSGi = Kitchen manager</li><li>HTL = Chef preparing dish</li><li>Dispatcher = Reception desk</li></ul><h3>30-Second Interview Summary</h3><blockquote>AEM architecture is built on Sling for request resolution, Oak as the JCR repository for content storage, and OSGi for modular services. When a user requests a page, Sling resolves the resource, Oak retrieves content, and HTL renders the response.</blockquote><h3>Key Takeaways</h3><p>✔ Sling handles request<br> ✔ Oak stores content<br> ✔ JCR defines structure<br> ✔ OSGi manages services<br> ✔ Dispatcher caches content</p><p>Bonus Points :</p><ol><li>When a user hits /content/site/home.html, <strong>Sling</strong> resolves the URL to a JCR resource stored in Oak.</li><li>Sling reads the sling:resourceType of that node and maps it to the corresponding component.</li><li>The component’s HTL file renders the content, and the final HTML is returned to the browser.</li></ol><h3>Visual: Sling URL Decomposition</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2dPyt5G53-kYy_3S.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*RxBXlimKxHYf4C7d" /></figure><p>Example URL:</p><pre>/content/site/home.print.a4.html</pre><p>Breakdown:</p><ul><li>/content/site/home → Resource Path</li><li>print → Selector</li><li>a4 → Selector</li><li>html → Extension</li></ul><p>Sling uses this structure to decide:</p><ul><li>Which resource?</li><li>Which script?</li><li>What format?</li></ul><h3>Visual: Sling Request Flow Inside AEM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/0*LxgNKEAr9e2yEeRv.png" /></figure><h3>Flow:</h3><pre>Browser Request<br>      ↓<br>Dispatcher<br>      ↓<br>Sling Resolver<br>      ↓<br>Oak Repository<br>      ↓<br>Component (HTL)<br>      ↓<br>HTML Response</pre><h3>Visual: Oak Repository Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*s85hESJpGLgZGy3Z" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/0*MxKg9oqAC9KP6taR.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*Fa3-9wsDG8niwG7u" /></figure><p>Oak stores content as a tree:</p><pre>/content<br>   /site<br>      /home<br>         jcr:content<br>            title = &quot;Welcome&quot;</pre><p>Sling fetches this node and renders it.</p><blockquote>When a URL like /content/site/home.html is requested, Sling resolves the resource from Oak, maps its resourceType to a component, executes the HTL script, and returns the rendered HTML.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b766749a999b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AEM Scheduler — Complete Developer Guide]]></title>
            <link>https://medium.com/@ayushkumarcoc5639/aem-scheduler-complete-developer-guide-bf1e949d7219?source=rss-69ef44bb621e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf1e949d7219</guid>
            <category><![CDATA[aem-developer]]></category>
            <dc:creator><![CDATA[Ayush kumar]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 20:48:41 GMT</pubDate>
            <atom:updated>2026-02-17T20:48:41.886Z</atom:updated>
            <content:encoded><![CDATA[<p>A <strong>Scheduler in AEM</strong> is like setting an <strong>alarm clock for your code</strong>.</p><p>It allows tasks to run <strong>automatically at specific times</strong> without manual intervention.</p><h3>Why do we use Scheduler?</h3><p>Common real-world use cases:</p><p>• Delete old logs daily<br> • Sync data every hour<br> • Send reports every morning<br> • Clean expired cache nightly<br> • Import/export data automatically</p><p>Example:</p><p>Instead of manually deleting logs daily, you configure a scheduler to do it at midnight automatically.</p><h3>Scheduler Execution Flow</h3><pre>AEM Starts<br>     ↓<br>OSGi Configuration Loaded<br>     ↓<br>Scheduler Component Activated<br>     ↓<br>Scheduler Registered with Cron Expression<br>     ↓<br>run() Method Executes Automatically<br>     ↓<br>Task Runs at Scheduled Time</pre><h3>Ways to Implement Scheduler in AEM</h3><h3>Method 1: Whiteboard Pattern (OLD)</h3><p>Uses deprecated annotations.</p><p>Not recommended now.</p><h3>Method 2: Scheduler API (Recommended)</h3><p>Uses:</p><p>• OSGi annotations<br> • Sling Scheduler<br> • Configurable cron expression</p><p>This is the <strong>modern and production-safe approach</strong>.</p><h3>Implementation Using Scheduler API</h3><p>We create scheduler in <strong>two parts</strong>:</p><ol><li>OSGi Configuration</li><li>Scheduler Service</li></ol><h3>Step 1 — Create OSGi Configuration</h3><h3>File</h3><pre>GeeksSchedulerConfiguration.java</pre><h3>Code</h3><pre>package com.site.myproj.core.OSGIConfig;<br>import org.osgi.service.metatype.annotations.*;<br>@ObjectClassDefinition(<br>        name = &quot;AEM Scheduler Configuration&quot;,<br>        description = &quot;Scheduler Configuration&quot;<br>)<br>public @interface GeeksSchedulerConfiguration {<br>    @AttributeDefinition(<br>            name = &quot;Scheduler Name&quot;,<br>            description = &quot;Unique scheduler name&quot;<br>    )<br>    String schedulerName() default &quot;My Scheduler&quot;;<br>    @AttributeDefinition(<br>            name = &quot;Cron Expression&quot;,<br>            description = &quot;Cron job expression&quot;<br>    )<br>    String cronExpression() default &quot;0 0/1 * * * ?&quot;;<br>}</pre><h3>Purpose</h3><p>This creates a configuration in Felix console so scheduler timing can change <strong>without code changes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*8vgrLFNKtq6xcVIt4EWXyg.png" /><figcaption>AEM — Scheduler Configuration</figcaption></figure><h3>Step 2 — Create Scheduler Service</h3><h3>File</h3><pre>GeeksScheduler.java</pre><h3>Code</h3><pre>package com.site.myproj.core.schedulers;<br>import com.site.myproj.core.OSGIConfig.GeeksSchedulerConfiguration;<br>import org.apache.sling.commons.scheduler.*;<br>import org.osgi.service.component.annotations.*;<br>import org.osgi.service.metatype.annotations.Designate;<br>import org.slf4j.Logger;<br>import org.slf4j.LoggerFactory;<br>@Component(service = Runnable.class, immediate = true)<br>@Designate(ocd = GeeksSchedulerConfiguration.class)<br>public class GeeksScheduler implements Runnable {<br>    private static final Logger LOGGER =<br>            LoggerFactory.getLogger(GeeksScheduler.class);<br>    private int schedulerID;<br>    @Reference<br>    private Scheduler scheduler;<br>    @Activate<br>    protected void activate(GeeksSchedulerConfiguration config) {<br>        schedulerID = config.schedulerName().hashCode();<br>        addScheduler(config);<br>    }<br>    @Deactivate<br>    protected void deactivate() {<br>        scheduler.unschedule(String.valueOf(schedulerID));<br>    }<br>    private void addScheduler(GeeksSchedulerConfiguration config) {<br>        ScheduleOptions options =<br>                scheduler.EXPR(config.cronExpression());<br>        options.name(String.valueOf(schedulerID));<br>        options.canRunConcurrently(false);<br>        scheduler.schedule(this, options);<br>    }<br>    @Override<br>    public void run() {<br>        LOGGER.info(&quot;Scheduler executing task...&quot;);<br>    }<br>}</pre><h3>Important Code Explanation</h3><h3>@Component</h3><p>Registers class as OSGi component.</p><h3>@Activate</h3><p>Runs when component starts.</p><h3>@Deactivate</h3><p>Stops scheduler on shutdown.</p><h3>scheduler.schedule(…)</h3><p>Registers task.</p><h3>run()</h3><p>Actual logic runs here.</p><h3>Cron Expression Examples</h3><p>Expression Meaning0 * * * * ?Every minute 0 0/5 * * * ?Every 5 minutes0 0 0 * * ?Midnight daily0 0 12 * * ?Noon daily</p><p>Cron format:</p><pre>Seconds Minutes Hours Day Month DayOfWeek</pre><h3>Deploy and Test Scheduler</h3><h3>Step 1 — Deploy Code</h3><p>Run:</p><pre>mvn clean install</pre><p>Deploy package to AEM.</p><h3>Step 2 — Check Component Status</h3><p>Open:</p><pre>http://localhost:4502/system/console/components</pre><p>Search for scheduler class.</p><p>Status should be:</p><p>Active</p><h3>Step 3 — Configure Scheduler</h3><p>Open:</p><pre>http://localhost:4502/system/console/configMgr</pre><p>Search:</p><pre>AEM Scheduler Configuration</pre><p>Set cron expression.</p><p>Save.</p><h3>Step 4 — Check Logs</h3><p>Open:</p><pre>crx-quickstart/logs/error.log</pre><p>You should see:</p><pre>Scheduler executing task...</pre><p>every configured interval.</p><h3>Where Can You Test Scheduler?</h3><p>You can test scheduler in:</p><h3>1. Local AEM Instance</h3><pre>http://localhost:4502</pre><h3>2. AEM Dev Environment</h3><p>Company Dev server.</p><h3>3. AEM Cloud Dev Instance</h3><p>Cloud Manager environments.</p><h3>Recommended Testing Method</h3><p>Add temporary log:</p><pre>LOGGER.info(&quot;Running scheduler test&quot;);</pre><p>Then watch logs.</p><h3>Common Mistakes</h3><blockquote>Forgetting unschedule<br>Hardcoding cron expression<br>Running heavy DB operations directly<br>Multiple schedulers with same name</blockquote><h3>Real Enterprise Use Cases</h3><p>• Product feed import<br> • DAM cleanup<br> • Cache refresh<br> • User sync<br> • Report generation</p><h3>Interview Answer Summary</h3><p><strong>What is Scheduler in AEM?</strong></p><p>Scheduler allows automatic execution of tasks at scheduled times using Sling Scheduler and cron expressions.</p><p><strong>How is it implemented?</strong></p><p>Using Runnable service + Scheduler API + OSGi configuration.</p><h3>Final Execution Flow Diagram</h3><pre>AEM Start<br>   ↓<br>OSGi Config Loaded<br>   ↓<br>Scheduler Activated<br>   ↓<br>Cron Trigger<br>   ↓<br>run() Executes<br>   ↓<br>Task Completed</pre><h3>Summary</h3><p><em>An </em><strong><em>AEM Scheduler</em></strong><em> is used to automatically run tasks at specific times, similar to setting an alarm for your code. It is commonly used for activities like cleaning old logs, syncing data, refreshing cache, or generating reports without manual effort. In AEM, the recommended way to implement a scheduler is by using the </em><strong><em>Sling Scheduler API</em></strong><em> along with OSGi configuration and a class implementing the </em><em>Runnable interface, where the </em><em>run() method contains the logic to execute. Once the component is active, the scheduler runs automatically based on a defined </em><strong><em>cron expression</em></strong><em>, which specifies the execution timing. Developers can test and monitor scheduler execution through the AEM component console, configuration manager, and log files. A cron expression follows the format </em><strong><em>Seconds, Minutes, Hours, Day, Month, and Day of Week</em></strong><em>, for example </em><em>0 * * * * ? runs every minute, </em><em>0 0/5 * * * ? runs every five minutes, and </em><em>0 0 0 * * ? runs daily at midnight.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98un_eO8A4K0C_m5QX005Q.png" /><figcaption>AEM scheduler task flow infographic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PAlrmRXG6GcVC_FprWx0dg.png" /><figcaption>AEM Scheduler — Real Time Scenario</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf1e949d7219" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AEM Security Implementation]]></title>
            <link>https://medium.com/@ayushkumarcoc5639/aem-security-implementation-addefe1fba6b?source=rss-69ef44bb621e------2</link>
            <guid isPermaLink="false">https://medium.com/p/addefe1fba6b</guid>
            <category><![CDATA[aem]]></category>
            <dc:creator><![CDATA[Ayush kumar]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 10:50:33 GMT</pubDate>
            <atom:updated>2026-02-17T10:56:23.272Z</atom:updated>
            <content:encoded><![CDATA[<h3>reCAPTCHA, WAF &amp; Rate Limiting</h3><h3>Overview</h3><p>Public-facing AEM applications must be protected against:</p><ul><li>Bot traffic</li><li>Spam submissions</li><li>Brute-force attacks</li><li>DDoS attempts</li><li>API abuse</li></ul><p>Security is implemented using:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DriHjiFgQMbjxDUcisfq3g.png" /></figure><h3>reCAPTCHA Implementation in AEM</h3><p>reCAPTCHA is provided by Google to verify human users.</p><h3>Typical Flow</h3><pre>User → AEM Page → reCAPTCHA → Token Generated<br>      → Token submitted → AEM Servlet<br>      → Google verification → Accept/Reject</pre><h3>Step-by-Step Implementation</h3><h3>Step 1 — Generate reCAPTCHA Keys</h3><ol><li>Register domain in Google reCAPTCHA console</li><li>Select version:</li></ol><ul><li>v2 Checkbox</li><li>v2 Invisible</li><li>v3 Score-based</li></ul><p>You receive:</p><pre>Site Key<br>Secret Key</pre><h3>Step 2 — Store Keys in AEM</h3><p>Create OSGi configuration:</p><pre>/apps/project/config/com.project.core.services.RecaptchaConfig.cfg.json</pre><p>Example:</p><pre>{<br>  &quot;siteKey&quot;: &quot;SITE_KEY&quot;,<br>  &quot;secretKey&quot;: &quot;SECRET_KEY&quot;,<br>  &quot;verifyUrl&quot;: &quot;https://www.google.com/recaptcha/api/siteverify&quot;<br>}</pre><h3>Step 3 — HTL Frontend Changes</h3><p>Add reCAPTCHA script:</p><pre>&lt;script src=&quot;https://www.google.com/recaptcha/api.js&quot; async defer&gt;&lt;/script&gt;</pre><p>Add widget in form:</p><pre>&lt;form method=&quot;POST&quot; action=&quot;/bin/contact&quot;&gt;</pre><pre>  &lt;input type=&quot;text&quot; name=&quot;name&quot;&gt;</pre><pre>  &lt;div class=&quot;g-recaptcha&quot;<br>       data-sitekey=&quot;${recaptcha.siteKey}&quot;&gt;<br>  &lt;/div&gt;</pre><pre>  &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;</pre><pre>&lt;/form&gt;</pre><h3>Step 4 — Servlet Implementation</h3><p>Create servlet:</p><pre>@Component(service = Servlet.class,<br> property = {<br>  &quot;sling.servlet.paths=/bin/contact&quot;,<br>  &quot;sling.servlet.methods=POST&quot;<br> })<br>public class ContactServlet extends SlingAllMethodsServlet {<br>protected void doPost(SlingHttpServletRequest req,<br>                       SlingHttpServletResponse resp)<br>                       throws IOException {<br>   String token = req.getParameter(&quot;g-recaptcha-response&quot;);<br>   if(verifyToken(token)) {<br>       resp.getWriter().write(&quot;Success&quot;);<br>   } else {<br>       resp.getWriter().write(&quot;Captcha Failed&quot;);<br>   }<br> }<br>}</pre><h3>Step 5 — Token Validation Logic</h3><p>Server validates token:</p><pre>private boolean verifyToken(String token) {<br>    // HTTP call to Google API<br>    // send secret + token<br>    return true;<br>}</pre><h3>Step 6 — Dispatcher Rule Protection</h3><p>Block direct servlet access if needed:</p><pre>/filter {<br>  /0001 { /type &quot;allow&quot; /url &quot;/bin/contact&quot; }<br>}</pre><h3>WAF Implementation</h3><p>A <strong>Web Application Firewall (WAF)</strong> protects applications from attacks.</p><p>Common enterprise providers include Cloudflare and Amazon Web Services.</p><h3>WAF Placement</h3><pre>User<br>  ↓<br>CDN<br>  ↓<br>WAF<br>  ↓<br>Dispatcher<br>  ↓<br>AEM Publish</pre><h3>WAF Blocks</h3><ul><li>SQL injection</li><li>XSS attacks</li><li>Bot traffic</li><li>DDoS</li><li>malicious headers</li><li>suspicious IP ranges</li></ul><h3>WAF Setup Steps</h3><ol><li>Configure domain behind CDN/WAF.</li><li>Enable managed firewall rules.</li><li>Enable bot protection.</li><li>Enable rate limiting.</li><li>Restrict admin URLs.</li></ol><p>Example blocked paths:</p><pre>/system/console<br>/crx/de<br>/apps/*<br>/libs/*</pre><h3>Rate Limiting Implementation</h3><p>Rate limiting prevents request flooding.</p><p>Example:</p><pre>Max 100 requests per minute per IP</pre><h3>Option 1 — CDN/WAF Level (Recommended)</h3><p>Example rule:</p><pre>If IP &gt; 100 req/min<br>Block for 10 minutes</pre><p>Best performance since AEM is not hit.</p><h3>Option 2 — Dispatcher Level</h3><p>Example:</p><pre>/filter {<br>  /0002 {<br>    /type &quot;deny&quot;<br>    /url &quot;/bin/contact&quot;<br>    /limit 100<br>  }<br>}</pre><h3>Option 3 — Servlet Level (Not Recommended)</h3><pre>Map&lt;String, Integer&gt; requests;</pre><p>Count requests per IP.</p><p>Poor scalability.</p><h3>Recommended Production Architecture</h3><pre>User<br>  ↓<br>CDN<br>  ↓<br>WAF + Rate Limit<br>  ↓<br>Dispatcher Cache<br>  ↓<br>AEM Publish</pre><p>Forms use:</p><pre>reCAPTCHA → Servlet Validation</pre><h3>Best Practices</h3><blockquote><em>Always validate captcha on backend<br>Keep secret keys secure<br>Apply rate limits on APIs/forms<br>Use dispatcher caching<br>Protect AEM consoles<br>Enable logging &amp; monitoring</em></blockquote><h3>Interview Questions &amp; Answers</h3><h3>Q1. Why use reCAPTCHA in AEM?</h3><p>To prevent automated bots from submitting forms or abusing endpoints.</p><h3>Q2. Where should captcha validation happen?</h3><p>On backend servlet only.</p><h3>Q3. What is WAF?</h3><p>A firewall protecting applications from web attacks.</p><h3>Q4. Difference: WAF vs reCAPTCHA?</h3><p>reCAPTCHAWAFValidates userFilters trafficForm-levelNetwork-level</p><h3>Q5. Best place for rate limiting?</h3><p>CDN/WAF layer.</p><h3>Q6. How do you protect AEM publish?</h3><p>Using:</p><ul><li>Dispatcher filters</li><li>WAF</li><li>Rate limiting</li><li>reCAPTCHA</li></ul><h3>Q7. Why not rate-limit in servlet?</h3><p>Consumes AEM resources and fails at scale.</p><h3>Q8. What happens if captcha API fails?</h3><p>Fallback error handling or allow retry.</p><h3>Q9. How do you secure /bin endpoints?</h3><p>Dispatcher allow rules + authentication + rate limiting.</p><h3>Q10. How do enterprises protect AEM?</h3><p>Using multi-layer protection:</p><pre>CDN + WAF + Dispatcher + Captcha + Auth</pre><h3>Final Summary</h3><p><strong><em>AEM applications are secured using three main mechanisms: reCAPTCHA, WAF, and rate limiting. reCAPTCHA is integrated into forms to prevent automated bots from submitting spam by validating users on the backend before processing requests. A Web Application Firewall (WAF) sits in front of AEM to block malicious traffic such as injection attacks, bot floods, and unauthorized access attempts before they reach the publish servers. Rate limiting further protects the system by restricting how many requests a user or IP address can make in a given time, preventing abuse and server overload. Together, with dispatcher filtering and proper backend validation, these measures ensure that AEM environments remain secure, performant, and protected from automated and malicious traffic.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aLfKhYTCTaUW4WQ5WnZFHg.png" /><figcaption>AEM Security Implementation</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=addefe1fba6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adobe Experience Manager (AEM) Headless CMS with GraphQL]]></title>
            <link>https://medium.com/@ayushkumarcoc5639/adobe-experience-manager-aem-headless-cms-with-graphql-ab4131d89170?source=rss-69ef44bb621e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab4131d89170</guid>
            <category><![CDATA[aem-architect]]></category>
            <category><![CDATA[aem-features]]></category>
            <category><![CDATA[aemasacloudservice]]></category>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[aem]]></category>
            <dc:creator><![CDATA[Ayush kumar]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 19:17:44 GMT</pubDate>
            <atom:updated>2026-02-12T19:17:44.738Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Complete Guide from Setup to Query Execution</h3><h3>Introduction</h3><p>Modern digital applications no longer rely on server-rendered HTML alone. Content today must be delivered across multiple channels including websites, mobile applications, smart devices, and third-party platforms.</p><p>A headless CMS architecture enables this flexibility by separating content management from content presentation.</p><p>Adobe Experience Manager (AEM) provides a robust enterprise-grade headless implementation using:</p><ul><li>Content Fragment Models</li><li>Content Fragments</li><li>GraphQL APIs</li></ul><p>This article explains the full setup process and architectural understanding of AEM as a Headless CMS.</p><h3>1. What Is a Headless CMS?</h3><p>A headless CMS is a content management system that stores and governs structured content but does not render HTML pages.</p><p>Instead of returning fully built web pages, it exposes structured data (typically JSON) through APIs.</p><p>Traditional CMS:</p><ul><li>Backend renders HTML</li><li>Frontend consumes complete pages</li></ul><p>Headless CMS:</p><ul><li>Backend exposes structured content</li><li>Frontend applications render UI independently</li></ul><p>This architecture allows the same content to power multiple digital experiences.</p><h3>2. AEM Headless Architecture Overview</h3><p>AEM’s headless implementation is built around three core layers:</p><ol><li>Content Fragment Models<br> Define the content schema.</li><li>Content Fragments<br> Store the actual content in structured form.</li><li>GraphQL Endpoint<br> Exposes content through a read-only API.</li></ol><p>High-level flow:</p><p>Content Fragment Models<br> → Content Fragments (stored in DAM)<br> → GraphQL Endpoint<br> → Frontend Applications</p><p>The schema is automatically derived from the models, and the API is generated by AEM.</p><h3>3. Environment Prerequisites</h3><h3>AEM as a Cloud Service or Local SDK</h3><p>GraphQL support is built-in and requires no additional installation.</p><h3>AEM 6.x On-Premise</h3><p>You must install Adobe’s official GraphQL feature package before using GraphQL endpoints.</p><p>Without this package, the GraphQL console and endpoints will not be available.</p><h3>4. Preparing AEM for Headless Implementation</h3><h3>4.1 Create a Configuration Container</h3><p>Navigate to:</p><p>Tools → General → Configuration Browser</p><p>Create a configuration container (example: wknd) and enable:</p><ul><li>Content Fragment Models</li><li>GraphQL</li></ul><p>This creates a workspace at:</p><p>/conf/wknd</p><p>All models and GraphQL endpoints should be created within this configuration container.</p><h3>4.2 Create Content Fragment Models (Define the Schema)</h3><p>Content Fragment Models define the structure and validation rules of your content.</p><p>Example: Author Model (under /conf/wknd)</p><p>Fields:</p><ul><li>firstName — Single Line Text</li><li>lastName — Single Line Text</li><li>types — Enumeration or Tags</li><li>photo — Content Reference</li></ul><p>Example: Article Model (under /conf/wknd)</p><p>Fields:</p><ul><li>title — Single Line Text</li><li>slug — Single Line Text</li><li>author — Fragment Reference (Author model)</li><li>body — Rich Text</li><li>publishDate — Date/Time</li></ul><p>These models form the GraphQL schema automatically.</p><h3>Field Design Best Practices</h3><p>Each important field should include:</p><ul><li>A meaningful placeholder</li><li>A clear description</li><li>Proper validation</li></ul><p>Example: Slug Field</p><p>Field Label: Slug<br> Property: slug<br> Type: Single Line Text</p><p>Validation pattern:</p><p>^[a-z0–9]+(?:-[a-z0–9]+)*$</p><p>Error message:<br> Use lowercase letters, numbers, and hyphens only.</p><p>This ensures clean, consistent URLs and predictable API responses.</p><h3>5. Create Content Fragments</h3><p>Content Fragments are instances of the models.</p><p>Navigate to:</p><p>Assets → Files → Create Folder<br> Example folder:</p><p>/content/dam/cfm</p><p>Create fragments using the previously defined models.</p><p>Example: Author Fragment</p><p>firstName: Martin<br> lastName: Kleppmann<br> types: DATA<br> photo: /content/dam/wknd/digital/team-3.jpg</p><p>Example: Article Fragment</p><p>title: Clean Code<br> slug: clean-code<br> author: Robert Martin<br> publishDate: 2008–08–11</p><p>These fragments are now queryable via GraphQL.</p><h3>6. Create a GraphQL Endpoint</h3><p>Navigate to:</p><p>Tools → General → GraphQL → Create</p><p>Example:</p><p>Name: wk-ep<br> Path:<br> /content/cq:graphql/wknd/endpoint</p><p>The endpoint exposes all models under the selected configuration container.</p><h3>7. Using the AEM GraphQL Query Editor</h3><p>Open:</p><p>Tools → General → GraphQL → Query Editor</p><p>Select your endpoint (e.g., wk-ep).</p><p>The interface includes:</p><ul><li>Endpoint selector</li><li>Query editor</li><li>Documentation explorer</li><li>Query variables panel</li><li>Results panel</li></ul><p>The documentation explorer automatically reflects the schema generated from your models.</p><h3>8. Executing Your First Query</h3><p>Example query:</p><pre>query {<br>  articleList {<br>    items {<br>      title<br>    }<br>  }<br>}</pre><p>After execution, the response will be:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;articleList&quot;: {<br>      &quot;items&quot;: [<br>        {<br>          &quot;title&quot;: &quot;Clean Code&quot;<br>        }<br>      ]<br>    }<br>  }<br>}</pre><p>This demonstrates how structured content is returned as JSON.</p><h3>9. Persisted Queries (Production Best Practice)</h3><p>In production environments, avoid exposing raw GraphQL queries directly.</p><p>Instead:</p><ol><li>Save the query using “Save As” in Query Editor.</li><li>This creates a persisted query.</li><li>The frontend calls it using HTTP GET.</li><li>The response becomes cacheable via Dispatcher or CDN.</li></ol><p>Example endpoint format:</p><p>/graphql/execute.json/wknd/article-list</p><p>Benefits:</p><ul><li>Improved performance</li><li>Cache-friendly architecture</li><li>Enhanced security</li><li>Cleaner frontend integration</li></ul><h3>10. Publishing Considerations</h3><p>To make content available externally:</p><ul><li>Publish Content Fragment Models</li><li>Publish Content Fragments</li><li>Publish the GraphQL endpoint</li></ul><p>Ensure replication is properly configured in your environment.</p><h3>11. End-to-End Flow Summary</h3><ol><li>Define schema using Content Fragment Models.</li><li>Create structured content using Content Fragments.</li><li>AEM auto-generates GraphQL schema.</li><li>Frontend applications query the endpoint.</li><li>JSON data is rendered by the frontend.</li></ol><h3>Conclusion</h3><p>AEM Headless CMS provides a structured, scalable approach to delivering content across multiple channels.</p><p>By combining:</p><ul><li>Content Fragment Models for schema definition</li><li>Content Fragments for structured data</li><li>GraphQL for API delivery</li><li>Persisted Queries for production readiness</li></ul><p>AEM enables enterprise-grade headless architecture suitable for modern digital ecosystems.</p><p>Understanding these core building blocks allows teams to build flexible, future-ready applications while maintaining strong content governance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O1eF5rII4TSqpRByqCIPPw.png" /><figcaption>GraphQL — AEM</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab4131d89170" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Context-Aware Configuration (CAConfig) in AEM — Why It Matters in Enterprise Projects]]></title>
            <link>https://medium.com/@ayushkumarcoc5639/understanding-context-aware-configuration-caconfig-in-aem-why-it-matters-in-enterprise-projects-26c70c4b3f40?source=rss-69ef44bb621e------2</link>
            <guid isPermaLink="false">https://medium.com/p/26c70c4b3f40</guid>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[contextawareaem]]></category>
            <category><![CDATA[aemasacloudservice]]></category>
            <category><![CDATA[aem-architect]]></category>
            <dc:creator><![CDATA[Ayush kumar]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 05:47:33 GMT</pubDate>
            <atom:updated>2026-02-12T05:47:33.375Z</atom:updated>
            <content:encoded><![CDATA[<p>Adobe Experience Manager (AEM) provides multiple ways to manage configuration, but one of the most important — and sometimes misunderstood — features is <strong>Context-Aware Configuration (CAConfig)</strong>.</p><p>If you are working on AEM 6.4+, 6.5, or AEM as a Cloud Service, understanding CAConfig is essential for building scalable and maintainable multi-site architectures.</p><p>Let’s break it down clearly.</p><h3>What Is Context-Aware Configuration (CAConfig)?</h3><p>Context-Aware Configuration is an AEM feature that allows you to store configuration separately from content and dynamically resolve it based on where a page lives in the content tree.</p><p>Instead of:</p><ul><li>Hardcoding configuration inside components</li><li>Storing configuration under /content</li><li>Writing custom path-based logic</li></ul><p>AEM encourages storing configuration under:</p><pre>/conf</pre><p>Content branches then reference their configuration using:</p><pre>cq:conf = /conf/&lt;site-or-chapter&gt;</pre><p>This makes configuration:</p><ul><li>Reusable</li><li>Structured</li><li>Environment-friendly</li><li>Site-specific</li><li>Cleanly separated from content</li></ul><h3>Why Does AEM Need CAConfig?</h3><p>Imagine a multi-site structure like:</p><pre>/content/shaw/co<br>/content/shaw/tx<br>/content/shaw/ny</pre><p>Each chapter might require:</p><ul><li>Different email configurations</li><li>Different API endpoints</li><li>Different header/footer behavior</li><li>Different feature flags</li><li>Different third-party integrations</li></ul><p>Without CAConfig, you might:</p><ul><li>Duplicate configurations across pages</li><li>Write custom logic to check paths</li><li>Embed configuration into components</li></ul><p>Instead, you create:</p><pre>/conf/shaw/co<br>/conf/shaw/tx<br>/conf/shaw/ny</pre><p>Each content branch points to its respective configuration.</p><p>That’s what “context-aware” means:</p><blockquote><em>The configuration changes dynamically depending on the page context.</em></blockquote><h3>Is CAConfig the Recommended Approach?</h3><p>Yes — absolutely.</p><p>CAConfig is the recommended approach in:</p><ul><li>AEM 6.4+</li><li>AEM 6.5</li><li>AEM as a Cloud Service</li></ul><p>Modern AEM project archetypes are built around /conf.</p><p>If you’re building an enterprise multi-site solution, CAConfig is not optional — it’s best practice.</p><h3>When Is CAConfig Necessary?</h3><p>You should use CAConfig when:</p><ul><li>You have multiple sites or chapters</li><li>You need site-level or regional configuration</li><li>You want a clear separation between content and configuration</li><li>Authors need to manage configuration via AEM</li></ul><p>You may not need it if:</p><ul><li>The website is small and static</li><li>Configuration is fixed and identical everywhere</li><li>Everything is managed purely via code</li></ul><p>But in enterprise environments — it is essential.</p><h3>The Replication Challenge in CAConfig</h3><p>Here’s where things get interesting.</p><p>AEM stores:</p><ul><li>Content under /content</li><li>Configuration under /conf</li></ul><p>However, replication was originally designed to publish content — not configuration dependencies.</p><p>So when you publish:</p><pre>/content/shaw/co</pre><p>AEM does NOT automatically publish:</p><pre>/conf/shaw/co</pre><p>Even though the page depends on it.</p><p>That’s why teams often face issues where:</p><ul><li>Pages work in author</li><li>But break in publish</li><li>Because configuration wasn’t activated</li></ul><h3>Why Doesn’t AEM Auto-Replicate Configuration?</h3><p>There are valid reasons:</p><ul><li>/conf can be shared across multiple sites</li><li>Some customers prefer managing configuration via CI/CD</li><li>Adobe avoids automatically replicating dependencies</li></ul><p>So dependency-based replication is not enabled by default.</p><h3>How wcm.io Solves the Gap</h3><p>The <strong>wcm.io AEM Mocks &amp; Utilities library</strong> provides an extension that enhances replication.</p><p>With wcm.io:</p><ol><li>Page is activated</li><li>cq:conf reference is detected</li><li>Related /conf path is identified</li><li>Both content and config are replicated</li></ol><p>It essentially makes activation dependency-aware.</p><p>This is not a hack.</p><p>wcm.io is:</p><ul><li>Widely adopted</li><li>Enterprise trusted</li><li>Open-source</li><li>Common in real-world AEM projects</li></ul><p>Many large implementations use it.</p><h3>When Would You NOT Use wcm.io?</h3><p>You might skip it if:</p><ul><li>Configuration is managed only via deployment pipelines</li><li>Authors are not allowed to change /conf</li><li>You treat configuration strictly as code</li></ul><p>Some enterprises prefer:</p><blockquote><em>“All config changes go through CI/CD.”</em></blockquote><p>In that case, replication dependencies are irrelevant.</p><p>But if authors publish configuration changes via Quick Publish, wcm.io makes perfect sense.</p><h3>CAConfig vs OSGi Configuration</h3><p>A common confusion is:</p><p>“What’s the difference between CAConfig and OSGi config?”</p><p>Here’s a simple breakdown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*6FcNsPNoF02Jcql9xIkiMw.png" /></figure><p>Use:</p><ul><li>CAConfig for site-level functional settings</li><li>OSGi for backend/system behavior</li></ul><p>They serve different purposes.</p><h3>How CAConfig Resolves Internally</h3><p>When a component requests configuration:</p><ol><li>AEM looks at the current page</li><li>Checks its cq:conf property</li><li>Resolves the corresponding /conf path</li><li>Searches upward if needed</li><li>Returns the matching configuration</li></ol><p>This makes configuration inheritance possible.</p><h3>Real-World Enterprise Scenario</h3><p>In a multi-region implementation like:</p><pre>/content/sh_page/{chapter}</pre><p>With:</p><pre>/conf/sh_page/{chapter}</pre><p>Each region can:</p><ul><li>Have independent integrations</li><li>Use separate API endpoints</li><li>Toggle features independently</li><li>Deploy safely without affecting others</li></ul><p>That’s exactly what CAConfig was designed for.</p><h3>Final Thoughts</h3><p>Context-Aware Configuration is not just a feature — it’s a foundational architectural pattern in modern AEM.</p><p>If you’re building enterprise multi-site solutions:</p><ul><li>CAConfig is correct</li><li>Using /conf is best practice</li><li>Managing replication properly is necessary</li><li>Tools like wcm.io can help close real-world gaps</li></ul><p>A clean separation between content and configuration is what allows AEM to scale properly in complex implementations.</p><h3>Visual Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v3wnIk8viybY52J1ImzQIA.png" /><figcaption>CA Config — Ayush</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26c70c4b3f40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Important Topics I]]></title>
            <link>https://medium.com/@ayushkumarcoc5639/javascript-important-topics-i-1c1b074ef973?source=rss-69ef44bb621e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c1b074ef973</guid>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript-interview]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Ayush kumar]]></dc:creator>
            <pubDate>Tue, 12 Aug 2025 12:53:17 GMT</pubDate>
            <atom:updated>2025-08-12T12:53:17.771Z</atom:updated>
            <content:encoded><![CDATA[<p>An awesome thing about JavaScript is your browser has a built-in execution environment. You can read more on how to execute code within your browser (and view a website’s code) [here](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Tools_and_setup/What_are_browser_developer_tools).</p><p>### **Function Syntax**</p><p>In JavaScript, there are two main ways to declare a function. One of which is to use the `function` keyword.</p><p>### **Basic Syntax**</p><p>The syntax is:</p><p>`function f(a, b) {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>}</p><p>console.log(f(3, 4)); // 7`</p><p>In this example, `f` is the name of the function. `(a, b)` are the arguments. You can write any logic in the body and finally `return` a result. You are allowed to return nothing, and it will instead implicitly return `undefined`.</p><p>### **Anonymous Function**</p><p>You can optionally exclude the name of the function after the `function` keyword.</p><p>`var f = function(a, b) {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>}</p><p>console.log(f(3, 4)); // 7`</p><p>### **Immediately Invoked Function Expression (IIFE)**</p><p>You can create a function and immediately execute it in Javascript.</p><p>`const result = (function(a, b) {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>})(3, 4);</p><p>console.log(result); // 7`</p><p>Why would you write code like this? It gives you the opportunity to ***encapsulate*** a variable within a new ***scope***. For example, another developer can immediately see that `sum` can’t be used anywhere outside the function body.</p><p>### **Functions Within Functions**</p><p>A powerful feature of JavaScript is you can actually create functions within other functions and even return them!</p><p>`function createFunction() {</p><p>. function f(a, b) {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>. }</p><p>. return f;</p><p>}</p><p>const f = createFunction();</p><p>console.log(f(3, 4)); // 7`</p><p>In this example, `createFunction()` returns a new function. Then that function can be used as normal.</p><p>### **Function Hoisting**</p><p>JavaScript has a feature called ***hoisting*** where a function can sometimes be used before it is initialized. You can only do this if you declare functions with the `function` syntax.</p><p>`function createFunction() {</p><p>. return f;</p><p>. function f(a, b) {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>. }</p><p>}</p><p>const f = createFunction();</p><p>console.log(f(3, 4)); // 7`</p><p>In this example, the function is returned before it is initialized. Although it is valid syntax, it is sometimes considered bad practice as it can reduce readability.</p><p>### **Closures**</p><p>An important topic in JavaScript is the concept of ***closures***. When a function is created, it has access to a reference to all the variables declared around it, also known as it’s ***lexical environment***. The combination of the function and its enviroment is called a ***closure***. This is a powerful and often used feature of the language.</p><p>`function createAdder(a) {</p><p>. function f(b) {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>. }</p><p>. return f;</p><p>}</p><p>const f = createAdder(3);</p><p>console.log(f(4)); // 7`</p><p>In this example, `createAdder` passes the first parameter `a` and the inner function has access to it. This way, `createAdder` serves as a factory of new functions, with each returned function having different behavior.</p><p>### **Arrow Syntax**</p><p>The other common way to declare functions is with arrow syntax. In fact, on many projects, it is the preferred syntax.</p><p>### **Basic Syntax**</p><p>`const f = (a, b) =&gt; {</p><p>. const sum = a + b;</p><p>. return sum;</p><p>};</p><p>console.log(f(3, 4)); // 7`</p><p>In this example, `f` is the name of the function. `(a, b)` are the arguments. You can write any logic in the body and finally `return` a result. You are allowed to return nothing, and it will instead implicitly return `undefined`.</p><p>### **Omit Return**</p><p>If you can write the code in a single line, you can omit the `return` keyword. This can result in very short code.</p><p>`const f = (a, b) =&gt; a + b;</p><p>console.log(f(3, 4)); // 7`</p><p>### **Differences**</p><p>There are 3 major differences between arrow syntax and function syntax.</p><ol><li>More minimalistic syntax. This is especially true for anonymous functions and single-line functions. For this reason, this way is generally preferred when passing short anonymous functions to other functions.</li><li>2. No automatic hoisting. You are only allowed to use the function after it was declared. This is generally considered a good thing for readability.</li><li>3. Can’t be bound to `this`, `super`, and `arguments` or be used as a constructor. These are all complex topics in themselves but the basic takeaway should be that arrow functions are simpler in their feature set. You can read more about these differences [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions).</li></ol><p>The choice of arrow syntax versus function syntax is primarily down to preference and your project’s stylistic standards.</p><p>### **Rest Arguments**</p><p>You can use ***rest*** syntax to access all the passed arguments as an array. This isn’t necessary for this problem, but it will be a critical concept for many problems. You can read more about `…` syntax [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax).</p><p>### **Basic Syntax**</p><p>The syntax is:</p><p>`function f(…args) {</p><p>. const sum = args[0] + args[1];</p><p>. return sum;</p><p>}</p><p>console.log(f(3, 4)); // 7`</p><p>In this example the variable `args` is `[3, 4]`.</p><p>### **Why**</p><p>It may not be immediately obvious why you would use this syntax because you can always just pass an array and get the same result.</p><p>The primary use-case is for creating generic factory functions that accept any function as input and return a new version of the function with some specific modification.</p><p>By the way, a function that accepts a function and/or returns a function is called a ***higher-order function***, and they are very common in JavaScript.</p><p>For example, you can create a logged function factory:</p><p>`function log(inputFunction) {</p><p>. return function(…args) {</p><p>. console.log(“Input”, args);</p><p>. const result = inputFunction(…args);</p><p>. console.log(“Output”, result);</p><p>. return result;</p><p>. }</p><p>}</p><p>const f = log((a, b) =&gt; a + b);</p><p>f(1, 2); // Logs: Input [1, 2] Output 3`</p><p>– -</p><p>### **Solutions to Problem**</p><p>Now let’s apply these different ways of writing JavaScript functions to solve this problem.</p><p>### **Function Syntax**</p><p>### **Arrow Syntax**</p><p>### **Arrow Syntax + Rest Arguments**</p><p>JS Day 1 marks the beginning of our journey into the world of JavaScript, one of the most widely used programming languages in the world. On this day, we will start from the basics and cover fundamental concepts such as variables, data types, and basic syntax. We will also delve into more complex topics like functions and control flow. This day is crucial for building a strong foundation in JavaScript, so make sure to pay close attention and practice as much as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c1b074ef973" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>