<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mk Sharma</title>
    <description>The latest articles on DEV Community by Mk Sharma (@manish7107).</description>
    <link>https://dev.to/manish7107</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F431899%2Fe8a05386-4e54-428b-b42c-da2d97570c79.jpeg</url>
      <title>DEV Community: Mk Sharma</title>
      <link>https://dev.to/manish7107</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manish7107"/>
    <language>en</language>
    <item>
      <title>LazyDesk AI: Let Local AI Organize Your Messy Files While You Relax 📁🤖</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sun, 25 Oct 2026 12:23:04 +0000</pubDate>
      <link>https://dev.to/manish7107/lazydesk-ai-let-local-ai-organize-your-messy-files-while-you-relax-113m</link>
      <guid>https://dev.to/manish7107/lazydesk-ai-let-local-ai-organize-your-messy-files-while-you-relax-113m</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Meet &lt;strong&gt;LazyDesk AI&lt;/strong&gt; — a local-first AI file organizer designed for people who would rather spend their time building things than organizing folders.&lt;/p&gt;

&lt;p&gt;We all have that one Downloads folder. Random screenshots, receipts, duplicate photos, old documents, code snippets, and files named &lt;code&gt;final_v2_really_final.pdf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Organizing them manually is boring. So I built a tool to help automate the process.&lt;/p&gt;

&lt;p&gt;LazyDesk AI scans a folder you choose, analyzes supported files using a locally running AI model, suggests meaningful filenames and folder categories, detects exact duplicates, and lets you review and apply changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  What can it do?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🤖 &lt;strong&gt;Smart categorization:&lt;/strong&gt; Use local AI to suggest where files belong.&lt;/li&gt;
&lt;li&gt;✍️ &lt;strong&gt;Meaningful filenames:&lt;/strong&gt; Turn confusing filenames into descriptive alternatives.&lt;/li&gt;
&lt;li&gt;🔍 &lt;strong&gt;Duplicate detection:&lt;/strong&gt; Find byte-for-byte identical files using SHA-256 hashes.&lt;/li&gt;
&lt;li&gt;📋 &lt;strong&gt;Cleanup queue:&lt;/strong&gt; Review, edit, approve, or reject suggestions before making changes.&lt;/li&gt;
&lt;li&gt;⏪ &lt;strong&gt;Undo operations:&lt;/strong&gt; Restore files to their original locations using the operation journal.&lt;/li&gt;
&lt;li&gt;🛡️ &lt;strong&gt;Safe file handling:&lt;/strong&gt; Prevent path traversal, destination collisions, and silent overwrites.&lt;/li&gt;
&lt;li&gt;📴 &lt;strong&gt;Offline fallback:&lt;/strong&gt; Continue organizing files with a rule-based engine when Ollama is unavailable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is simple: &lt;strong&gt;less time managing files, more time doing meaningful work.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://drive.google.com/file/d/1r4-EX1Eo4WTLoXnJX1drzB0UMy-U__n9/view?usp=sharing" rel="noopener noreferrer"&gt;Demo Video Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fisfl5d088dtgn7ha080k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fisfl5d088dtgn7ha080k.png" alt="Live LazyDesk AI" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project also includes an interactive demo mode with sample unorganized files, so you can explore the workflow without starting with your personal files.&lt;/p&gt;

&lt;p&gt;The ideal workflow is straightforward:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select a folder.&lt;/li&gt;
&lt;li&gt;Scan its contents.&lt;/li&gt;
&lt;li&gt;Let the local AI generate organization suggestions.&lt;/li&gt;
&lt;li&gt;Review and approve the proposed changes.&lt;/li&gt;
&lt;li&gt;Apply the changes and undo them if necessary.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub repository:&lt;/strong&gt; &lt;a href="https://github.com/manish7017/LazyDesk-AI" rel="noopener noreferrer"&gt;click&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is released under the MIT License.&lt;/p&gt;

&lt;p&gt;Contributions, bug reports, feature ideas, and improvements to the safety mechanisms are welcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;LazyDesk AI is a full-stack application built around local AI inference rather than a cloud-based AI API.&lt;/p&gt;

&lt;h3&gt;
  
  
  The tech stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; React 19, TypeScript, Vite, Tailwind CSS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Node.js, Express, TypeScript&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; SQLite with Better-SQLite3&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI inference:&lt;/strong&gt; Ollama and configurable open-weight models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validation:&lt;/strong&gt; Zod&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing:&lt;/strong&gt; Vitest, React Testing Library, and Supertest&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Ollama?
&lt;/h3&gt;

&lt;p&gt;Ollama provides a straightforward way to run compatible language models locally and communicate with them through an API.&lt;/p&gt;

&lt;p&gt;LazyDesk AI uses Ollama's Chat API to analyze supported document content and generate structured organization suggestions. The application validates model responses before using them.&lt;/p&gt;

&lt;p&gt;The AI can recommend a category, destination folder, filename, explanation, and confidence score.&lt;/p&gt;

&lt;p&gt;Importantly, the model doesn't get to execute its recommendations directly. The application validates paths, checks for collisions, and requires user approval before applying file operations.&lt;/p&gt;

&lt;p&gt;If Ollama is unavailable, the rule-based categorization engine keeps the core organization workflow usable.&lt;/p&gt;

&lt;p&gt;This means the application isn't completely dependent on a running language model to remain useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;For this project, open innovation isn't just about using a different AI provider. It changes where the computation happens and who controls the data.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Your files stay on your machine
&lt;/h3&gt;

&lt;p&gt;File organization can involve private documents, financial receipts, personal notes, and work-related information.&lt;/p&gt;

&lt;p&gt;Sending those files to an external AI API introduces a dependency on another company's infrastructure and data-handling policies.&lt;/p&gt;

&lt;p&gt;With LazyDesk AI, the intended default is local processing. Supported document content is analyzed through a local Ollama service instead of a paid cloud inference API.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. No paid inference API is required
&lt;/h3&gt;

&lt;p&gt;Once the application dependencies and model weights are installed, local inference doesn't require purchasing cloud API tokens.&lt;/p&gt;

&lt;p&gt;The trade-off is that local inference still consumes your computer's CPU, memory, and potentially GPU resources. Model downloads and initial setup also require connectivity unless everything is already available locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Freedom to experiment with models
&lt;/h3&gt;

&lt;p&gt;Different models can behave differently when categorizing documents or generating filenames.&lt;/p&gt;

&lt;p&gt;By making the model configurable, LazyDesk AI allows experimentation with compatible local models without tying the application to one proprietary inference service.&lt;/p&gt;

&lt;p&gt;Model licensing varies, so open-weight availability should not be confused with every model having the same open-source license.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Automation without surrendering control
&lt;/h3&gt;

&lt;p&gt;Open AI makes experimentation more accessible, but automation still needs safeguards.&lt;/p&gt;

&lt;p&gt;LazyDesk AI treats file contents as untrusted input, validates model output, checks destination paths, and records file operations for recovery.&lt;/p&gt;

&lt;p&gt;The model proposes. The application validates. The user decides.&lt;/p&gt;

&lt;p&gt;That separation matters when AI is working with real files instead of generating text in a chat window.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;p&gt;The real payoff is reducing the repetitive decisions involved in maintaining a digital workspace.&lt;/p&gt;

&lt;p&gt;Instead of manually opening documents, guessing where they belong, renaming them, and searching for duplicates, users can review a batch of suggestions in one place.&lt;/p&gt;

&lt;p&gt;I also focused on making the cleanup process reversible. Automation is much easier to trust when you can inspect its actions and recover from mistakes.&lt;/p&gt;

&lt;p&gt;I haven't established a measured time-saving figure yet, so I won't claim that the application saves a specific number of minutes or hours. That would require testing it against a real folder and comparing the results with manual organization.&lt;/p&gt;

&lt;p&gt;For now, the goal is to make file cleanup less tedious, safer, and easier to repeat.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing and Safety
&lt;/h2&gt;

&lt;p&gt;File organization software can cause real problems if it moves or overwrites the wrong files. Safety therefore had to be part of the implementation rather than an afterthought.&lt;/p&gt;

&lt;p&gt;LazyDesk AI includes safeguards for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restricting scans and destinations to permitted workspace boundaries.&lt;/li&gt;
&lt;li&gt;Avoiding symbolic links that escape the selected workspace.&lt;/li&gt;
&lt;li&gt;Rejecting invalid filenames and unsafe paths.&lt;/li&gt;
&lt;li&gt;Detecting destination conflicts before applying changes.&lt;/li&gt;
&lt;li&gt;Preventing silent file overwrites.&lt;/li&gt;
&lt;li&gt;Avoiding automatic deletion of duplicate files.&lt;/li&gt;
&lt;li&gt;Recording operations in a persistent SQLite journal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The project README reports &lt;strong&gt;42 passing tests&lt;/strong&gt;, covering important safety checks, duplicate detection, AI response validation, API behavior, and rollback scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The best automation isn't always the most complicated one. Sometimes, it's the tool that quietly takes an annoying task off your plate.&lt;/p&gt;

&lt;p&gt;LazyDesk AI explores how locally run AI can make everyday computer maintenance more convenient without requiring users to hand their files over to a cloud service.&lt;/p&gt;

&lt;p&gt;The broader idea is simple: open AI should give people more control over their tools, not just another place to send prompts.&lt;/p&gt;

&lt;p&gt;Build less busywork. Keep control of your data. Let your computer do the boring stuff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's my version of Slow and Steady.&lt;/strong&gt; 🦥&lt;/p&gt;

&lt;p&gt;If you try the project, I'd love to hear what you'd improve, which local models work best for your files, and what other repetitive tasks you'd like to automate.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>LocalLedger AI: A Private, Open-Source AI Bookkeeper for Freelancers</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sun, 18 Oct 2026 18:12:38 +0000</pubDate>
      <link>https://dev.to/manish7107/localledger-ai-a-private-open-source-ai-bookkeeper-for-freelancers-37je</link>
      <guid>https://dev.to/manish7107/localledger-ai-a-private-open-source-ai-bookkeeper-for-freelancers-37je</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week2-2026-10-12"&gt;Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Meet &lt;strong&gt;LocalLedger AI&lt;/strong&gt; — a local-first, open-source AI finance document assistant designed for freelancers, independent contractors, consultants, and small businesses.&lt;/p&gt;

&lt;p&gt;Freelancers regularly deal with receipts, invoices, subscription bills, and expense records. Manually entering every transaction into a spreadsheet is tedious, and uploading sensitive financial documents to cloud services isn't always desirable.&lt;/p&gt;

&lt;p&gt;I built LocalLedger AI to make that workflow easier.&lt;/p&gt;

&lt;p&gt;With LocalLedger AI, users can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload invoices, receipts, and bills in PDF or image formats.&lt;/li&gt;
&lt;li&gt;Extract text using PDF parsing and local OCR.&lt;/li&gt;
&lt;li&gt;Use AI to turn extracted text into structured financial records.&lt;/li&gt;
&lt;li&gt;Review and correct extracted information before confirming records.&lt;/li&gt;
&lt;li&gt;Detect potential duplicate documents.&lt;/li&gt;
&lt;li&gt;Categorize expenses using configurable rules and AI.&lt;/li&gt;
&lt;li&gt;Track expenses across multiple currencies without combining unlike currencies.&lt;/li&gt;
&lt;li&gt;Export expenses to CSV and back up records as JSON.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is simple: &lt;strong&gt;spend less time organizing financial paperwork and more time doing the work that generates income.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Who would pay for it?
&lt;/h3&gt;

&lt;p&gt;The initial target customers are freelancers and independent consultants who manage their own paperwork, along with small businesses that need a lightweight expense-management workflow.&lt;/p&gt;

&lt;p&gt;Potential paid features include batch processing, advanced reports, custom categorization rules, and bookkeeper-friendly exports.&lt;/p&gt;

&lt;p&gt;These are monetization hypotheses, not validated sales. The next step is to put the application in front of real users and learn which features are valuable enough to pay for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Local demo:&lt;/strong&gt; Run the application locally and open &lt;code&gt;http://localhost:5173&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1957v9o56j3a9i0xlq6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1957v9o56j3a9i0xlq6u.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project includes a three-minute demonstration workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Upload an invoice or receipt.&lt;/li&gt;
&lt;li&gt;Extract and inspect the financial information.&lt;/li&gt;
&lt;li&gt;Review the extracted fields and any calculation discrepancies.&lt;/li&gt;
&lt;li&gt;Confirm the record.&lt;/li&gt;
&lt;li&gt;View it in the expense ledger.&lt;/li&gt;
&lt;li&gt;Export the expenses to CSV.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For setup instructions, see the &lt;a href="https://github.com/manish7017/LocalLedger-AI-Local-First-AI-Finance-Document-Assistant/blob/main/README.md" rel="noopener noreferrer"&gt;project README&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Live deployment or video demo: Add your verified public demo link here.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub repository:&lt;/strong&gt; &lt;a href="https://github.com/manish7017/LocalLedger-AI-Local-First-AI-Finance-Document-Assistant" rel="noopener noreferrer"&gt;LocalLedger AI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LocalLedger AI is released under the MIT License.&lt;/p&gt;

&lt;p&gt;The project uses React, TypeScript, Vite, Tailwind CSS, Fastify, Prisma, SQLite, local OCR, and a modular AI provider architecture.&lt;/p&gt;

&lt;p&gt;The codebase also includes automated tests covering financial calculations, extraction schemas, AI provider behavior, data backup, CSV safety, and API workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;I wanted to build something where open-source AI wasn't just an optional feature added to a conventional application. It needed to be a meaningful part of the product's value.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Local document processing
&lt;/h3&gt;

&lt;p&gt;The application accepts PDF and image documents. It extracts native text from digital PDFs using &lt;code&gt;pdf-parse&lt;/code&gt; and uses Tesseract.js for local OCR where supported.&lt;/p&gt;

&lt;p&gt;This creates a structured text-processing pipeline before the document reaches the AI layer.&lt;/p&gt;

&lt;p&gt;Scanned, image-only PDFs require additional rendering before OCR, which is documented as a limitation.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. A pluggable AI architecture
&lt;/h3&gt;

&lt;p&gt;I designed the application around multiple AI providers rather than tying the entire product to a single API.&lt;/p&gt;

&lt;p&gt;The current architecture includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ollama:&lt;/strong&gt; For locally running open-weight models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI-compatible endpoints:&lt;/strong&gt; For compatible self-hosted inference services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI, Google Gemini, and Anthropic:&lt;/strong&gt; Optional cloud provider integrations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demo provider:&lt;/strong&gt; For deterministic demonstrations and development without downloading model weights.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach makes it possible to select an inference setup based on available hardware, privacy requirements, cost, and model capabilities.&lt;/p&gt;

&lt;p&gt;The documented Ollama examples include &lt;code&gt;gemma2:2b&lt;/code&gt;, &lt;code&gt;gemma2:9b&lt;/code&gt;, &lt;code&gt;llama3.2:1b&lt;/code&gt;, and &lt;code&gt;qwen2.5:1.5b&lt;/code&gt;. The application checks relevant model capabilities instead of assuming that every model supports vision or structured output.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Deterministic financial validation
&lt;/h3&gt;

&lt;p&gt;An LLM can extract information, but it shouldn't be trusted to perform authoritative financial calculations.&lt;/p&gt;

&lt;p&gt;I used &lt;code&gt;decimal.js&lt;/code&gt; for precise monetary arithmetic and implemented deterministic checks for relationships such as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Subtotal + Tax − Discount = Total&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When values don't match, the application flags the discrepancy so the user can review it.&lt;/p&gt;

&lt;p&gt;The system also checks for potential duplicates using SHA-256 file hashes and merchant/invoice-number combinations.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. A review-first workflow
&lt;/h3&gt;

&lt;p&gt;AI-extracted information is not automatically treated as a finalized financial record.&lt;/p&gt;

&lt;p&gt;Users can inspect the original document alongside the extracted fields, correct values, review warnings, and confirm the record before it becomes part of the authoritative ledger.&lt;/p&gt;

&lt;p&gt;This is important because financial documents may contain ambiguous dates, unreadable values, inconsistent totals, or missing information.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Practical safeguards
&lt;/h3&gt;

&lt;p&gt;I also implemented CSV formula-injection defenses, validated JSON backup and import, and separate handling for different currencies.&lt;/p&gt;

&lt;p&gt;The project currently has 27 documented passing tests across seven test files, covering core financial logic, provider behavior, imports and exports, and API workflows.&lt;/p&gt;

&lt;p&gt;The test suite includes a live Ollama connectivity check that can skip when the local service is unavailable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;For LocalLedger AI, open innovation is about control over both the technology and the data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy and local processing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When users select a compatible local model and enable Local-Only Mode, the application is designed to avoid sending financial documents to external AI providers.&lt;/p&gt;

&lt;p&gt;Receipts and invoices can contain names, addresses, transaction details, and other sensitive information. Keeping AI inference local gives users an alternative to uploading these documents to a commercial AI API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Freedom to choose models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Different users have different hardware and performance requirements. A user with limited resources might choose a small model, while someone with more capable hardware might prefer a larger one.&lt;/p&gt;

&lt;p&gt;The provider abstraction also allows compatible self-hosted endpoints and optional cloud models without redesigning the entire application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost control&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Local inference can reduce per-document API charges when users already have suitable hardware. However, local inference still has hardware, electricity, and maintenance costs, and cloud APIs may be more practical for some workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Less dependence on one provider&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A financial document assistant shouldn't have its entire architecture determined by one vendor's API, pricing, or model availability.&lt;/p&gt;

&lt;p&gt;A modular provider design makes it easier to experiment, switch models, and evaluate different inference options.&lt;/p&gt;

&lt;p&gt;Open innovation doesn't automatically make a model more accurate or secure. Those properties still require testing. Its value here is that users and developers gain more control over how the system operates.&lt;/p&gt;

&lt;h2&gt;
  
  
  My First User
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;This section is intentionally omitted until a real person has tested the application.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;My next step is to get LocalLedger AI into the hands of freelancers or independent consultants who regularly handle invoices and receipts.&lt;/p&gt;

&lt;p&gt;I want to learn how accurately it extracts their documents, how much manual correction is required, and whether it saves enough time to justify paying for the workflow.&lt;/p&gt;

&lt;p&gt;I'll add actual feedback and outcomes here after testing with a real user.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The current focus is making the core workflow reliable: document ingestion, extraction, validation, review, storage, and export.&lt;/p&gt;

&lt;p&gt;Next, I want to test the application with real freelancers, measure how much manual work it eliminates, improve extraction quality on difficult receipts, and validate which features users would actually pay for.&lt;/p&gt;

&lt;p&gt;If you work independently and spend too much time organizing receipts, I'd be interested in hearing how you currently handle that process and what you'd want a tool like this to do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/manish7017/LocalLedger-AI-Local-First-AI-Finance-Document-Assistant" rel="noopener noreferrer"&gt;LocalLedger AI on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built for the Hacktoberfest Open-Source AI Challenge — Week 2: Side Hustle.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>ai</category>
    </item>
    <item>
      <title>🌿 WildLens: An Open-Source AI Companion That Gets You Outside</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sat, 10 Oct 2026 16:30:00 +0000</pubDate>
      <link>https://dev.to/manish7107/wildlens-an-open-source-ai-companion-that-gets-you-outside-2b4b</link>
      <guid>https://dev.to/manish7107/wildlens-an-open-source-ai-companion-that-gets-you-outside-2b4b</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week1-2026-10-05"&gt;Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;WildLens is an outdoor-first AI nature companion designed to make exploring the real world more interesting than staring at a screen.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We have AI that can answer almost any question, but most AI experiences keep us sitting in front of a screen. I wanted to explore a different idea: what if AI helped us put our phones away and pay more attention to the world around us?&lt;/p&gt;

&lt;p&gt;That's the idea behind WildLens.&lt;/p&gt;

&lt;p&gt;WildLens helps hikers, nature enthusiasts, birdwatchers, gardeners, and curious beginners explore the natural world with assistance from Gemma 4.&lt;/p&gt;

&lt;p&gt;The experience revolves around three core modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌲 &lt;strong&gt;Explore:&lt;/strong&gt; Discover daily outdoor challenges, follow nature quests, and learn about different habitats through short AI-generated briefings.&lt;/li&gt;
&lt;li&gt;📷 &lt;strong&gt;Identify:&lt;/strong&gt; Capture or upload an image of a plant, bird, insect, fungus, or natural object to get identification assistance, confidence information, safety warnings, and suggestions about what to observe next.&lt;/li&gt;
&lt;li&gt;📖 &lt;strong&gt;Journal:&lt;/strong&gt; Record nature observations, save photographs, and build a personal field journal without depending on an external cloud service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the most important feature isn't identification. It's the interaction philosophy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WildLens is designed so that the screen is the shortest part of the experience.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of endless AI conversations, feeds, and notifications, it encourages short interactions followed by real-world exploration. The goal is to help people observe more, learn more, and spend more time outdoors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;🎥 &lt;strong&gt;Video Demo:&lt;/strong&gt; &lt;a href="https://drive.google.com/file/d/1IeMgNmI4j_lUZJDbzaVST84AJ1esU1L6/view?usp=sharing" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fys13pmx0kn52s9y1bpc1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fys13pmx0kn52s9y1bpc1.png" alt=" " width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The demo should show the core journey: open WildLens, explore an outdoor challenge, identify a natural object, read the safety guidance, and save the observation in the field journal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/manish7017/WildLens.git" rel="noopener noreferrer"&gt;repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repository includes the application source, setup instructions, and project documentation.&lt;/p&gt;

&lt;p&gt;I want WildLens to be something other developers can inspect, run, improve, and adapt—not just another AI-powered interface hidden behind a proprietary API.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;WildLens is built with a web-first architecture and an open-AI-first approach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technology stack&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React 19 + Vite 6:&lt;/strong&gt; Application interface and development environment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript:&lt;/strong&gt; Type-safe application logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tailwind CSS 3:&lt;/strong&gt; Responsive layouts and dedicated nature, direct-sunlight, and twilight display modes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemma 4:&lt;/strong&gt; The intended core AI model for nature guidance and identification, subject to the capabilities of the selected model variant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ollama:&lt;/strong&gt; Local model serving for supported environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IndexedDB / browser-local storage:&lt;/strong&gt; Local-first persistence for observations and journal data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web APIs:&lt;/strong&gt; Camera access, geolocation, device orientation, speech synthesis, and procedural audio where supported.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Designing for the outdoors
&lt;/h3&gt;

&lt;p&gt;I designed the interface around three principles:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Glance, act, and put the phone away.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Large touch targets, readable typography, concise AI responses, and simple navigation minimize the effort required to use the app outdoors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Make exploration the reward.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Daily challenges such as a canopy scan, listening for bird calls, or observing different types of lichen give users a reason to leave the interface and interact with their surroundings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Treat privacy as a design requirement.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Nature observations and location information can be sensitive. WildLens is designed to keep personal field notes on the device, avoid continuous background GPS tracking, and offer location privacy controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Putting open AI at the center
&lt;/h3&gt;

&lt;p&gt;The central technical goal is to run the AI locally through Gemma 4, using a compatible local inference setup rather than making a closed, cloud-hosted AI API the foundation of the experience.&lt;/p&gt;

&lt;p&gt;That architecture is important because a nature companion should remain useful when a trail has no mobile coverage.&lt;/p&gt;

&lt;p&gt;The intended flow is straightforward:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user captures or selects an image.&lt;/li&gt;
&lt;li&gt;The application passes the image and a focused prompt to the locally served model.&lt;/li&gt;
&lt;li&gt;The model returns a concise identification or observation guide.&lt;/li&gt;
&lt;li&gt;The interface displays relevant uncertainty and safety information.&lt;/li&gt;
&lt;li&gt;The user saves the observation locally and returns to exploring.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Actual image-understanding support, memory requirements, inference speed, and offline behavior depend on the chosen Gemma 4 variant and runtime configuration. The application should communicate uncertainty instead of presenting model predictions as guaranteed scientific identifications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;For WildLens, open innovation isn't just a licensing preference. It influences the product's architecture and the kind of experience it can offer.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Nature doesn't always have an internet connection
&lt;/h3&gt;

&lt;p&gt;A closed, cloud-only AI service makes connectivity part of the user experience. That's a poor fit for remote trails, campsites, and other places with unreliable reception.&lt;/p&gt;

&lt;p&gt;With locally hosted open-weight models, compatible hardware can perform inference without sending every observation to a remote AI service.&lt;/p&gt;

&lt;p&gt;The goal is simple: &lt;strong&gt;the environment shouldn't determine whether you can use your nature companion.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Local inference does require the model and its dependencies to be installed beforehand, and supported hardware must have enough memory and processing capacity.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Your observations should remain yours
&lt;/h3&gt;

&lt;p&gt;A field journal can reveal where someone hikes, where rare plants grow, and where wildlife gathers.&lt;/p&gt;

&lt;p&gt;A local-first design allows users to retain observations on their own devices without requiring an external database for core journaling. Combined with local inference, this reduces the need to transmit personal photographs and location information to third-party servers.&lt;/p&gt;

&lt;p&gt;That matters especially when documenting sensitive habitats or endangered species.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Developers can change the intelligence
&lt;/h3&gt;

&lt;p&gt;Open-weight models and open-source tooling give developers greater control over the system.&lt;/p&gt;

&lt;p&gt;The model-serving layer can be designed to support compatible model alternatives. Developers can experiment with prompts, response formats, safety instructions, and model variants without rebuilding the entire application around a single proprietary API.&lt;/p&gt;

&lt;p&gt;For WildLens, this means the community can investigate better identification workflows, more useful habitat briefings, and more efficient local inference.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Lower barriers to experimentation
&lt;/h3&gt;

&lt;p&gt;Cloud AI APIs can introduce usage-based costs, rate limits, and dependency on a service provider. Local inference shifts the trade-off toward hardware requirements and local resource consumption.&lt;/p&gt;

&lt;p&gt;For a project intended for learning, experimentation, and community contributions, this makes the underlying system more inspectable and adaptable.&lt;/p&gt;

&lt;p&gt;There is no claim that local inference is universally faster or cheaper: that depends on the hardware, model size, and workload. Its strongest advantages here are control, privacy, and the potential for disconnected operation.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Open innovation makes the project extensible
&lt;/h3&gt;

&lt;p&gt;WildLens could eventually support specialized models for bird calls, plant identification, or habitat analysis. Different models could handle different tasks while the same outdoor-first interface remains intact.&lt;/p&gt;

&lt;p&gt;That is the broader opportunity: build a useful open foundation and let the community improve it for different environments, devices, and use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;p&gt;[Add your DevRelay agent session URL or embed your saved agent session here.]&lt;/p&gt;

&lt;p&gt;This section can document how the agent helped build WildLens, from defining the outdoor-first interaction model to implementing the application and integrating local AI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Open-Source AI / Touch Grass:&lt;/strong&gt; Core project submission.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;[Add any applicable partner-specific prize categories only if the project meets their eligibility requirements.]&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;WildLens is an exploration of a different relationship between people and AI.&lt;/p&gt;

&lt;p&gt;Instead of building another tool that competes for attention, I want to build one that helps people notice things they would otherwise walk past: a bird call in a tree, a pattern on a leaf, a patch of lichen on a rock, or a change in the landscape.&lt;/p&gt;

&lt;p&gt;Open AI makes that vision more adaptable, privacy-conscious, and potentially useful beyond reliable internet connections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The best outcome isn't more time spent using WildLens. It's more time spent exploring the world because of it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🌿 Build openly. Explore outdoors. Touch grass.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>🎙️ I Built a Local AI Transcriber for a Friend Who Works With Too Much Audio and Video</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sat, 03 Oct 2026 16:48:32 +0000</pubDate>
      <link>https://dev.to/manish7107/i-built-a-local-ai-transcriber-for-a-friend-who-works-with-too-much-audio-and-video-1h2g</link>
      <guid>https://dev.to/manish7107/i-built-a-local-ai-transcriber-for-a-friend-who-works-with-too-much-audio-and-video-1h2g</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-weekend-2026-10-01"&gt;Hacktoberfest Weekend Challenge: Build for a Friend&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;Whisper AI &amp;amp; FFmpeg Media Transcriber&lt;/strong&gt;, a web application that turns audio and video files into timestamped transcripts and subtitles.&lt;/p&gt;

&lt;p&gt;I built it for friend, who regularly has to deal with &lt;strong&gt;recorded meetings / lectures / interview sessions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The problem was simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They had useful information trapped inside audio and video, but getting that information into searchable, readable text was slow and annoying.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead of requiring them to manually listen through recordings and take notes, I built a tool that can process the media and produce a synchronized transcript.&lt;/p&gt;

&lt;p&gt;The application supports both audio and video files. For video, FFmpeg extracts and normalizes the audio into the 16 kHz, 16-bit mono PCM format expected by Whisper before sending it through the speech-to-text pipeline.&lt;/p&gt;

&lt;p&gt;It supports formats including MP4, MKV, MOV, WebM, AVI, MP3, WAV, M4A, FLAC, OGG, AAC, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it can do
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🎥 Transcribe video files&lt;/li&gt;
&lt;li&gt;🎙️ Transcribe audio files&lt;/li&gt;
&lt;li&gt;🎤 Record directly from the browser microphone&lt;/li&gt;
&lt;li&gt;🌍 Automatically detect speech across 99+ languages&lt;/li&gt;
&lt;li&gt;🔄 Translate speech into English&lt;/li&gt;
&lt;li&gt;⏱️ Generate timestamped transcripts&lt;/li&gt;
&lt;li&gt;▶️ Synchronize transcript segments with media playback&lt;/li&gt;
&lt;li&gt;🔎 Click a transcript timestamp to seek directly to that part of the recording&lt;/li&gt;
&lt;li&gt;📝 Export transcripts as &lt;code&gt;.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;🎬 Export subtitles as &lt;code&gt;.srt&lt;/code&gt; and &lt;code&gt;.vtt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;📦 Export detailed transcription data as &lt;code&gt;.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;🎧 Export extracted audio as &lt;code&gt;.wav&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The interface also highlights the current transcript segment while the media is playing, making it possible to follow the transcript along with the recording.&lt;/p&gt;

&lt;p&gt;I also added preloaded demo media so someone can try the application without first finding an audio or video file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Demo Video:&lt;/strong&gt; &lt;a href="https://drive.google.com/file/d/1roGknFNV10oSSND33uHh27TNHGQDOmov/view?usp=drivesdk" rel="noopener noreferrer"&gt;Click&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interface:&lt;/strong&gt; &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffeyfwndzm346m43nbann.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffeyfwndzm346m43nbann.png" alt="Interface" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The basic flow is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Upload/record → FFmpeg processing → Whisper transcription → timestamped transcript → synchronized playback/export&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/manish7017/Whisper-FFmpeg-Transcriber-.git" rel="noopener noreferrer"&gt;repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is open source under the MIT License and is free to modify.&lt;/p&gt;

&lt;p&gt;The project is structured around a FastAPI backend, FFmpeg media processing, Whisper inference, asynchronous task management, and a browser-based interface.&lt;/p&gt;

&lt;p&gt;The main components include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ffmpeg_utils.py&lt;/code&gt; — media probing and audio extraction&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;whisper_service.py&lt;/code&gt; — Whisper inference, caching, and subtitle generation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;task_manager.py&lt;/code&gt; — asynchronous task state and Server-Sent Events&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;main.py&lt;/code&gt; — API routes and media streaming&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app.js&lt;/code&gt; — client-side media synchronization and player logic&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.html&lt;/code&gt; — the web dashboard&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The full project structure is documented in the repository README.&lt;/p&gt;
&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;The core AI component is &lt;strong&gt;OpenAI Whisper&lt;/strong&gt;, an open-source speech recognition model.&lt;/p&gt;

&lt;p&gt;I wanted the AI to be an actual part of the application rather than simply calling a closed transcription API.&lt;/p&gt;

&lt;p&gt;The processing pipeline looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 User Upload / Microphone
                          │
                          ▼
                    Media Probe
                      FFprobe
                          │
              ┌───────────┴───────────┐
              ▼                       ▼
           Video                    Audio
              │                       │
              ▼                       ▼
        FFmpeg Extraction       FFmpeg Normalization
              │                       │
              └───────────┬───────────┘
                          ▼
                 16 kHz Mono WAV
                          │
                          ▼
                    Whisper Model
                          │
                          ▼
             Timestamped Transcription
                          │
            ┌─────────────┼─────────────┐
            ▼             ▼             ▼
       Web Player      Full Text     SRT / VTT / JSON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project uses FFmpeg to normalize the input audio and Whisper to perform speech recognition.&lt;/p&gt;

&lt;h3&gt;
  
  
  Whisper models
&lt;/h3&gt;

&lt;p&gt;The application supports multiple Whisper model sizes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;tiny&lt;/code&gt; — optimized for speed&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;base&lt;/code&gt; — balanced option&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;small&lt;/code&gt; — higher accuracy&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;medium&lt;/code&gt; — larger model for more demanding transcription&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This gives the user a choice between processing speed and transcription quality.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-time progress
&lt;/h3&gt;

&lt;p&gt;Long-running transcription shouldn't feel like a frozen webpage.&lt;/p&gt;

&lt;p&gt;So I added Server-Sent Events to stream task progress back to the browser. The UI can show the different stages of the pipeline while processing is happening.&lt;/p&gt;

&lt;p&gt;The backend exposes endpoints for starting transcription jobs, checking task status, streaming progress events, accessing media, exporting transcripts, and listing available Whisper models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;This is probably the most important part of the project for me.&lt;/p&gt;

&lt;p&gt;A transcription application can be built by sending every recording to a closed AI API.&lt;/p&gt;

&lt;p&gt;But that would change the nature of the tool.&lt;/p&gt;

&lt;p&gt;Audio and video can contain extremely personal information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;private conversations&lt;/li&gt;
&lt;li&gt;meetings&lt;/li&gt;
&lt;li&gt;interviews&lt;/li&gt;
&lt;li&gt;lectures&lt;/li&gt;
&lt;li&gt;family recordings&lt;/li&gt;
&lt;li&gt;voice messages&lt;/li&gt;
&lt;li&gt;work-related information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With an open model such as Whisper, the application can be built around &lt;strong&gt;local inference instead of requiring every recording to leave the user's machine&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That gives the project a very different privacy model.&lt;/p&gt;

&lt;p&gt;The user can run the application locally with Python, FFmpeg, and the required dependencies. The documented setup runs the application locally through Uvicorn on &lt;code&gt;localhost:8000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That also means the AI layer isn't locked to a single hosted API.&lt;/p&gt;

&lt;p&gt;Because the model is available locally, the application can expose different model sizes and let users choose how they want to trade off speed and accuracy.&lt;/p&gt;

&lt;p&gt;That's the part of open innovation that mattered most for this project:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;the AI isn't just an external service that the application talks to. The AI model is part of the application itself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open-source software also made it possible to combine different pieces of the stack:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whisper + FFmpeg + FastAPI + browser APIs + SSE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;and build the exact workflow needed instead of adapting the project around the limitations of one closed API.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Building this project also made me think differently about AI applications.&lt;/p&gt;

&lt;p&gt;The interesting part isn't always the model.&lt;/p&gt;

&lt;p&gt;The model is only one component.&lt;/p&gt;

&lt;p&gt;A useful AI product needs everything around it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input
  ↓
Media processing
  ↓
Model inference
  ↓
Task management
  ↓
Progress reporting
  ↓
Result formatting
  ↓
User interface
  ↓
Export / reuse
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whisper handles the speech recognition, but FFmpeg makes the media usable, the backend manages the processing pipeline, SSE communicates progress, and the frontend turns the result into something a person can actually use.&lt;/p&gt;

&lt;p&gt;That combination is what turned an AI model into a real application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This project started with a simple idea:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take something a friend struggles with and remove the annoying part.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The result is a local AI transcription application that can take audio or video, process it through an open speech-recognition model, synchronize the resulting transcript with the original media, and export the result in formats that can actually be reused.&lt;/p&gt;

&lt;p&gt;For me, that's the interesting thing about open AI.&lt;/p&gt;

&lt;p&gt;It's not just about having access to a model.&lt;/p&gt;

&lt;p&gt;It's about being able to take the model, understand how it fits into a larger system, change the surrounding workflow, run it locally, and build something that solves a real person's problem.&lt;/p&gt;

&lt;p&gt;And this time, I built it for a friend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Built with ❤️, Whisper, FFmpeg, Python, and open-source innovation.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
      <category>hf26challenge</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building an Online Restaurant Service REST API with Node.js and MongoDB</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sat, 16 Mar 2024 15:29:57 +0000</pubDate>
      <link>https://dev.to/manish7107/building-an-online-restaurant-service-rest-api-with-nodejs-and-mongodb-691</link>
      <guid>https://dev.to/manish7107/building-an-online-restaurant-service-rest-api-with-nodejs-and-mongodb-691</guid>
      <description>&lt;p&gt;In the realm of modern dining experiences, online restaurant services have become a staple for convenience and accessibility. Imagine a scenario where you could manage product listings, handle orders seamlessly, and maintain a database of customer interactions—all through a robust and efficient REST API. This article will delve into creating such an API using Node.js, Express.js, and MongoDB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Project
&lt;/h2&gt;

&lt;p&gt;Our project centres around a hypothetical online restaurant service. Here are the key features it offers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CRUD Operations for Products:&lt;/strong&gt; Users can perform Create, Read, Update, and Delete operations on product information, including details like name, price, and description.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Order Placement:&lt;/strong&gt; Customers can place orders for products, providing essential information such as their name, email, and selected items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Order Listing:&lt;/strong&gt; The API includes endpoints to list all orders placed within the system.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Technologies Used
&lt;/h2&gt;

&lt;p&gt;Before diving into the code, let's take a moment to understand the technologies powering our REST API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node.js:&lt;/strong&gt; This serves as our backend runtime environment, allowing us to execute JavaScript code outside the browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Express.js:&lt;/strong&gt; A minimalist web framework for Node.js, Express.js simplifies handling HTTP requests, defining routes, and managing middleware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MongoDB:&lt;/strong&gt; A NoSQL database used to store both product and order data, offering flexibility and scalability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mongoose:&lt;/strong&gt; A MongoDB object modeling library for Node.js that streamlines interactions with the database, providing schema-based solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RESTful Architecture:&lt;/strong&gt; Following REST principles ensures our API is designed for scalability, maintainability, and uniformity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Git &amp;amp; GitHub:&lt;/strong&gt; Utilized for version control and collaborative development, making it easier to manage and track changes in the project.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting Up the Project
&lt;/h2&gt;

&lt;p&gt;To get started with our Online Restaurant Service REST API, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clone the Repository:&lt;/strong&gt; Clone the project repository to your local machine to access the codebase. &lt;a href="https://github.com/manish7017/restaurant_service"&gt;Click Here&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install Node.js and npm:&lt;/strong&gt; Ensure Node.js and npm (Node Package Manager) are installed on your machine. These tools are essential for running JavaScript applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install Dependencies:&lt;/strong&gt; Navigate to the project directory in your terminal and run &lt;code&gt;npm install&lt;/code&gt; to install all project dependencies listed in the &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Start the Server:&lt;/strong&gt; Once dependencies are installed, start the server by running &lt;code&gt;node server.js&lt;/code&gt; in the terminal. This command will launch the API and make it available for incoming requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Testing with Postman:&lt;/strong&gt; Use tools like Postman to send requests to the API endpoints. You can perform CRUD operations on products, place orders, and list orders to test the functionality of the API thoroughly.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Understanding the Code
&lt;/h2&gt;

&lt;p&gt;Now, let's dissect the code snippets provided to gain a deeper understanding of how our Online Restaurant Service REST API is structured and implemented.&lt;/p&gt;

&lt;h3&gt;
  
  
  Middleware Setup
&lt;/h3&gt;

&lt;p&gt;We begin by importing necessary modules such as Express.js, body-parser for parsing incoming request bodies, cors for handling Cross-Origin Resource Sharing, and mongoose for MongoDB interactions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bodyParser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body-parser&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cors&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mongoose&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;bodyParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cors&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  MongoDB Connection
&lt;/h3&gt;

&lt;p&gt;Next, we establish a connection to MongoDB using Mongoose, specifying the database URL (&lt;code&gt;mongodb://localhost:27017/restaurant_db&lt;/code&gt;), and handling connection errors and successes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mongodb://localhost:27017/restaurant_db&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;useNewUrlParser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;useUnifiedTopology&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;MongoDB connection error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;once&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;open&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Connected to MongoDB&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Data Models
&lt;/h3&gt;

&lt;p&gt;We define two data models using Mongoose schemas: &lt;code&gt;Product&lt;/code&gt; for managing product information and &lt;code&gt;Order&lt;/code&gt; for handling order details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;productSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Product&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;productSchema&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;orderSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;products&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Types&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ObjectId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Product&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;totalPrice&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;customerName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;customerEmail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Order&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;orderSchema&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  API Endpoints
&lt;/h3&gt;

&lt;p&gt;Our API includes several endpoints for managing products and orders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Product Operations:&lt;/strong&gt; Create a new product, retrieve all products, update a product, and delete a product.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// New product&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// All products&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Update a product&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/products/:id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Remove a product&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/products/:id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Order Operations:&lt;/strong&gt; Place a new order and retrieve order details.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Place an order&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Order details&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Server Initialization
&lt;/h3&gt;

&lt;p&gt;Finally, we start the server and listen for incoming connections on the specified port (&lt;code&gt;3000&lt;/code&gt; by default).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Server is running on port &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we've explored how to build an Online Restaurant Service REST API using Node.js, Express.js, and MongoDB. By following the provided instructions and understanding the code snippets, you can create a robust API for managing products, processing orders, and maintaining a seamless dining experience for your customers. Happy coding!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>restapi</category>
      <category>postman</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>Client-side vs. Server-side Rendering: Choosing the Right Approach for Web Development</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Tue, 19 Sep 2023 08:43:14 +0000</pubDate>
      <link>https://dev.to/manish7107/client-side-vs-server-side-rendering-choosing-the-right-approach-for-web-development-3klj</link>
      <guid>https://dev.to/manish7107/client-side-vs-server-side-rendering-choosing-the-right-approach-for-web-development-3klj</guid>
      <description>&lt;p&gt;In the ever-evolving landscape of web development, choosing the right rendering approach is a critical decision that can significantly impact the performance, user experience, and search engine optimization (SEO) of a website. Two prevalent methods in this regard are client-side rendering (CSR) and server-side rendering (SSR). Each has its own set of strengths and weaknesses, making them suitable for different types of web applications. In this article, we'll explore the differences between client-side and server-side rendering to help developers make informed decisions for their projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Client-side Rendering (CSR)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oqMveuSh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29vj2ygdd77idmjap5w0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oqMveuSh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29vj2ygdd77idmjap5w0.png" alt="Source: Riccardo Andreatta-Medium&lt;br&gt;
" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How it Works:
&lt;/h3&gt;

&lt;p&gt;Client-side rendering involves loading a basic HTML file to the browser, which then initiates a JavaScript file. This JavaScript file is responsible for fetching data from the server and dynamically rendering the content on the client's side.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interactivity&lt;/strong&gt;: CSR provides a highly interactive user experience. Once the initial page loads, subsequent interactions can be very smooth since the client doesn't need to request a new page from the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reduced Server Load&lt;/strong&gt;: The server primarily serves static files, putting less strain on the server's resources. This can be advantageous when dealing with a high volume of concurrent users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rich User Interfaces&lt;/strong&gt;: CSR is particularly well-suited for web applications that require a high level of interactivity, such as single-page applications (SPAs) and real-time applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Cons:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SEO Challenges&lt;/strong&gt;: Initially, search engine crawlers may struggle to index content as JavaScript code often needs to be executed to render the page. Although improvements have been made in this area, it still poses a challenge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance on Low-end Devices&lt;/strong&gt;: CSR can lead to slower initial load times, especially on devices with limited processing power or slower internet connections, as they rely heavily on client-side processing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility Considerations&lt;/strong&gt;: Ensuring accessibility can be more complex with CSR due to the need for additional effort in managing focus and navigation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Server-side Rendering (SSR)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ek5NTH8c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4w0yiujhy8hsibpdshgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ek5NTH8c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4w0yiujhy8hsibpdshgt.png" alt="Source: Riccardo Andreatta - Medium&lt;br&gt;
" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How it Works:
&lt;/h3&gt;

&lt;p&gt;With server-side rendering, the server processes the JavaScript code and generates the HTML on the server before sending it to the client. This means the browser receives pre-rendered HTML content.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SEO-Friendly&lt;/strong&gt;: Search engines can easily index the content since the initial response from the server contains the complete HTML. This can lead to better rankings in search results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance on Initial Load&lt;/strong&gt;: SSR typically provides faster initial load times, especially on low-end devices or slower internet connections, as the client receives pre-rendered HTML.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility and SEO&lt;/strong&gt;: Due to the presence of pre-rendered HTML, accessibility and SEO considerations are more straightforward.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Cons:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server Load&lt;/strong&gt;: SSR can put a higher load on the server, especially when dealing with a large number of concurrent users, as the server is responsible for generating the HTML for each request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reduced Interactivity&lt;/strong&gt;: While SSR provides a fast initial load, subsequent interactions might be slower since the server needs to be involved in generating new pages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Complexity for Highly Interactive Applications&lt;/strong&gt;: SSR can be less suitable for highly interactive applications, as they might require additional effort to integrate client-side interactivity.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Choosing the Right Approach
&lt;/h2&gt;

&lt;p&gt;The choice between client-side and server-side rendering ultimately depends on the specific requirements of the project. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Client-side Rendering&lt;/strong&gt; is well-suited for highly interactive applications that benefit from reduced server load and prioritize user experience over initial load times.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-side Rendering&lt;/strong&gt; shines in scenarios where SEO and initial load performance are critical, and the application may not require extensive client-side interactivity.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In many cases, a hybrid approach called "Hybrid Rendering" or "Isomorphic Rendering" can be beneficial. This combines elements of both CSR and SSR to achieve the best of both worlds, providing fast initial loads while maintaining interactivity.&lt;/p&gt;

&lt;p&gt;In conclusion, understanding the strengths and weaknesses of client-side and server-side rendering is essential for making informed decisions in web development. By carefully considering the specific needs of a project, developers can choose the rendering approach that aligns with their goals and priorities.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>nextjs</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What are hooks in React?</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sun, 17 Sep 2023 12:58:48 +0000</pubDate>
      <link>https://dev.to/manish7107/what-are-hooks-in-react-346m</link>
      <guid>https://dev.to/manish7107/what-are-hooks-in-react-346m</guid>
      <description>&lt;p&gt;Hey there! Today, let's dive into the world of React Hooks. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, What are React Hooks?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Alright, let's start with the basics. React Hooks are functions that let you use state and other React features in functional components. Before hooks, if you wanted to use state or lifecycle methods, you had to use class components. Hooks changed the game, making it possible to do everything you could with class components, but with functional components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use Hooks?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Great question! Hooks make it easier to reuse stateful logic without changing your component hierarchy. This means you can separate logic from presentation. Also, they simplify complex components and encourage a cleaner, more readable codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Popular Hooks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, let's talk about some of the popular hooks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;useState:&lt;/strong&gt; This one lets you add state to your functional components. No more class components just for state!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;useEffect:&lt;/strong&gt; It replaces the lifecycle methods &lt;code&gt;componentDidMount&lt;/code&gt;, &lt;code&gt;componentDidUpdate&lt;/code&gt;, and &lt;code&gt;componentWillUnmount&lt;/code&gt;. It helps you manage side effects in your functional components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;useContext:&lt;/strong&gt; If you're working with Context API in React, this hook is a lifesaver. It allows you to subscribe to React context without introducing nesting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;useRef:&lt;/strong&gt; This hook is used to create mutable objects that persist throughout the component's lifetime. It's great for things like DOM manipulation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;useReducer:&lt;/strong&gt; It's an alternative to &lt;code&gt;useState&lt;/code&gt; for more complex state logic. If your state depends on the previous state, &lt;code&gt;useReducer&lt;/code&gt; might be your friend.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom Hooks:&lt;/strong&gt; You can also create your own hooks! They're a way to extract and reuse stateful logic from your components.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;How to Use Hooks?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Alright, let's get practical! To use a hook, you simply call it inside your functional component. For example, to use &lt;code&gt;useState&lt;/code&gt;, you'd write something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! Now, &lt;code&gt;state&lt;/code&gt; holds your current state, and &lt;code&gt;setState&lt;/code&gt; is a function to update it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Tips&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Call Hooks at the Top Level:&lt;/strong&gt; Don't call hooks inside loops, conditions, or nested functions. Always call them at the top level of your React function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Only Call Hooks from React Functions:&lt;/strong&gt; You can call hooks in custom hooks, but also ensure they're called from React function components or custom hooks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Follow Naming Conventions:&lt;/strong&gt; Always start your custom hooks with the word "use" to comply with the convention.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And there you have it! React Hooks are a fantastic addition to the React ecosystem that allow you to manage state and side effects in functional components. They make your code cleaner, more modular, and easier to reason about.&lt;/p&gt;

&lt;p&gt;Give them a try in your next project, and you'll see how they can simplify your React code. Happy coding! 😊&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How can I optimize my code for efficiency?</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sun, 17 Sep 2023 12:55:08 +0000</pubDate>
      <link>https://dev.to/manish7107/how-can-i-optimize-my-code-for-efficiency-1k8c</link>
      <guid>https://dev.to/manish7107/how-can-i-optimize-my-code-for-efficiency-1k8c</guid>
      <description>&lt;p&gt;In the world of programming, efficiency is paramount. Writing efficient code not only enhances the performance of your applications but also minimizes resource consumption, making your software more scalable and cost-effective. Whether you're a seasoned developer or just starting out, here are some fundamental principles to keep in mind when striving for efficiency in your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;strong&gt;Plan and Design Before You Code&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before diving into writing code, take the time to plan and design your solution. This involves understanding the problem thoroughly, breaking it down into smaller, manageable parts, and choosing appropriate data structures and algorithms.&lt;/p&gt;

&lt;p&gt;By investing time in the planning phase, you can identify potential bottlenecks and make informed decisions about how to approach the implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;strong&gt;Choose the Right Data Structures&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Selecting the appropriate data structures is crucial for efficient code. Different data structures have different strengths and weaknesses, so it's important to choose the one that best suits the requirements of your application.&lt;/p&gt;

&lt;p&gt;For example, if you need fast retrieval of elements, a hash table might be a good choice. On the other hand, if you need to maintain sorted data, a balanced binary search tree could be more appropriate.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;strong&gt;Optimize Algorithms&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Efficient algorithms are the backbone of efficient code. Understanding the time and space complexity of different algorithms is essential for making informed choices.&lt;/p&gt;

&lt;p&gt;For instance, if you need to sort a large dataset, choosing an O(n log n) sorting algorithm like Merge Sort or Quick Sort is more efficient than a simple bubble sort with O(n^2) complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;strong&gt;Avoid Premature Optimization&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While it's important to write efficient code, it's equally important not to prematurely optimize. Premature optimization can lead to code that is unnecessarily complex and harder to maintain.&lt;/p&gt;

&lt;p&gt;Focus on writing clean, clear, and correct code first. Once your code is working, you can then identify specific areas that need optimization based on profiling and testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;strong&gt;Use Libraries and Frameworks Wisely&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Leveraging libraries and frameworks can save you a significant amount of time and effort. These pre-built components are often highly optimized and well-tested.&lt;/p&gt;

&lt;p&gt;However, be mindful of the overhead that comes with using large libraries. In some cases, a smaller, custom solution might be more efficient.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. &lt;strong&gt;Minimize Memory Usage&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Efficient code not only runs quickly but also uses memory judiciously. Avoid unnecessary memory allocations and deallocate resources when they are no longer needed. &lt;/p&gt;

&lt;p&gt;Use techniques like object pooling or lazy loading to optimize memory usage, especially for resource-intensive operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. &lt;strong&gt;Profile and Benchmark Your Code&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Profiling tools help you identify performance bottlenecks in your code. They provide insights into which parts of your code are consuming the most resources, allowing you to target your optimization efforts effectively.&lt;/p&gt;

&lt;p&gt;Benchmarking helps you compare different implementations to find the most efficient one. It's important to conduct thorough testing to ensure that your optimizations actually lead to performance gains.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. &lt;strong&gt;Keep Code Readable and Maintainable&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Efficient code is not synonymous with cryptic code. Write code that is clear, well-organized, and follows established coding conventions. This makes it easier for you and others to understand, debug, and maintain the code in the long run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Writing efficient code is a skill that improves with practice and experience. By following these principles and continually seeking to improve your coding practices, you'll be able to create software that not only works, but works efficiently. Remember, the goal is not just to make code run fast, but also to ensure it is scalable, maintainable, and cost-effective in the long term.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>learning</category>
      <category>dsa</category>
    </item>
    <item>
      <title>What is an API and how can you protect your API key from exposure?🤔🔥</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Fri, 15 Sep 2023 06:43:55 +0000</pubDate>
      <link>https://dev.to/manish7107/what-is-an-api-and-how-can-you-protect-your-api-key-from-exposure-cjg</link>
      <guid>https://dev.to/manish7107/what-is-an-api-and-how-can-you-protect-your-api-key-from-exposure-cjg</guid>
      <description>&lt;p&gt;An API, or Application Programming Interface, is a set of rules and protocols that allows different software applications to communicate and interact with each other. It defines the methods and data formats that applications can use to request and exchange information. APIs are used extensively in modern software development to enable the integration of different services and systems.&lt;/p&gt;

&lt;p&gt;If you commit your API key to a public repository, it can have serious security implications. An API key serves as a unique identifier that grants access to certain resources or services. If it falls into the wrong hands, unauthorized individuals or applications could potentially misuse it. They might gain unauthorized access to your accounts, data, or services associated with that API key.&lt;/p&gt;

&lt;p&gt;To prevent this, it's crucial to follow best practices for handling API keys:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Keep Them Private&lt;/strong&gt;: Never share your API keys in public forums, repositories, or anywhere accessible to unauthorized users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Environment Variables&lt;/strong&gt;: Store your API keys in environment variables or use a configuration file that is excluded from version control. This way, you can access them without exposing them in your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Utilize Secret Management Tools&lt;/strong&gt;: Use tools like Vault or AWS Secrets Manager to securely store and manage sensitive information, including API keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check Repository History&lt;/strong&gt;: Regularly review your repository's history to ensure no accidental commits containing API keys have been made.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rotate API Keys&lt;/strong&gt;: Periodically rotate your API keys to limit potential damage in case one is compromised.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Restrict API Key Permissions&lt;/strong&gt;: Whenever possible, limit the permissions of your API keys to only what is necessary. This minimizes the potential impact if the key is misused.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remember, protecting your API keys is a critical aspect of ensuring the security of your applications and the services they interact with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vYMpQyrI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sun9a2v1bccnopfaaoo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vYMpQyrI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sun9a2v1bccnopfaaoo.jpg" alt="What if you Push your API-KEY to public repo.😂😂" width="800" height="786"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>programming</category>
      <category>express</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Set Up Your First React App: A Simple Guide</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Tue, 12 Sep 2023 08:25:13 +0000</pubDate>
      <link>https://dev.to/manish7107/how-to-set-up-your-first-react-app-a-simple-guide-2nlo</link>
      <guid>https://dev.to/manish7107/how-to-set-up-your-first-react-app-a-simple-guide-2nlo</guid>
      <description>&lt;p&gt;React is a powerful JavaScript library for building user interfaces. Setting up a React app may seem daunting for beginners, but with the right guidance, it can be a straightforward process. In this article, we'll walk you through the steps to create a basic React application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we start, make sure you have the following installed on your machine:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node.js and npm&lt;/strong&gt;: React requires Node.js, which includes npm (Node Package Manager). You can download them from the official website: &lt;a href="https://nodejs.org/"&gt;Node.js&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Editor&lt;/strong&gt;: Choose a code editor you're comfortable with. Popular options include Visual Studio Code, Sublime Text, and Atom.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Create a New React App
&lt;/h2&gt;

&lt;p&gt;Open your terminal or command prompt and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app my-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;my-react-app&lt;/code&gt; with the desired name of your application. This command uses &lt;code&gt;npx&lt;/code&gt; to fetch the latest version of &lt;code&gt;create-react-app&lt;/code&gt; and generates a new React app with the specified name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Navigate to Your Project Directory
&lt;/h2&gt;

&lt;p&gt;Once the app is created, navigate to your project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;my-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Start the Development Server
&lt;/h2&gt;

&lt;p&gt;To see your app in action, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will start the development server and open your app in a web browser. You can now make changes to your code, and the app will automatically reload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Understanding the Project Structure
&lt;/h2&gt;

&lt;p&gt;Before diving into coding, it's important to understand the basic structure of a React app generated by &lt;code&gt;create-react-app&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;src&lt;/code&gt;: This directory contains all of your source code.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;App.js&lt;/code&gt;: The main component that gets rendered.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.js&lt;/code&gt;: The entry point of the application.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;public&lt;/code&gt;: Contains static files like HTML, images, and icons.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;node_modules&lt;/code&gt;: Contains all the project dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;package-lock.json&lt;/code&gt;: These files contain information about the project and its dependencies.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 5: Writing Your First Component
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;src/App.js&lt;/code&gt; in your code editor. You'll see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, React!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Feel free to modify the &lt;code&gt;App&lt;/code&gt; component to suit your needs. You can add more components, styles, or functionality here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Creating Additional Components
&lt;/h2&gt;

&lt;p&gt;To keep your code organized, you can create separate components for different parts of your application. For example, you can create a &lt;code&gt;Header&lt;/code&gt; component for the page header and a &lt;code&gt;Footer&lt;/code&gt; component for the page footer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Styling Your App
&lt;/h2&gt;

&lt;p&gt;You can style your app using CSS, SCSS, or a CSS-in-JS solution like styled-components. For example, you can create an &lt;code&gt;App.css&lt;/code&gt; file and import it into your component files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8: Building and Deploying Your App
&lt;/h2&gt;

&lt;p&gt;When you're ready to deploy your app, you can build it using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create an optimized production build in the &lt;code&gt;build&lt;/code&gt; directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Setting up a React app is the first step towards building dynamic and interactive web applications. With the right tools and a basic understanding of React, you can create powerful user interfaces that engage your audience. Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>JavaScript Best Practices: Code Like a Pro!📝</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Mon, 11 Sep 2023 10:01:09 +0000</pubDate>
      <link>https://dev.to/manish7107/javascript-best-practices-code-like-a-pro-26n9</link>
      <guid>https://dev.to/manish7107/javascript-best-practices-code-like-a-pro-26n9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hey there! Let's talk about some awesome JavaScript best practices! 🚀&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript is a versatile and powerful programming language used to enhance the interactivity and functionality of websites. To write efficient and maintainable code, it's crucial to follow best practices. Here are some key recommendations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Naming is Everything&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Make your variable and function names descriptive. It's like giving your code a good map!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="c1"&gt;// Nice and clear&lt;/span&gt;
   &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;userAge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;calculateTotalPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;itemPrice&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;itemPrice&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="c1"&gt;// Not so clear&lt;/span&gt;
   &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep it Local&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Global variables can be troublemakers. Try to keep things confined to modules or namespaces. It's like putting your code in little boxes!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="c1"&gt;// Not recommended&lt;/span&gt;
   &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalVariable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;some value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="c1"&gt;// Better&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myModule&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;myVariable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;some value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="nx"&gt;myFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
           &lt;span class="c1"&gt;// ...&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Strict Mode for the Win&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Use strict mode to catch those sneaky bugs and keep your code on track.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use strict&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="c1"&gt;// Your code here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No Magic Tricks&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Avoid using numbers or strings without context. Give them a name!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="c1"&gt;// Magic Number&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="c1"&gt;// Much better&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PASSING_SCORE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;PASSING_SCORE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Divide and Conquer&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Break your code into smaller, reusable parts. It's like building with LEGO blocks!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="c1"&gt;// Before&lt;/span&gt;
   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomethingElse&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="c1"&gt;// After&lt;/span&gt;
   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;doSomethingElse&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;doSomethingElse&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;No &lt;code&gt;eval()&lt;/code&gt; Drama&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid &lt;code&gt;eval()&lt;/code&gt; like the plague. It can lead to trouble. There's almost always a safer way!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Handle Errors like a Pro&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't let errors crash your party. Catch them and deal with them gracefully!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// Code that may throw an error&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// Handle the error&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Loop Like a Boss&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Loops matter! Use the right one for the job and don't waste unnecessary processing power.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="c1"&gt;// Not the best&lt;/span&gt;
   &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="c1"&gt;// Much cleaner&lt;/span&gt;
   &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// ...&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test, Test, Test&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Testing is your best friend. Use frameworks like Mocha, Jasmine, or Jest to keep your code in check!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Stay Fresh with JavaScript&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep up with the latest JavaScript features. It's like upgrading to a faster car!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remember, coding is an adventure! These practices will help you navigate the JavaScript landscape smoothly. Happy coding! 🎉👨‍💻&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Improve Front-end performance??🤔</title>
      <dc:creator>Mk Sharma</dc:creator>
      <pubDate>Sun, 10 Sep 2023 09:24:41 +0000</pubDate>
      <link>https://dev.to/manish7107/how-to-improve-front-end-performance-3ag7</link>
      <guid>https://dev.to/manish7107/how-to-improve-front-end-performance-3ag7</guid>
      <description>&lt;p&gt;Improving front-end performance is crucial for creating fast and responsive web applications. Here are some tips to help you enhance the performance of your front-end code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimize Images and Media:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use appropriate image formats (e.g., JPEG, PNG, SVG) for different types of images.&lt;/li&gt;
&lt;li&gt;Compress images to reduce file size without sacrificing quality.&lt;/li&gt;
&lt;li&gt;Lazy load images to only load them when they are in the viewport.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Minimize HTTP Requests:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce the number of requests by combining CSS and JavaScript files, using sprite sheets, and avoiding excessive use of external resources.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Utilize Browser Caching:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set appropriate cache headers to allow the browser to store resources locally. This reduces the need for repeated downloads.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Minify and Bundle Files:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Minify CSS, JavaScript, and HTML files to remove unnecessary characters like whitespace, comments, and newline characters.&lt;/li&gt;
&lt;li&gt;Bundle multiple smaller files into a single, larger file to reduce the number of HTTP requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimize Critical Rendering Path:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prioritize the loading of critical resources needed for initial rendering (e.g., inline critical CSS, preload resources).&lt;/li&gt;
&lt;li&gt;Avoid render-blocking resources in the head section.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use Content Delivery Networks (CDNs):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leverage CDNs to distribute static resources across multiple servers, reducing server load and improving load times for users globally.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Choose Efficient CSS Selectors:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid using complex selectors or over-qualified selectors. Specificity can slow down rendering times.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimize CSS and JavaScript Performance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid unnecessary animations and transitions, as they can hinder performance.&lt;/li&gt;
&lt;li&gt;Use asynchronous and deferred loading for non-critical scripts.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Implement Responsive Web Design:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use CSS media queries to ensure your website is optimized for various screen sizes and devices.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Avoid Render-Blocking Scripts:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load non-essential scripts after the initial rendering or use techniques like &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;defer&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimize Fonts:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use system fonts or a small set of web-safe fonts to reduce font loading times.&lt;/li&gt;
&lt;li&gt;Consider using font-display CSS property to control how fonts are displayed while they are still loading.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Monitor and Analyze Performance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like Lighthouse, PageSpeed Insights, and browser developer tools to identify performance bottlenecks and areas for improvement.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimize JavaScript Execution:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid unnecessary calculations and DOM manipulations, especially in loops.&lt;/li&gt;
&lt;li&gt;Use efficient algorithms and data structures.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reduce DOM Manipulations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Minimize the frequency of DOM updates and try to batch them when possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consider Server-Side Rendering (SSR) or Static Site Generation (SSG):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For content-heavy sites, consider generating HTML on the server or at build time to reduce client-side rendering.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remember to test your website's performance on various devices and network conditions to ensure a smooth experience for all users. Additionally, regularly monitor and address performance issues as your application evolves.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>css</category>
    </item>
  </channel>
</rss>
