command->error('User with id 1 not found.'); return; } // --- Wipe the demonstration content ---------------------------------- // Deletion order respects the foreign keys so no per-driver "disable // checks" magic is needed: pivot rows first, then posts, then the // standalone tag/category rows. DB::table('related_posts')->delete(); DB::table('post_tag')->delete(); Post::query()->delete(); Tag::query()->delete(); Category::query()->delete(); // --- Categories ------------------------------------------------------ $categories = [ // English ['name' => 'Frontend Development', 'slug' => 'frontend-development', 'description' => 'Articles about modern frontend engineering: HTML, CSS, JavaScript and the tools that keep interfaces fast and maintainable.', 'short_description' => 'HTML, CSS, JavaScript and the tools behind fast interfaces.'], ['name' => 'React & Next.js', 'slug' => 'react-nextjs', 'description' => 'Deep dives into React, Next.js and the ecosystem around them: components, rendering, and real-world patterns.', 'short_description' => 'React, Next.js and the ecosystem around them.'], ['name' => 'Backend Development', 'slug' => 'backend-development', 'description' => 'Server-side code, APIs, databases and the design decisions behind reliable backends.', 'short_description' => 'APIs, databases and reliable server-side code.'], ['name' => 'DevOps & Deployment', 'slug' => 'devops-deployment', 'description' => 'Docker, CI/CD, hosting and everything between the commit and the production URL.', 'short_description' => 'Docker, CI/CD and shipping to production.'], ['name' => 'Programming Careers', 'slug' => 'programming-careers', 'description' => 'Interviews, learning paths and honest advice for people who write code for a living.', 'short_description' => 'Interviews, learning paths and honest career advice.'], ['name' => 'Web Performance & SEO', 'slug' => 'web-performance-seo', 'description' => 'Core Web Vitals, technical SEO and the measurements that make interfaces feel instant, stay findable and rank.', 'short_description' => 'Speed, Core Web Vitals and technical SEO that move rankings.'], // Persian ['name' => 'توسعه فرانت‌اند', 'slug' => 'frontend-fa', 'description' => 'مقاله‌هایی درباره‌ی مهندسی فرانت‌اند مدرن، از HTML و CSS تا جاوااسکریپت و ابزارهایی که رابط‌ها را سریع و کاربرپسند نگه می‌دارند.', 'short_description' => 'HTML، CSS، جاوااسکریپت و ابزارهای ساخت رابط‌های سریع.'], ['name' => 'ری‌اکت و نکست', 'slug' => 'react-nextjs-fa', 'description' => 'نگاه عمیق به ری‌اکت، نکست و اکوسیستم اطراف آن‌ها؛ کامپوننت‌ها، رندرینگ و الگوهای کاربردی.', 'short_description' => 'ری‌اکت، نکست و اکوسیستم اطراف آن‌ها.'], ['name' => 'توسعه بک‌اند', 'slug' => 'backend-fa', 'description' => 'کد سمت سرور، APIها، پایگاه‌داده و تصمیم‌هایی که پشت یک بک‌اند قابل اتکا گرفته می‌شود.', 'short_description' => 'APIها، پایگاه‌داده و کد سمت سرور قابل اتکا.'], ['name' => 'دواپس و استقرار', 'slug' => 'devops-fa', 'description' => 'داکر، CI/CD، هاستینگ و هر چیزی که بین کامیت و URL تولید فاصله می‌اندازد.', 'short_description' => 'داکر، CI/CD و رساندن کد به سرور تولید.'], ['name' => 'مسیر شغلی برنامه‌نویسی', 'slug' => 'career-fa', 'description' => 'مصاحبه‌ها، نقشه‌های یادگیری و توصیه‌های صادقانه برای کسانی که برنامه‌نویسی شغل آن‌هاست.', 'short_description' => 'مصاحبه، نقشه یادگیری و توصیه‌های شغلی صادقانه.'], ['name' => 'پرفورمنس وب و سئو', 'slug' => 'web-performance-seo-fa', 'description' => 'شاخص‌های Core Web Vitals، سئو تکنیکال و اندازه‌گیری‌هایی که رابط‌ها را سریع، پیداشدنی و کاربرپسند می‌کنند.', 'short_description' => 'سرعت، Core Web Vitals و سئو تکنیکال موثر.'], ]; $categoryIds = []; foreach ($categories as $category) { $created = Category::create([ 'name' => $category['name'], 'slug' => $category['slug'], 'description' => $category['description'], 'short_description' => $category['short_description'], ]); $categoryIds[$category['slug']] = $created->id; } // --- Tags ------------------------------------------------------------- $tags = [ ['name' => 'React', 'slug' => 'react'], ['name' => 'Next.js', 'slug' => 'nextjs'], ['name' => 'SEO', 'slug' => 'seo'], ['name' => 'Performance', 'slug' => 'performance'], ['name' => 'Clean Code', 'slug' => 'clean-code'], ['name' => 'Laravel', 'slug' => 'laravel'], ['name' => 'Docker', 'slug' => 'docker'], ['name' => 'DevOps', 'slug' => 'devops'], ['name' => 'Career', 'slug' => 'career'], ['name' => 'TypeScript', 'slug' => 'typescript'], ['name' => 'AI Tools', 'slug' => 'ai-tools'], ['name' => 'Freelancing', 'slug' => 'freelancing'], ['name' => 'Web Design', 'slug' => 'design'], ['name' => 'ری‌اکت', 'slug' => 'react-fa'], ['name' => 'نکست', 'slug' => 'nextjs-fa'], ['name' => 'سئو', 'slug' => 'seo-fa'], ['name' => 'عملکرد', 'slug' => 'performance-fa'], ['name' => 'کد تمیز', 'slug' => 'clean-code-fa'], ['name' => 'لاراول', 'slug' => 'laravel-fa'], ['name' => 'داکر', 'slug' => 'docker-fa'], ['name' => 'دواپس', 'slug' => 'devops-fa'], ['name' => 'مسیر شغلی', 'slug' => 'career-fa'], ['name' => 'تایپ‌اسکریپت', 'slug' => 'typescript-fa'], ['name' => 'هوش مصنوعی', 'slug' => 'ai-fa'], ['name' => 'فریلنسری', 'slug' => 'freelancing-fa'], ['name' => 'طراحی وب', 'slug' => 'design-fa'], ]; $tagIds = []; foreach ($tags as $tag) { $created = Tag::create(['name' => $tag['name'], 'slug' => $tag['slug']]); $tagIds[$tag['slug']] = $created->id; } // --- Posts ------------------------------------------------------------ // Each entry: title, slug, excerpt, category slug, tags, cover keyword, // views, likes, days-ago for published_at, body (markdown-ish text where // "# ", "## " and "- " lines become headings and lists on the blog). $posts = [ // ================================================================= // English posts // ================================================================= [ 'title' => 'Next.js App Router: Why Server Components Changed How I Build Websites', 'slug' => 'nextjs-app-router-server-components', 'excerpt' => 'The App Router and React Server Components are not just new APIs; they change where your code runs. Here is how they cut bundle size, simplified data fetching, and made my pages measurably faster.', 'category' => 'react-nextjs', 'tags' => ['nextjs', 'react'], 'cover' => 'Next.js App Router guide', 'views' => 3200, 'likes' => 210, 'days_ago' => 2, 'body' => <<<'TEXT' # The Next.js App Router ## What actually changed Moving from the Pages Router to the App Router is the biggest shift in Next.js since the framework was released. Layouts became shareable, nested loading states became the norm, and React Server Components moved most rendering work off the client. ## Where your code runs now - Components are Server Components by default; they render on the server and send only HTML. - A bundle never contains what a component never has to run in the browser. - "use client" is now an explicit opt-in, not the default. ## Why data fetching got simpler Pages used to need `getServerSideProps` or `getStaticProps` as a separate step. In the App Router you fetch directly inside a component, and Next.js deduplicates and caches requests. That removed a whole category of props-drilling bugs I used to fix. ## Measuring the result The most visible win was bundle size. The home page of the website this blog runs on dropped roughly 180 KB of JavaScript, and the Largest Contentful Paint improved from 2.4 seconds to about 1.1 seconds on throttled mobile. ## When to keep a Client Component - Interactive forms with optimistic updates. - Components that listen to browser events like scroll. - Anything using context for frequently changing state. Server-first is a great default, but "use client" at the right boundary is still the right call. The skill is deciding where that boundary lives. ## The takeaway Think about the server/client boundary as a performance decision, not a fashion one. Rendering on the server by default, then pushing only what genuinely needs the browser, is a pattern that scales with your product. TEXT, ], [ 'title' => 'Core Web Vitals Explained: A Practical Guide to LCP, INP, and CLS', 'slug' => 'core-web-vitals-practical-guide', 'excerpt' => 'LCP, INP and CLS are the metrics Google uses to judge real-world performance. This guide explains what each one measures and the concrete fixes that move the needle.', 'category' => 'frontend-development', 'tags' => ['performance', 'seo'], 'cover' => 'Core Web Vitals guide', 'views' => 5400, 'likes' => 480, 'days_ago' => 5, 'body' => <<<'TEXT' # Core Web Vitals Explained: A Practical Guide to LCP, INP, and CLS ## Why these three metrics matter Google uses Core Web Vitals as part of its page experience signal. They describe what real users experience in the field, not what a synthetic lab test reports, so improving them is genuine product work. ## Largest Contentful Paint (LCP) LCP measures when the largest above-the-fold element finishes loading. The target is under 2.5 seconds. - Preload the hero image and the stylesheet that affects it. - Serve images in modern formats with sensible dimensions. - Cut render-blocking third-party scripts from the critical path. ## Interaction to Next Paint (INP) INP replaces First Input Delay. It measures the worst response to a user interaction, and the good limit is 200 milliseconds. - Keep long tasks on the main thread under 50 milliseconds. - Defer non-essential work until after the page becomes interactive. - Debounce expensive handlers instead of running them on every event. ## Cumulative Layout Shift (CLS) CLS rewards pages that do not jump around while loading. A score below 0.1 is good. - Reserve space for images and embeds with explicit dimensions. - Avoid inserting content above existing content after the request starts. - Let fonts keep their fallback metrics to stop invisible-text reflows. ## How to verify your work Run Lighthouse for a quick lab pass, then compare it to CrUX field data for your real traffic. Field performance is what search engines ultimately see, so an analytics tool that reports RUM metrics is worth the setup cost. ## The takeaway Performance is not a one-time checklist. Set the targets, add the metrics to your CI, and treat every release that regresses them as a bug. TEXT, ], [ 'title' => 'Building Robust RESTful APIs with Laravel: Validation, Resources, and Rate Limiting', 'slug' => 'laravel-api-validation-resources-throttling', 'excerpt' => 'The pieces that keep a Laravel API clean and safe: form requests for validation, API resources for a consistent response shape, and throttling to protect public endpoints.', 'category' => 'backend-development', 'tags' => ['laravel', 'clean-code'], 'cover' => 'Laravel REST API guide', 'views' => 1800, 'likes' => 150, 'days_ago' => 9, 'body' => <<<'TEXT' # Building Robust RESTful APIs with Laravel ## Start with the shape of your responses The fastest way to make an API pleasant to consume is a stable response shape. Laravel's API resources give you a single place to define it, so the frontend never has to guess whether a payload is an object, an array, or something in between. ## Validation belongs in Form Requests Writing rules inside the controller works, but it stops scaling. Extract them into a Form Request so that validation, authorisation and rules live next to each other and can be tested in isolation. - Keep rules close to the domain they describe. - Return the default 422 error shape; most clients already parse it. - Add a couple of custom rules for the weird cases instead of piling conditions into the controller. ## Rate limiting is a safety feature, not a niche A public write endpoint is a spam magnet until you throttle it. Prefix the route with a reasonable throttle such as a few attempts per minute, and watch what legitimate clients actually need before tuning. - Use named limiters so the rules are easy to read. - Return a 429 with the `Retry-After` header. - Remember that a public contact form needs more protection than an authenticated admin route. ## What this website uses The blog and website APIs follow exactly this pattern: form requests for validation, JSON resources for output, and per-route throttles so anonymous traffic cannot flood the database. ## The takeaway Small, boring conventions beat clever abstractions. A consistent response shape, centralised validation and sensible throttling will take an API from "works for me" to "works for everyone". TEXT, ], [ 'title' => 'Zero-Downtime Deployments with Docker Compose: A Step-by-Step Guide', 'slug' => 'zero-downtime-deployments-docker-compose', 'excerpt' => 'Rolling updates, health checks and the careful order of flags — how to update a Docker Compose stack without dropping a single request.', 'category' => 'devops-deployment', 'tags' => ['docker', 'devops'], 'cover' => 'Docker Compose deploy', 'views' => 2600, 'likes' => 230, 'days_ago' => 14, 'body' => <<<'TEXT' # Zero-Downtime Deployments with Docker Compose ## The goal A restart that takes your site offline for a few seconds is a deployment that failed quietly. With a reverse proxy in front and a health check after it, a Compose stack can be updated while the old container keeps serving traffic. ## Health checks come first Compose lets you declare a healthcheck for every service. - The proxy should only pass traffic to containers reporting "healthy". - The application's health endpoint must not just return 200; it should verify the database connection behind it. - Give the check a generous start period on the first boot. ## The update strategy When you run `docker compose up -d`, Compose recreates changed containers one by one. Pair that with a running proxy and you get a rolling update for free. - Run the migrations and other long tasks as a separate one-shot service before the web container restarts. - Let the new container reach healthy before the old one is removed. - Watch the logs during the switch instead of walking away. ## What this blog's deploy actually does The deploy script for this site pulls the new images, runs a migration guard, starts the new containers and then verifies a health URL returns 200 before reporting success. That verification step is what turns a deploy from a wish into a fact. ## The takeaway Zero downtime is a composition of small habits: a real health endpoint, a proxy that respects it, and a deploy script that will not celebrate early. Automate the checks and your teammates will thank you. TEXT, ], [ 'title' => 'How I Interview Frontend Developers: 8 Questions That Predict Real Performance', 'slug' => 'frontend-interview-questions', 'excerpt' => 'The questions I actually ask in frontend interviews, and what I am listening for in each answer — from layout behaviour to how a candidate handles a broken build.', 'category' => 'programming-careers', 'tags' => ['react', 'clean-code', 'career'], 'cover' => 'Frontend interview questions', 'views' => 4100, 'likes' => 390, 'days_ago' => 21, 'body' => <<<'TEXT' # How I Interview Frontend Developers ## Why I stopped asking trivia Reciting a list of hook names tells me a candidate can memorize; it tells me nothing about how they will behave on Monday morning. I measure judgement, debugging skill and the ability to explain trade-offs. ## The questions - What happens between the URL and the first paint? - When would you reach for `useEffect` to load data, and why is that usually the wrong default? - A component re-renders every keystroke. Where do you start looking? - Describe a layout problem you solved with `position: absolute`. When was it a mistake? - How would you migrate a legacy class component without breaking the app? - Your `npm ci` fails on the CI server but works locally. What do you check? - Explain the difference between `LCP` and `TTFB` to a product manager. - When was the last time you shipped something you were embarrassed about? ## What I listen for - Naming the actual browser steps beats quoting docs. - A candidate who says "it depends" and then names the dependence is my favourite kind of engineer. - Debugging confidence matters more than a perfect first answer. I want to hear how they think, not whether they guessed right. ## The takeaway Interviews should simulate the job: trade-offs, debugging and clear communication. Questions that reward those skills find engineers who actually ship. TEXT, ], [ 'title' => 'React Server Components vs. Client Components: When to Use Each', 'slug' => 'react-server-vs-client-components', 'excerpt' => 'The mental model behind the server/client boundary in modern React, with concrete examples of what belongs on each side — and what the next.js app router actually compiles.', 'category' => 'react-nextjs', 'tags' => ['react', 'nextjs'], 'cover' => 'React Server Components', 'views' => 2900, 'likes' => 270, 'days_ago' => 30, 'body' => <<<'TEXT' # React Server Components vs. Client Components ## The one sentence mental model A Server Component renders where your data lives; a Client Component renders where your user lives. Everything else follows from that sentence. ## What Server Components give you - Direct access to the database and filesystem without an extra API call. - Zero runtime JavaScript for the parts that only display content. - Smaller bundles, because libraries used on the server never reach the browser. ## What forces a Client Component - State and effects: `useState`, `useEffect`, event handlers. - Browser APIs: geometry, media queries, storage. - Context and interactivity that users feel immediately. ## The tricky middle Props passed from a server component become serialized data, so surprises hide in the boundary. - Functions and class instances do not survive the boundary. - Keep client components close to the interaction leaves, and push server components up toward the data roots. - When a component "is both", split it: a client wrapper with a server body. ## How this blog is organised Pages and post bodies are server-rendered, while the theme toggle and the mobile menu are client islands. That split is why the site stays interactive while shipping a very small amount of JavaScript. ## The takeaway Stop thinking "this component can use hooks, therefore client". Ask where the work should run, then let the framework handle the rest. TEXT, ], [ 'title' => 'Technical SEO and Core Web Vitals for Persian websites', 'slug' => 'technical-seo-persian-websites', 'excerpt' => 'Persian WordPress sites suffer from predictable Core Web Vitals problems — oversized Vazirmatn fonts, unoptimized hero images, and RTL layout bugs. Here is the fix list I actually ship.', 'category' => 'web-performance-seo', 'tags' => ['seo', 'performance'], 'cover' => 'Core Web Vitals checklist for Persian websites', 'views' => 1900, 'likes' => 130, 'days_ago' => 11, 'body' => <<<'TEXT' # Technical SEO and Core Web Vitals for Persian websites Every few weeks I get a message that goes roughly like this: "My Persian site is beautiful, I rank for my keywords, but traffic is flat and Search Console says my pages are not good for users." Then they attach a PageSpeed report. Almost every time, the numbers are bad in the same three places: LCP, INP, and CLS, and the causes are the same too: a heavyweight WordPress theme stacked with plugins, Persian webfonts loaded like a multi-megabyte download, and hero images uploaded untouched. This is not a rare condition. It is the default state of much of the Iranian web, and one competent developer can turn it around in a week. ## Why Persian sites score badly, in practice The typical case: a WordPress install running a Persianized theme, plus a page builder, a font plugin, a slider, social widgets, a chat widget, and an analytics snippet copied from a global tutorial. That is forty to seventy requests and three to five megabytes of transfer. On the mobile connections most Iranian visitors actually have, LCP lands between four and eight seconds. Fonts are the most common culprit, and they are uniquely bad for Persian. Latin fonts ship small glyph subsets and the browser drops unused weights. Persian script carries larger connected glyph sets, and families like Vazirmatn, Estedad, or Sahel include many weights. A theme loading six weights as separate files ships far more glyph data than any page needs. ## The RTL dimension most guides skip RTL is not just setting direction on the body. Line metrics, text rendering, and layout stability all change. Persian text is taller than Latin at the same font-size because of descenders, diacritics, and ZWNJ. Many Latin-derived CSS resets under-size line-height for Persian, so lines clip or overlap, and fixing that later shifts the layout, which makes CLS worse rather than better. Test with real strings containing ک, گ, ی and Persian digits ۰۱۲۳, never placeholders. Bidirectional text is the other trap. A page with embedded English product names, mixed currency prices, or code snippets will show flipped parentheses and misplaced punctuation if isolated left-to-right runs are not handled. No automated test flags that. ## What Google actually does with fa pages Google Discover behaves differently in this market, and it comes up on nearly every client call. It leans hard on structured data and visually rich feeds, and its availability and click-through rate inside Iran is not comparable to organic search. Discover-first strategies that work for large international brands do not transfer cleanly. So prioritize being fast, crawlable, and indexable, then add Article, BreadcrumbList, and Organization schema where it is genuinely accurate rather than treating Discover as the plan. ## Fonts: the highest-leverage fix Stop loading a font family. Load one family, two weights maximum, and only the weights visible above the fold. Preload the primary woff2 file so the browser starts fetching before it finishes parsing CSS, and subset to Persian plus Latin digits where you can. Set `font-display` deliberately, because the common values behave very differently. `swap` creates an invisible-text window where fallback Latin metrics render and the Persian text then reflows into place, a direct CLS contributor. `optional` avoids that reflow, but a visitor on a cold cache may see the fallback. For a Persian content site where the typeface carries brand value, I usually test `optional` with a tight preload and let field data decide. ## Images and the LCP element On most Persian sites the LCP element is the hero image or the logo. Compress it, serve AVIF with a WebP fallback, size it to the largest layout slot, and declare explicit `width` and `height` so the browser reserves space before paint. Lazy-load everything below the fold, and never the LCP candidate, which is the most common self-inflicted regression I see. ## Hosting and network reality in Iran This is where a Western checklist stops being directly usable. Iranian visitors frequently hit high latency and packet loss toward European and North American origins, and access to some CDNs is inconsistent. A Cloudflare-fronted site can be excellent in Frankfurt and mediocre in Tehran, so judge any acceleration decision from real-user data inside Iran. My default: host in Iran if your audience is entirely domestic, or in a nearby region such as Istanbul or the Gulf with a CDN in front and aggressive caching. Never cache HTML for more than a few minutes, cache static assets for a year behind versioned URLs, and compress text with Brotli. ## The practical checklist - Cut plugins to only what earns its place; every script is a dependency you do not control. - Load one Persian font family, two weights, subset and preloaded. - Give every image explicit dimensions, use AVIF, never lazy-load the LCP image. - Verify line-height and baseline with real Persian strings. - Choose `font-display` on purpose and confirm with field CLS. - Brotli the text, long-cache static assets, short-cache HTML. - Review mixed Persian and Latin pages by eye for bidi problems. - Add structured data only where it reflects the real page. - Compare before and after with real-user monitoring segmented by country. Core Web Vitals are not mysterious, and for a Persian site they are rarely about cleverness. They are about removing weight, choosing fewer font weights, and measuring from where your users actually are. TEXT, ], [ 'title' => 'Freelancing and remote work for developers in Iran: a practical field guide', 'slug' => 'iranian-developers-freelancing-remote', 'excerpt' => 'Rates are not the lever. Public evidence, payment rails that survive Iranian residency, tight scopes, and scam avoidance are — a practical field guide to sustainable remote income.', 'category' => 'programming-careers', 'tags' => ['freelancing', 'career'], 'cover' => 'Remote freelancing playbook for Iranian developers', 'views' => 2200, 'likes' => 160, 'days_ago' => 9, 'body' => <<<'TEXT' # Freelancing and remote work for developers in Iran: a practical field guide I have hired Iranian developers, worked alongside them as a contractor, and mentored juniors in Tehran and Shiraz. This is what separates the ones who build durable international income from the ones stuck bidding for the same three-line feature. ## Position on outcomes, not on hours The biggest shift in my own career was from selling hours to selling results. A developer who says "I build dashboards, twenty-five dollars an hour" competes with the entire global supply of developers at the bottom of the market. The same developer who says "I rebuilt your analytics pipeline and reporting dropped from two days to twenty minutes" competes with almost nobody. Pick one or two problems you can measurably improve: load time, conversion, churn, deploy frequency, infrastructure cost, pipeline latency. Write about them with numbers attached. Evidence beats a rate card every time. ## Build a portfolio that works while you sleep Three things, in order of weight. Deployed projects people can click. A working product beats a screenshot of one. If you cannot deploy for a client, deploy for yourself and let strangers use it. A technical blog. I have received inbound offers specifically because of posts I wrote years earlier. Write about problems you solved, including the trade-offs and the mistakes. A blog is proof of how you think. A clean, active GitHub. Readable history, sensible issues, small focused pull requests, an honest README. Buyers do not test your skills in a call. They check whether you look like someone who would embarrass them, and public work does that screening for free. ## Landing the first foreign client Nobody discovers a brand-new freelancer, so go where the work is described, and go narrow. Cold outreach works when it is specific: I read your pricing page, here is the one thing that looks wrong, here is what I would change, here is comparable work. Follow up twice, then stop. Communities beat cold mail. Technical forums, maintainers who need help, indie hacker circles, and small agencies who subcontract overflow. Agencies in particular, because a reliable subcontractor gets repeat work. Domestic platforms such as ParsiFox are fine for the first invoice, which is always the hardest. ## Money: the part most advice skips Let me be blunt. For an Iranian contractor, getting paid is harder than doing the work, and you should solve this before you sign anything. Establish what is legally available where you live. Escrow providers, international processors, and banking relationships that accept Iranian residents are real options, but availability, fees, and compliance requirements shift. Read the current terms, and if the sums justify it, get professional advice on your tax position. Cryptocurrency has become the default settlement path many Iranian freelancers use, precisely because it avoids banking friction. It also brings volatility, irreversible-transfer risk, counterparty risk, and regulatory ambiguity. I use it. I do not romanticize it. Convert earnings into something stable to hold, and never accept "trust me, the transfer is on its way." Two habits have saved me money more than once: always use escrow or milestones, and never start without a written scope and a deposit. ## Contracts, scope, and timezones A short written agreement protects both sides. It needs a defined deliverable, a number of revision rounds, payment terms and currency, IP ownership and when it transfers, a kill fee, and a dispute path. One page is enough. Scope creep is not client evil, it is undefined work. When a request falls outside the agreed deliverable, I quote it separately with its own timeline. That habit roughly doubled my effective rate without raising my price. Iran is UTC+3:30, far more workable than people assume. You overlap comfortably with European morning hours, the Gulf, India, and South-East Asia. US East Coast is reachable in early evening Iranian time. US West Coast means midnight, which is why I stopped taking those clients years ago. Choose niches where your hours are an advantage: overnight deployments, asynchronous review, follow-the-sun work. ## Avoiding scams and reading the domestic market The scam red flags are consistent: a vague project, an implausibly generous budget, refusal of any video call, a demand to pay money upfront to "unlock the platform," or an offer to pay you to receive and forward funds. That last one is money laundering. Verify identity first, break work into small milestones, keep every instruction in writing, and never send funds to an address dictated over a voice call. Iranian freelance work pays a fraction of international rates. It is also low-friction and produces references you can use immediately. The problem is that many domestic projects are priced by feature count with no maintenance budget behind them, which is how you support one codebase for years. For juniors I advise taking two or three domestic projects to build a portfolio, then steering toward clients who value what you do rather than winning the cheapest bid. The learning curve is identical, the compounding is not. ## What actually compounds Rates plateau early unless you move toward higher-leverage work: architecture, performance, data, security, or part ownership of a product. Every year, either your scope gets wider or your number gets smaller. The developers doing well did not work the most hours. They made one thing public, wrote about it honestly, and let that compound while they started the next thing. TEXT, ], [ 'title' => 'AI and the future of programming jobs for developers in Iran', 'slug' => 'ai-coding-careers-iran', 'excerpt' => 'An honest 2026 look at which AI skills keep Iranian developers relevant, what genuinely stays human, and why falling six months behind matters more than any model.', 'category' => 'programming-careers', 'tags' => ['ai-tools', 'career'], 'cover' => 'Staying relevant when AI writes boilerplate', 'views' => 2000, 'likes' => 145, 'days_ago' => 6, 'body' => <<<'TEXT' # AI and the future of programming jobs for developers in Iran I have hired and mentored plenty of developers, so when someone asks whether AI is coming for their job, I answer from daily use rather than from a conference stage. I use it for refactors and gnarly bug hunts, for the tedious half of a form, and for generating five layout variants in thirty seconds. ## What AI genuinely automates well Boilerplate and scaffolding. A CRUD layer, a typed API client, a component with props and tests, a migration. That was already low-value work I was mildly embarrassed by. Now it is nearly free, and I am glad about it. Retrieval-shaped work: finding the right file in an unfamiliar codebase, tracing where a value comes from, explaining a tangled module. And the first draft of tests, types, and documentation. ## What it does not touch Requirements are still hard. Knowing what to build, and more importantly what to refuse, comes from talking to users and understanding how a business makes money. I have watched AI implement a feature nobody wanted, beautifully and quickly, and it was worth nothing. Debugging in production is not writing the code that throws. It is instrumenting, reading logs, forming a hypothesis, and deciding which of ten plausible causes is the real one. That is slower than generation and far more valuable. Architecture is accountability. Where does state live, what is the migration path, how do we roll back at two in the morning, who explains the trade-off six months from now. A model can propose an answer; a human signs it. Code review has changed rather than shrunk. There is more generated code, so the work shifts to verifying whether it is correct, idiomatic, secure, and consistent with its surroundings. That skill pays more than writing it. I have also noticed AI is weakest exactly where Iranian developers often work: legacy PHP and WordPress codebases, integrations with local payment gateways, systems with no tests and no docs. It guesses with total confidence, and you have to read everything. ## The part that actually decides your income Here is my honest 2026 assessment. The floor of this market is falling fast; routine implementation work is priced lower every quarter. The ceiling is not moving. For an Iranian developer specifically, the constraint is not that your coding is worse. The developers I work with are excellent. The constraint is access: to the market, to the English discourse where fast knowledge lives, and to the organizations that pay international rates. So the leverage is English plus fundamentals plus shipping, not English plus AI tooling. These tools compress the gap between a beginner and a competent developer on a well-specified task. They do not close the gap between someone who understands the domain and someone who does not. ## How to position now - Move toward work where AI output needs human judgment: product sense, debugging, performance, security, data modelling, architecture review. - Learn to review generated code as your core competency. Prompting is table stakes; verification is the job. - Own the whole slice: problem, design, build, deploy, measure, maintain. Someone accountable for outcomes is not a code generator. - Write in English. Technical writing is both a learning mechanism and my best inbound lead source. - Learn infrastructure: Linux, Docker, CI, databases, observability. That is what separates a senior from a fast junior. ## Advice for juniors in Iran The junior pipeline is where I have the most concern and the most hope. Bad advice: learn a framework, ship nothing, wait for a job. Frameworks were always the part that got automated. Better advice. Spend your first year on fundamentals: data structures, networking, databases, operating systems, and reading other people's code. AI cannot teach you taste because it has none. Ship small real things immediately, because a tool your family uses beats a portfolio of tutorial clones. Learn English by consuming technical English: docs, source, issue threads. Use AI as a pair, but attempt it yourself first. If you ask for the solution immediately, you are training yourself to be the person who cannot work without autocomplete, which is the job being automated. And get your code reviewed by someone better than you. ## The real threat AI is not the threat to Iranian developers. Being six months behind is. The developers I worry about are not the ones whose jobs vanish next year. They are the ones who spent two years waiting to see whether all of this was really going to matter, and are now finding that the baseline of what a junior must deliver moved up. The developers I do not worry about are the ones shipping publicly, in English, with AI in the loop, and accountable for what they ship. ## Where I land AI makes the first eighty percent of many tasks much cheaper and faster, and sharply raises the value of the last twenty percent. Jobs do not disappear, but their shape changes: fewer people maintaining large volumes of hand-written code, more people owning systems and outcomes. If you are in Iran and worried, do not compete with the model on volume. Become the engineer whose judgment is hard to fake and whose work is easy for anyone to evaluate. I have never seen a shortage of clients for that person. I have seen a shortage of them everywhere. TEXT, ], [ 'title' => 'Web design for Iranian small businesses: what actually works', 'slug' => 'web-design-iranian-businesses', 'excerpt' => 'What I have learned rebuilding business websites in Iran: a fast, trustworthy RTL site that sells, instead of a pretty brochure nobody can load on mobile.', 'category' => 'frontend-development', 'tags' => ['design', 'performance'], 'cover' => 'A fast, trustworthy RTL website for Iranian small businesses', 'views' => 1800, 'likes' => 125, 'days_ago' => 14, 'body' => <<<'TEXT' # Web design for Iranian small businesses: what actually works Most small business websites in Iran are built by whoever happened to be free last week, on a template from a marketplace, and then never touched again. I have audited enough of them to say the pattern is consistent: the owner wants more customers, and the site delivers a slideshow. Here is what I have seen actually work when I rebuild these, and what I deliberately leave out. ## What almost every one of them gets wrong - The brochure site. A hero image, an about paragraph written in 2017, a contact form nobody monitors, and no way to buy, book, or reserve anything. It exists for decoration and for printing on a business card. - The hero carousel. Three to five rotating banners, crossfading every four seconds, each with an oversized Persian headline and a drop shadow. On a mid-range Android phone this is the main reason the page feels slow, and nobody waits. - Font bloat. Loading Vazirmatn, Estedad, Samim, IRANSans and a Persian numeral font, each in multiple weights, all at once. Persian webfonts are large, and mobile data on Iranian plans is not unlimited the way people assume. - Desktop first. Designed at 1440px and then squeezed. The navigation collapses into a broken hamburger and the phone number ends up in a tiny footer nobody taps. - No trust signals. An unofficial logo, no address, no licence, no reviews. ## What these sites actually need Start with a clear mobile first RTL layout. Most traffic is Android on a mid-range device, arriving from an Instagram bio or a Telegram channel. So: right aligned text, `dir="rtl"` on the document, a sticky bottom bar with call and WhatsApp buttons, and exactly one obvious action per screen. Reading order should match how Persian text is actually scanned. Persian typography without bloat is simpler than people assume. One variable font file, two or three weights, `font-display: swap`, self hosted, nothing else. Body text at 16 to 17px with line height near 1.9, because Persian needs more vertical space than Latin. Keep prices in Latin digits so people can compare them, but format dates and phones the way your customers expect. Speed is a trust signal here. My target is LCP under 2.5 seconds, ideally under 1.8, measured on a throttled Iranian mobile connection where latency is often 60 to 120ms even on a fast plan. That means one properly sized hero image in AVIF or WebP with explicit dimensions, no render blocking CSS, no carousel library, and lazy loading below the fold. Trust elements are what convert, and they are boring: your real street address with a map embed, your business licence and the enamad (نماد اعتماد) badge if you have one, a phone number a human answers, WhatsApp with a pre-filled message, opening hours including that the Iranian week runs Saturday to Thursday, and real testimonials with names and dates. For maps use Neshan or Mapir embeds, because Google is filtered on most Iranian networks, and keep the address as plain text so it can be copied into any app. ## Commerce that converts on Iranian phones Most of these businesses need a catalog, not a checkout platform. A grid of products or services, each with one photo, a price, and a WhatsApp button that opens a message with the product name already written. That converts better than a cart, because the buyer finishes the order inside the app they already use. If customers are on limited plans, prepaid data, or weak WiFi, say call to reserve instead of shipping a booking flow. Fewer plans means fewer decisions. ## The rebuild checklist - Crawl the current site and record traffic, top landing pages, and every indexed URL before changing anything. - Keep every URL that has traffic and 301 the rest to the closest equivalent. - Cut the carousel, the sliders, and every plugin whose only job is animation. - Consolidate to one self hosted variable Persian font. - Rebuild the hero as a single real photo or product shot, not a designed graphic. - Add the trust block: address, map, licence, phone, WhatsApp, hours, reviews. - Replace the contact form with a real inbox plus the WhatsApp button. - Compress every image and add width and height attributes. - Run Lighthouse on a mobile profile and aim for 90 plus on performance, accessibility, and SEO. - Set up Search Console with a clean sitemap, or a first party analytics tool. ## What it costs A marketplace template theme runs a few million Toman, and you will spend more fixing it than you saved. A well built custom Next.js or static site for a small business lands roughly 15 to 45 million Toman, depending on page count, whether there is a catalog, and whether the owner gets a headless CMS to edit content. Hosting and care sit on top as a small monthly figure. Treat the Toman number as the anchor, since exchange rates move and comparisons across currencies mislead. ## The point A small business site does not need to impress designers. It needs to load in a few seconds on a cheap phone, say exactly what the business sells and how to reach it, and look like a real business with a real address. Everything else is decoration. TEXT, ], [ 'title' => 'The React job market in Iran: full-time employment or freelance', 'slug' => 'react-nextjs-job-market-iran', 'excerpt' => 'How Iranian React and Next.js developers should choose between a salaried job and independent work in 2026, including what the market actually pays.', 'category' => 'programming-careers', 'tags' => ['react', 'nextjs', 'career'], 'cover' => 'React and Next.js careers in Iran in 2026', 'views' => 2100, 'likes' => 150, 'days_ago' => 3, 'body' => <<<'TEXT' # The React job market in Iran: full-time employment or freelance Almost every week someone asks me whether they should keep applying for React jobs in Iran or go independent. The honest answer is that both paths exist, they pay very differently, and the right choice depends mostly on your level and your runway, not on the framework. This is the market as I see it in 2026. ## What demand actually looks like React is still the default for anything product shaped in Iran: dashboards, admin panels, SaaS products, and large e-commerce and content sites. Next.js is close to mandatory for anything public facing. But the market is smaller than it was a few years ago. Funding is tight, teams are small, and much of the supposed startup work is really maintenance on older products. The result is that the bar moved up. A junior React developer without strong fundamentals is struggling. A senior engineer who can own a feature from design to production is not struggling. ## The stacks that get you hired - TypeScript everywhere, strict mode, no `any` in a pull request. - The Next.js App Router with React Server Components, Server Actions and streaming, plus real judgement about where the client boundary belongs. - Data layer competence: Prisma or Drizzle, SQL that is not a toy, and knowing when a query is the actual problem. - Testing that is not decoration: Vitest or Jest with React Testing Library, and Playwright for the critical flows. - Performance and observability: Core Web Vitals, caching strategy, bundle budgets, error tracking. - Enough backend to never be blocked: Node, queues, cron, auth, object storage, and a deployment you can debug at 2am. - Docker, CI pipelines and infrastructure as code, at least enough not to be the bottleneck. Contract work usually asks for the full width of that list. That is why people here describe themselves as full stack even when the backend is one file. ## Compensation reality For in-office roles in Tehran, a strong mid to senior React or Next.js engineer typically lands between 60 and 120 million Toman per month, with the top of that range concentrated in product companies and consultancies with foreign clients. Staff and lead roles go higher, but there are very few of them. Junior and mid roles cluster much lower, and the spread between tiers is wide. Then there is remote work for Iranian contractors, where the real spread appears. Remote for an Iranian company usually pays less than the in-office equivalent, because you save them rent and they know it. Remote for a client abroad pays multiples more in hard currency, but the obstacles are concrete: sanctions, difficulty opening accounts and receiving payments, overlapping European hours, and interviews in English. It is not impossible, and plenty of engineers I know manage it, but it is not a default plan. ## Employment or freelance - Under two years of real experience: take employment. You need code review, mentorship, and someone else owning the outages. - Two to five years with a network: hybrid works best. Salary for stability, evenings or weekends for retainers. - Senior, with reputation and roughly six months of runway: freelance can beat a salary, but only with a written contract, a deposit, and strict scope control. - If you pay rent or family bills from this income: keep the salary. Freelance income is lumpy and a quiet month is normal, not a failure. ## The engine that actually gets offers - Two or three deep case studies, each with the problem, the constraints, your decisions, and one number. Numbers land harder than screenshots. - English, written first. Most remote conversations hire partly on how clearly you explain things in writing. - One real open source contribution. Not a tutorial clone, a pull request or a small library with actual users. - A clean LinkedIn and a portfolio site that loads fast. A slow portfolio is a bad signal in this field. ## Negotiating Do not name your current salary first. Ask for the approved range. Remember that Iranian employees contribute to social insurance through payroll, which is a meaningful part of the package compared with invoicing as a freelancer, where you cover the full amount yourself. Ask about bonuses, working hours, leave, and whether they pay for your tools or training. With foreign clients, get the currency, rate and payment terms in writing before you start, and always take a deposit. Choose employment when you still need to learn fast. Choose freelance when you already have the skill and the network. The market will not decide this for you. TEXT, ], [ 'title' => 'Moving from WordPress to Next.js: a migration guide for Persian websites', 'slug' => 'wordpress-to-nextjs-migration', 'excerpt' => 'The staged path from a slow WordPress site to a fast Next.js one, keeping Persian content, Persian URLs and search traffic intact.', 'category' => 'react-nextjs', 'tags' => ['react', 'nextjs', 'performance'], 'cover' => 'WordPress to Next.js migration roadmap', 'views' => 2300, 'likes' => 170, 'days_ago' => 1, 'body' => <<<'TEXT' # Moving from WordPress to Next.js: a migration guide for Persian websites WordPress still runs a large share of the Persian web, from small company sites to large publishers. It got there for good reasons, but many of these sites score badly on Core Web Vitals because of the theme and page builder, not the content. This is the staged path I use when a client wants Next.js without losing search traffic. ## Why the question comes up so often - WordPress dominates the Persian web, so most businesses already have years of URLs, backlinks and content they refuse to lose. - Page builders like WPBakery, Elementor and Divi ship large CSS and JavaScript bundles, jQuery and enormous DOM trees. That is what kills LCP and INP, not the images or the hosting. - Persian plugins for forms, sliders, SEO and translation each add weight, and each is a maintenance and security risk. - The owner wants to edit content without touching code, and that need survives the migration. ## Stage one: audit and baseline Record the numbers before changing anything, so you can prove the migration worked. Crawl the site and export every indexed URL with its status code, title and canonical. Pull a year of Search Console data and note the top landing pages. Run Lighthouse on a few representative templates with a mobile profile and save the LCP, INP and CLS values. Check the analytics setup, because that is what breaks silently in every migration. ## Stage two: get the content out The REST API is the clean route for standard content: each post type is an endpoint, results are paginated, so script it and follow pages until you have everything. Watch for custom post types and advanced custom fields, since the default endpoint does not return custom fields and you must register them first. For a large site a WP-CLI export to JSON gives you the whole database in one file. Export media separately, keeping original filenames. ## Stage three: choose the content architecture You have two honest options. Keep WordPress as a headless CMS and fetch content at build or request time: your client keeps the editor they know, you get the Next.js frontend, and you accept a moving target. Or import everything into markdown, MDX or a headless CMS and generate static pages, which is fastest when content changes only a few times a week. Most of my clients end up with static content plus a small editing tool for the pages that genuinely change. ## Stage four: routes, slugs and redirects This is where migrations are won or lost. Map every old URL to a new one and keep the path structure identical so the work is mechanical. If you cannot preserve a URL, 301 it to the closest equivalent, never to the homepage. Keep Persian and Arabic slugs exactly as they were, unchanged and un-normalised, because altering them breaks links and makes the site look new to search engines. Do not forget pagination, archives, tag pages, feeds and attachment pages, all of which are usually indexed. Generate the new sitemap. ## Stage five: build it fast Use static generation by default, adding revalidation only where content changes daily: the App Router with static rendering, plus incremental revalidation for pages like a news index. Serve images through the framework image component, sized per breakpoint, in modern formats. Set language and direction on the document element with `lang="fa"` and `dir="rtl"`, and write CSS with logical properties such as `margin-inline-start` instead of left and right, so one stylesheet works both ways. ## Persian typography, properly Do not reach for the Google Fonts loader. Google Fonts is filtered on most Iranian networks, so a font fetched from a Google domain fails or falls back to a system font and flashes. Download a variable Persian font such as Vazirmatn, self host it, and register it with `next/font/local` so Next.js handles the preload and size adjust. One file, two or three weights, `font-display: swap`, and correct line height. Check Persian digits and calendar dates before launch. ## The gotchas - Media URLs. Copy uploads to the new host or object storage, keep filenames identical, and fix hardcoded references in old posts. Stale image URLs cause mixed content warnings. - Comment forms. Plugin based comments rarely survive. Decide early whether you keep comments, and if you do, plan a simple form plus moderation rather than porting the old system. - Analytics. Google services are unreliable from inside Iran. Confirm your provider loads for your visitors, or self host a first party cookieless tool so you do not lose history and restart from zero. - Search. The WordPress search endpoint will not exist. If the site relied on it, add a real index or accept site search. - Mixed content and plain http URLs inside old content, plus inline styles and scripts nobody audited. - Testing every redirect with curl, then a final Lighthouse run on the templates you measured at the start. ## What success looks like Compare before and after on identical pages. On the sites I have moved, LCP typically drops from four or five seconds to under two, and INP improves even more because the page builder is gone. Traffic should be flat within a few weeks once redirects settle, and often grows because of the speed. Migrate one template at a time. TEXT, ], // ================================================================= // Persian posts // ================================================================= [ 'title' => 'نکست و اپ روتر: چرا سرور کامپوننت‌ها نحوه‌ی ساخت وب‌سایت را تغییر دادند', 'slug' => 'nextjs-app-router-server-components-fa', 'excerpt' => 'اپ روتر و سرور کامپوننت‌ها فقط APIهای جدید نیستند؛ محل اجرای کد را تغییر می‌دهند. در این مقاله می‌بینید چطور حجم باندل کم، بازیابی داده ساده‌تر و صفحه‌ها سریع‌تر شدند.', 'category' => 'react-nextjs-fa', 'tags' => ['nextjs-fa', 'react-fa'], 'cover' => 'راهنمای اپ روتر نکست', 'views' => 3100, 'likes' => 205, 'days_ago' => 2, 'body' => <<<'TEXT' # اپ روتر در نکست ## چه چیزی واقعاً تغییر کرد جابه‌جایی از روتر پیج‌ها به اپ روتر بزرگ‌ترین تغییر نکست از زمان انتشارش است. لِی‌آوت‌ها قابل اشتراک شدند، حالت‌های بارگذاری تودرتو به امری عادی تبدیل شدند و سرور کامپوننت‌ها بیشتر کار رندرینگ را از کلاینت برداشتند. ## حلقه‌ی اول: کد شما کجا اجرا می‌شود؟ - کامپوننت‌ها پیش‌فرض کامپوننت سرور هستند و فقط HTML ارسال می‌کنند. - باندل جاواسکریپت دیگر کدی را که لازم نیست در مرورگر اجرا شود حمل نمی‌کند. - «use client» حالا انتخابِ صریح است، نه رفتار پیش‌فرض. ## بازیابی داده‌ی ساده‌تر در روتر پیج‌ها برای هر صفحه باید `getServerSideProps` یا `getStaticProps` جدا می‌نوشتیم. در اپ روتر مستقیم داخل کامپوننت داده می‌گیریم و خود نکست درخواست‌ها را یکتا می‌کند و کش می‌کند. همین یک دسته از باگ‌های سال‌ها‌نرم‌افزار را حذف کرد. ## نتیجه‌ی قابل اندازه‌گیری ملموس‌ترین دستاورد کاهش حجم باندل بود. صفحه‌ی اصلی همین وب‌سایت حدود ۱۸۰ کیلوبایت جاواسکریپت کمتر تحویل می‌دهد و بزرگ‌ترین محتوای نقاشی‌شده از ۲٫۴ ثانیه به حدود ۱٫۱ ثانیه در موبایل محدودشده رسید. ## چه زمانی از کامپوننت کلاینت نگه داریم؟ - فرم‌های تعاملی با به‌روزرسانی خوش‌بینانه. - کامپوننت‌هایی که به رویدادهای مرورگر مثل اسکرول گوش می‌دهند. - هر چیزی که از Context برای وضعیتی که مدام تغییر می‌کند استفاده می‌کند. سرور-اول پیش‌فرض عالی‌ای است، اما «use client» در مرزِ درست همچنان انتخابِ صحیح است. مهارت این است که این مرز را کجا بگذاری. ## جمع‌بندی به مرز سرور و کلاینت به چشم یک تصمیم عملکردی نگاه کن، نه یک مد. رندر روی سرور به‌عنوان پیش‌فرض و ارسال فقط آنچه واقعاً به مرورگر نیاز دارد، الگویی است که با محصول هم رشد می‌کند. TEXT, ], [ 'title' => 'وب وایتل‌های اصلی؛ راهنمای عملی LCP، INP و CLS', 'slug' => 'core-web-vitals-practical-guide-fa', 'excerpt' => 'LCP، INP و CLS سنجه‌هایی هستند که بازخورد واقعی کاربر را می‌سنجند. این راهنما توضیح می‌دهد هر کدام چه چیزی را اندازه می‌گیرند و چه اصلاح‌های مشخصی نتیجه را تغییر می‌دهند.', 'category' => 'frontend-fa', 'tags' => ['performance-fa', 'seo-fa'], 'cover' => 'راهنمای وب وایتل‌ها', 'views' => 5200, 'likes' => 460, 'days_ago' => 5, 'body' => <<<'TEXT' # وب وایتل‌های اصلی؛ راهنمای عملی LCP، INP و CLS ## چرا این سه سنجه مهم هستند گوگل از وب وایتل‌ها به‌عنوان سیگنال تجربه‌ی کاربر در رتبه‌بندی استفاده می‌کند. این سنجه‌ها چیزی را توصیف می‌کنند که کاربران واقعی تجربه می‌کنند، نه فقط نتیجه‌ی یک تست آزمایشگاهی، پس بهبود آن‌ها کارِ واقعی روی محصول است. ## Largest Contentful Paint (LCP) LCP زمان بارگذاری بزرگ‌ترین عنصر بالای صفحه را اندازه می‌گیرد. هدف زیر ۲٫۵ ثانیه است. - تصویر قهرمان و استایل‌شیتِ مؤثر روی آن را از قبل پیش‌بارگذاری کن. - تصاویر را با ابعاد درست و فرمت مدرن تحویل بده. - اسکریپت‌های شخص ثالثِ بلاک‌کننده را از مسیر بحرانی حذف کن. ## INP یا فاصله تا Paint بعدی INP جایگزین FID شده و بدترین پاسخ به تعامل کاربر را اندازه می‌گیرد. حد خوب ۲۰۰ میلی‌ثانیه است. - کارهای طولانی روی ترد اصلی را زیر ۵۰ میلی‌ثانیه نگه دار. - کارهای غیرضروری را تا بعد از تعاملی‌شدن صفحه عقب بینداز. - به‌جای اجرای هندلر گران روی هر رویداد، آن را debounce کن. ## Cumulative Layout Shift (CLS) CLS به صفحه‌هایی پاداش می‌دهد که هنگام بارگذاری نمی‌پرند. امتیاز زیر ۰٫۱ خوب محسوب می‌شود. - برای تصاویر و محتوای جاسازی‌شده با ابعاد صریح فضا رزرو کن. - از درج محتوا بالای محتوای موجود پس از شروع بارگذاری خودداری کن. - با نگه‌داشتن متریک‌های جایگزینِ فونت، از جابه‌جایی متن جلوگیری کن. ## چطور کارت را چک کنی برای یک بررسی سریع از Lighthouse استفاده کن و بعد آن را با داده‌ی میدانی CrUX ترافیک واقعی خودت مقایسه کن. عملکرد میدانی همان چیزی است که موتور جست‌وجو نهایتاً می‌بیند. ## جمع‌بندی عملکرد یک چک‌لیست یک‌باره نیست. هدف‌ها را مشخص کن، سنجه‌ها را به CI اضافه کن و هر انتشار که آن‌ها را عقب می‌برد را یک باگ حساب کن. TEXT, ], [ 'title' => 'طراحی APIهای REST با لاراول؛ اعتبارسنجی، ریسورس و محدودسازی نرخ', 'slug' => 'laravel-api-validation-resources-throttling-fa', 'excerpt' => 'قطعه‌هایی که API لاراول را تمیز و امن نگه می‌دارند: فرم ریکوئست برای اعتبارسنجی، API ریسورس برای شکلِ پاسخِ یکدست و throttling برای حفاظت از مسیرهای عمومی.', 'category' => 'backend-fa', 'tags' => ['laravel-fa', 'clean-code-fa'], 'cover' => 'آموزش API با لاراول', 'views' => 1600, 'likes' => 130, 'days_ago' => 9, 'body' => <<<'TEXT' # طراحی APIهای REST با لاراول ## از شکل پاسخ‌ها شروع کن سریع‌ترین راه برای دل‌پسندکردن API نزد مصرف‌کننده، شکلِ پاسخِ پایدار است. API ریسورس‌های لاراول یک نقطه‌ی واحد برای تعریف آن می‌دهند تا فرانت‌اند هیچ‌وقت مجبور نباشد حدس بزند که خروجی آبجکت است، آرایه است یا چیزی وسط. ## اعتبارسنجی متعلق به Form Request است نوشتن قوانین داخل کنترلر جواب می‌دهد ولی مقیاس نمی‌شود. با Form Request اعتبارسنجی، مجوزدهی و قوانین کنار هم می‌نشینند و می‌شود جداگانه تستشان کرد. - قوانین را به دامنه‌ی مربوطه بچسبان. - خطای پیش‌فرض ۴۲۲ را برگردان؛ بیشتر کلاینت‌ها آن را بلدند. - برای موارد خاص، چند rule سفارشی بنویس به‌جای اینکه شرایط را در کنترلر تلنبار کنی. ## محدودسازی نرخ یک ویژگی امنیتی است، نه یک آپشن یک مسیر عمومیِ نوشتن تا وقتی throttle نباشد طعمه‌ی اسپم است. برای مسیر، محدودیتِ منطقی (مثلاً چند درخواست در دقیقه) بگذار و بعد ببین کلاینت‌های واقعی به چه چیزی نیاز دارند. ## این وب‌سایت چه می‌کند API وبلاگ و سایت دقیقاً همین الگو را دنبال می‌کنند: فرم ریکوئست برای اعتبارسنجی، JSON ریسورس برای خروجی، و throttle برای هر مسیر تا ترافیک ناشناس نتواند دیتابیس را غرق کند. ## جمع‌بندی قراردادهای کوچک و خسته‌کننده از انتزاع‌های هوشمند بهترند. شکلِ پاسخِ یکدست، اعتبارسنجی متمرکز و throttle منطقی، API را از «روی من کار می‌کند» به «روی همه کار می‌کند» می‌رسانند. TEXT, ], [ 'title' => 'استقرار بدون توقف سرویس با Docker Compose؛ راهنمای گام‌به‌گام', 'slug' => 'zero-downtime-deployments-docker-compose-fa', 'excerpt' => 'آپدیت رولینگ، health check ها و ترتیب دقیق فلگ‌ها؛ چطور یک استک Docker Compose را بدون افتادن حتی یک درخواست به‌روزرسانی کنیم.', 'category' => 'devops-fa', 'tags' => ['docker-fa', 'devops-fa'], 'cover' => 'استقرار با داکر کامپوز', 'views' => 2400, 'likes' => 210, 'days_ago' => 14, 'body' => <<<'TEXT' # استقرار بدون توقف سرویس با Docker Compose ## هدف راه‌اندازیِ مجددی که سایت را چند ثانیه آفلاین کند، استقراری است که بی‌سروصدا شکست خورده. با یک ریورس پراکسی جلوی سرویس‌ها و یک health check پشت آن، می‌شود استک را طوری به‌روزرسانی کرد که کانتینر قدیمی تا وقتی جدید آماده شود به درخواست‌ها پاسخ دهد. ## اول health check ها کامپوز به شما اجازه می‌دهد برای هر سرویس یک healthcheck تعریف کنید. - پراکسی فقط به کانتینرهایی که «healthy» اعلام شده‌اند ترافیک بدهد. - اندپوینت سلامت فقط ۲۰۰ نباشد؛ باید اتصال به دیتابیس پشت آن را هم بررسی کند. - برای بوت اول، start_period سخاوتمندانه بگذار. ## تاکتیک به‌روزرسانی وقتی `docker compose up -d` اجرا می‌کنید، کامپوز کانتینرهای تغییرکرده را یکی‌یکی بازسازی می‌کند. این را کنار یک پراکسی در حال اجرا بگذارید و یک آپدیت رولینگ رایگان دارید. - مهاجرت‌ها و کارهای طولانی را به‌عنوان سرویس جداگانه‌ی one-shot و قبل از ری‌استارت وب اجرا کن. - بگذار کانتینر جدید قبل از حذف کانتینر قدیمی به حالت healthy برسد. - هنگام جابه‌جایی لاگ‌ها را تماشا کن؛ برنامه «بگذار و برو» نیست. ## دیپلوی این وبلاگ واقعاً چه می‌کند اسکریپت استقرار این سایت تصاویر جدید را می‌کشد، قبل از مهاجرت‌ها یک گارد اجرا می‌کند، کانتینرهای جدید را بالا می‌آورد و بعد از آن URL سلامت می‌گیرد تا قبل از اعلام موفقیت، ۲۰۰ بودن را ببیند. همین قدمِ راستی‌آزمایی است که استقرار را از آرزو به واقعیت تبدیل می‌کند. ## جمع‌بندی عدم توقف سرویس ترکیبی از عادت‌های کوچک است: اندپوینت سلامتِ واقعی، پراکسی‌ای که به آن احترام می‌گذارد و اسکریپتی که زود خوشحال نمی‌شود. بررسی‌ها را خودکار کن؛ همکارانت تشکر می‌کنند. TEXT, ], [ 'title' => 'در مصاحبه‌ی فرانت‌اند چه می‌پرسم؟ ۸ سؤالی که واقعاً عملکرد را پیش‌بینی می‌کنند', 'slug' => 'frontend-interview-questions-fa', 'excerpt' => 'سؤال‌هایی که واقعاً در مصاحبه‌های فرانت‌اند می‌پرسم و به چه چیزی در هر پاسخ گوش می‌دهم؛ از رفتار لِی‌آوت تا رفتار با یک بیلد خراب.', 'category' => 'career-fa', 'tags' => ['react-fa', 'clean-code-fa', 'career-fa'], 'cover' => 'سوالات مصاحبه فرانت اند', 'views' => 3900, 'likes' => 370, 'days_ago' => 21, 'body' => <<<'TEXT' # در مصاحبه‌ی فرانت‌اند چه می‌پرسم؟ ## چرا سؤال حفظی نمی‌پرسم از حفظ گفتن اسم یک سری هوک، بلد بودنِ مرور را نشان می‌دهد، نه رفتار روز اول کار را. من قضاوت، مهارت دیباگ و توانایی توضیح دادنِ بده‌بستان‌ها (trade-off) را می‌سنجم. ## سؤال‌ها - بین URL و اولین پنت چه اتفاقی می‌افتد؟ - کی برای بارگذاری داده سراغ `useEffect` می‌روی و چرا معمولاً انتخابِ اشتباهی است؟ - یک کامپوننت با هر تایپ کلید re-render می‌شود. از کجا شروع به بررسی می‌کنی؟ - یک مشکل لِی‌آوت را با `position: absolute` حل کن. کی همین کار اشتباه بود؟ - چطور یک کامپوننت کلاس قدیمی را بدون شکستن اپ مهاجرت می‌دهی؟ - `npm ci` روی CI خراب است ولی محلی کار می‌کند. اول کجا را نگاه می‌کنی؟ - تفاوت LCP و TTFB را برای یک مدیر محصول توضیح بده. - آخرین بار چه موقع چیزی را منتشر کردی که ازش خجالت می‌کشیدی؟ ## به چه چیزی گوش می‌دهم - اسم بردن از مراحل واقعی مرورگر از نقل‌قول مستندات بهتر است. - «بسته به شرایط» گفتن و بعد نام بردنِ همان شرایط، برای من مطلوب‌ترین جواب است. - اعتمادبه‌نفس در دیباگ از جوابِ اولِ بی‌نقص مهم‌تر است؛ می‌خواهم فرایند فکر بشنوم، نه حدس درست. ## جمع‌بندی مصاحبه باید شغل را شبیه‌سازی کند: بده‌بستان، دیباگ و ارتباط شفاف. سؤال‌هایی که این‌ها را پاداش می‌دهند، آن مهندسانی را پیدا می‌کنند که واقعاً تحویل می‌دهند. TEXT, ], [ 'title' => 'سرور کامپوننت‌ها در برابر کلاینت کامپوننت‌ها؛ کدام را کی استفاده کنیم؟', 'slug' => 'react-server-vs-client-components-fa', 'excerpt' => 'مدل ذهنی مرز سرور و کلاینت در ری‌اکت مدرن، با مثال‌های مشخص از اینکه کدام طرف چه چیزی را باید ببیند — و نکست واقعاً چه چیزی را تدوین می‌کند.', 'category' => 'react-nextjs-fa', 'tags' => ['react-fa', 'nextjs-fa'], 'cover' => 'سرور کامپوننت در ریاکت', 'views' => 2800, 'likes' => 250, 'days_ago' => 30, 'body' => <<<'TEXT' # سرور کامپوننت‌ها در برابر کلاینت کامپوننت‌ها ## مدل ذهنی در یک جمله سرور کامپوننت جایی رندر می‌شود که داده‌ی تو آن‌جاست؛ کلاینت کامپوننت جایی که کاربرِ توست. بقیه‌ی ماجرا از همین یک جمله بیرون می‌آید. ## سرور کامپوننت چه چیزهایی می‌دهد - دسترسی مستقیم به دیتابیس و فایل‌سیستم بدون یک API جداگانه. - صفر جاواسکریپت زمان اجرا برای بخش‌هایی که فقط محتوا نمایش می‌دهند. - باندل کوچک‌تر، چون کتابخانه‌هایی که سمت سرور استفاده می‌شوند هرگز به مرورگر نمی‌رسند. ## چه چیزی شما را مجبور به کلاینت کامپوننت می‌کند - State و افکت: `useState`، `useEffect`، هندلر رویداد. - APIهای مرورگر: geometry، media query، storage. - Context و تعامل‌هایی که کاربر باید فوراً حس کند. ## قسمت سخت وسط پراپ‌هایی که از سرور کامپوننت رد می‌شوند داده‌ی سریال‌شده‌اند؛ پس شگفتی در مرز کمین کرده است. - تابع‌ها و instance های کلاس از این مرز عبور نمی‌کنند. - کلاینت کامپوننت‌ها را نزدیک برگ‌های تعاملی نگه دار و سرور کامپوننت‌ها را به سمت ریشه‌های داده ببر. - وقتی یک کامپوننت «هر دو» است، بشکنش: یک پوسته‌ی کلاینت و یک بدنه‌ی سرور. ## این وبلاگ چطور سازمان‌دهی شده صفحه‌ها و بدنه‌ی پست‌ها رندر سمت سرورند و تم‌تغییر و منوی موبایل جزیره‌های کلاینت. همین تقسیم باعث می‌شود سایت تعاملی بماند ولی جاواسکریپت کمی تحویل بدهد. ## جمع‌بندی به‌جای «این کامپوننت هوک دارد پس کلاینت» بپرس کار باید کجا اجرا شود، بعد بقیه را بسپار به فریم‌ورک. TEXT, ], [ 'title' => 'سئو تکنیکال و Core Web Vitals برای وب‌های فارسی', 'slug' => 'technical-seo-persian-websites-fa', 'excerpt' => 'فارسی بودن سایت یعنی فونت سنگین‌تر، چیدمان راست‌به‌چپ و هاستینگی که با CDN خارجی نمی‌خواند؛ اینجا می‌گویم چطور LCP، INP و CLS را برای وب‌های فارسی درست کنم.', 'category' => 'web-performance-seo-fa', 'tags' => ['seo-fa', 'performance-fa'], 'cover' => 'چک‌لیست Core Web Vitals', 'views' => 1900, 'likes' => 130, 'days_ago' => 11, 'body' => <<<'TEXT' # سئو تکنیکال و Core Web Vitals برای وب‌های فارسی هر پروژه‌ی فارسی که تحویل می‌دهم با یک سؤال شروع می‌شود: آیا این سایت برای کاربری که فارسی می‌خواند و روی اینترنت موبایل ایران است، واقعاً سریع بالا می‌آید؟ جواب در بیشتر پروژه‌ها خیر است. دلیلش هم در کد جاوااسکریپت نیست؛ در فونت‌های وب، تصاویر قالب‌های سنگین وردپرس، چیدمان راست‌به‌چپ و محل هاستینگ است. ## چرا Core Web Vitals برای سایت فارسی متفاوت است گوگل سه معیار Web Vitals را سیگنال رتبه‌بندی معرفی کرده است: LCP برای بارگذاری بصری، INP برای تعامل و CLS برای پایداری چیدمان. منطقشان جهانی است، اما ورودی‌هایشان در پروژه‌ی فارسی متفاوت است. فونت فارسی چند برابر سنگین‌تر از لاتین است و اگر درست بارگذاری نشود، هر دو معیار اول به‌شدت آسیب می‌بینند. نتیجه این است که یک سایت فارسی با همان کیفیت کد، امتیاز بسیار پایین‌تری می‌گیرد. ## LCP و سنگینی فونت‌های وب فارسی بزرگ‌ترین عامل مخرب LCP در سایت‌های فارسی تقریباً همیشه فونت وب است. فونت‌هایی مثل وزیرمتن وقتی کل وزن فایل را یکجا بارگذاری می‌کنند، به‌تنهایی چند صد کیلوبایت اضافه می‌کنند. اگر font-display روی swap باشد، متن ابتدا با فونت جایگزین نمایش داده می‌شود؛ یعنی نخستین رندر کاملاً متفاوت از چیزی است که کاربر نهایی می‌بیند. کاری که من می‌کنم: فقط وزن‌های استفاده‌شده را نگه می‌دارم، فایل‌ها را به woff2 تبدیل می‌کنم، subset فارسی می‌گیرم و فایل اصلی را preload می‌کنم. در وردپرس این کار را در فونت‌های خود قالب انجام می‌دهم، نه با پلاگین اضافه. نتیجه معمولاً انتقال LCP از محدوده‌ی قرمز به زرد یا سبز است. ## تصویر قالب‌های سنگین وردپرس در وردپرس، قالب قطورترین منبع مشکل است: اسلایدر چندتصویری، فونت آیکون اضافه، فونت فارسی تکراری و تصاویر بدون ابعاد مشخص، همه با هم جمع می‌شوند. من اول با Coverage و Network در Chrome DevTools می‌بینم کدام درخواست‌ها طولانی و کدام‌ها بی‌استفاده‌اند. معمولاً دو یا سه فایل، هفتاد درصد مشکل را می‌سازند و حذف همان‌ها بیشتر از هر پلاگین کش اثر می‌گذارد. برای تصاویر قاعده‌ی ساده‌ای دارم: AVIF یا WebP با ابعاد صریح، و lazy-load برای هر چیزی که در نمای اول نیست. تصویر LCP را هرگز lazy نمی‌کنم. ## INP و تعامل کاربر فارسی INP در سایت‌های فارسی بیشتر از آنکه به کد مربوط باشد، به رفتار کاربر مربوط است: کاربر روی موبایل و با اینترنت موبایل اسکرول می‌کند و منوی چندسطحی را باز می‌کند. هر منوی همبرگری با جاوااسکریپت سنگین پشتش، یک کاندید INP بد است. من کارهای سنگین را به رویدادهای خاص منتقل و انیمیشن‌ها را به transform محدود می‌کنم. ## CLS و جابه‌جایی فونت فارسی جابه‌جایی محتوا، آزاردهنده‌ترین مشکل ظاهری سایت‌های فارسی است و علتش را دقیقاً می‌دانم: فونت وب با تأخیر می‌رسد و چون ارتفاع خط در فارسی با فونت جایگزین فرق محسوسی دارد، کل محتوای صفحه بالا و پایین می‌پرد. راه‌حل اول، قلم و خط ارتفاع دقیق متناسب با فونت فارسی است؛ دوم، preload فایل اصلی فونت؛ و سوم، رزرو فضا برای تصاویر و اسکلت‌بندی بلوک‌های اصلی. ## RTL، چیدمان و ریسک‌های بومی‌سازی راست‌به‌چپ فقط یک ویژگی ظاهری نیست. انیمیشن اسلاید باید از راست به چپ حرکت کند، آیکون‌های جهت‌دار باید آینه شوند و فاصله‌ها را نباید دستی با left و right نوشت. تست نهایی را همیشه روی مرورگر واقعی موبایل انجام می‌دهم، چون بیشتر باگ‌های بومی‌سازی روی دسکتاپ پیدا نمی‌شوند. ## هاستینگ، کاربران داخلی و مسئله‌ی CDN این نکته‌ای است که در مقاله‌های انگلیسی کمتر درباره‌اش صحبت می‌شود. یک CDN خارجی برای کاربر داخل ایران می‌تواند حتی کندتر باشد، چون مسیر برگشت داده از کاربر ایرانی تا نقطه‌ی لبه‌ی خارجی طولانی و پر از گره است. برای مخاطب ایرانی، هاستینگ یا CDN داخلی معمولاً نتیجه‌ی واقعی بهتری می‌دهد، حتی اگر در تست بین‌المللی ضعیف‌تر باشد. در عمل من ترکیبی تصمیم می‌گیرم: سرور نزدیک به مخاطب اصلی، کش سمت سرور، و CDN برای فایل‌های استاتیک وقتی مخاطب بین‌المللی است. بودجه‌ی مشتری ایرانی محدود است و باید صرف جایی شود که نتیجه‌ی قابل اندازه‌گیری دارد. ## گوگل دیسکاور و معنی واقعی سئو تکنیکال سئو تکنیکال در نهایت یک هدف دارد: ایمکان خزش و ایندکس. در سایت‌های فارسی سه مورد را بیش از حد دست‌کم می‌گیریم. اول، استفاده از «ي» عربی به‌جای «ی» فارسی که دو نسخه‌ی متفاوت از یک آدرس ایندکس می‌کند. دوم، لینک‌های داخلی به آدرس‌های پارامتردار که بی‌نهایت نسخه می‌سازند. سوم، داده‌ی ساختاریافته‌ی نامناسب. این‌ها را قبل از هر بهینه‌سازی سرعتی حل می‌کنم، چون اگر صفحه ایندکس نشود، سریع بودنش بی‌فایده است. ## چک‌لیست عملی که برای هر پروژه اجرا می‌کنم - فونت وب فارسی را به woff2 تبدیل و به وزن‌های استفاده‌شده محدود کنید. - فایل فونت اصلی را preload و font-display را روی swap بگذارید. - تصویر LCP را بدون lazy و با فرمت مدرن بارگذاری کنید. - اندازه‌ی قلم و خط ارتفاع را برای فونت فارسی تنظیم کنید تا CLS حذف شود. - جاوااسکریپت‌های غیرضروری قالب وردپرس را حذف یا defer کنید. - کش سمت سرور را فعال و فایل‌های استاتیک را با طولانی‌ترین عمر کش کنید. - هاستینگ را متناسب با محل مخاطب انتخاب کنید، نه فقط بر اساس قیمت. - مسیرها را یکسان‌سازی کنید تا «ي» و «ی» دو آدرس متفاوت نسازند. - داده‌ی ساختاریافته و متادیتای بومی‌سازی‌شده را بررسی کنید. - نتایج را در Search Console و PageSpeed Insights ثبت کنید. ## جمع‌بندی سئو تکنیکال برای وب‌های فارسی، بیش از آنکه کار فنی باشد، مجموعه‌ای از تصمیم‌های آگاهانه درباره‌ی متن و زبان است. وقتی فونت را سبک می‌کنید، محل سرور را با مخاطب هماهنگ می‌کنید و چیدمان راست‌به‌چپ را جدی می‌گیرید، Core Web Vitals خودبه‌خود بهتر می‌شوند. TEXT, ], [ 'title' => 'فریلنسری و دورکاری برنامه‌نویسان ایرانی؛ راهنمای عملی', 'slug' => 'iranian-developers-freelancing-remote-fa', 'excerpt' => 'از نمونه‌کار و پوزیشن‌نگ تا اولین مشتری خارجی، انتقال وجه و قرارداد؛ نقشه‌ی راه عملی فریلنسری برای توسعه‌دهنده‌ای که از ایران کار می‌کند.', 'category' => 'career-fa', 'tags' => ['freelancing-fa', 'career-fa'], 'cover' => 'راهنمای فریلنسری دورکاری', 'views' => 2200, 'likes' => 160, 'days_ago' => 9, 'body' => <<<'TEXT' # فریلنسری و دورکاری برنامه‌نویسان ایرانی؛ راهنمای عملی هر پروژه‌ای که در سال‌های اخیر پذیرفته‌ام، یک سؤال اول داشته: «از کجا مطمئن شوم خوب کار می‌کنی؟» پاسخ من هیچ‌وقت رزومه‌ی چند صفحه‌ای نبود؛ همیشه نمونه‌کار بود. اگر می‌خواهید به‌عنوان یک برنامه‌نویس ایرانی وارد بازار فریلنسری و دورکاری شوید، این نوشته خلاصه‌ی همان چیزی است که در عمل یاد گرفته‌ام. ## واقعیت بازار: داخل ایران و خارج از ایران بازار داخلی برای شروع سریع‌تر است و پرداخت‌ها قابل پیش‌بینی‌تر. اما سقف نرخ ساعتی پایین است و بیشتر پروژه‌ها یا با چانه‌زنی شدید پیش می‌روند یا پشتیبانی ماهانه‌ی مبهمی دارند. بازار خارجی نرخ به‌مراتب بهتری دارد، اما رقابت شدیدتر است. راهبردی که پیشنهاد می‌کنم: نیمی از انرژی‌تان روی پایه‌ای قابل اتکا در بازار داخلی تا جریان نقدی قطعی داشته باشید، و نیم دیگر صرف رزومه‌ی بین‌المللی و پروژه‌های با نرخ بالاتر شود. ## پوزیشن‌نگ مهم‌تر از رزومه است در فریلنسری، کارفرما یک جمله می‌خواهد: دقیقاً چه کاری برای چه کسی انجام می‌دهید. «برنامه‌نویس React و Next.js» یک مهارت است، نه یک جایگاه. «تبدیل رابط ادمین قدیمی یک شرکت لجستیکی به داشبورد Next.js سریع، با کاهش زمان بارگذاری صفحات از چهار ثانیه به یک ثانیه» یک جایگاه است. دومی در رقابت بر سر نرخ برنده است، چون نتیجه‌ی قابل اندازه‌گیری دارد. توصیه‌ی عملی من: برای هر حوزه‌ای که می‌توانم اثبات کنم، یک جمله‌ی روشن بنویسم و همان را در پروفایل، رزومه و پیام‌های اولیه تکرار کنم. ## نمونه‌کار عمومی بسازید، حتی اگر مشتری ندارید بزرگ‌ترین مانع شروع، نداشتن سابقه است. راه‌حلش ساختن سه نوع نمونه‌کار است، نه سه نوع رزومه. نمونه‌کار اول، مخزن گیت‌هاب است: پروژه‌ای واقعی که خودم از صفر نوشته‌ام، با README درست، تست و کامیت‌های منظم. برای کارفرمای فنی، گیت‌هاب معادل نمونه‌کار است چون روند کار را نشان می‌دهد. نمونه‌کار دوم، مقاله‌ی فنی است درباره‌ی همان چیزی که در آن قوی‌ام: تجربه‌ی واقعی از یک مشکل واقعی، با توضیح تصمیم‌هایی که گرفته‌ام. نمونه‌کار سوم، یک پروژه‌ی زنده است؛ ابزاری کوچک که همین حالا کار می‌کند و کسی می‌تواند امتحانش کند. ساختن این سه مورد چند هفته وقت می‌گیرد و مسیر اولین مشتری را چند ماه کوتاه می‌کند. هیچ پروژه‌ای را که مجاز به انتشار نیست، بدون دمو در پروفایل نمی‌آورم؛ ویدئوی کوتاهی از دموی محلی جای خالی نمونه‌کار را پر می‌کند. ## چطور اولین مشتری خارجی را بگیریم پس از آماده کردن نمونه‌کارها، ترتیب مشخصی را دنبال می‌کنم. اول، شبکه‌ی حرفه‌ای موجودم: همکاران سابق، همکلاسی‌ها و آدم‌های جامعه‌ی توسعه. دوم، در پلتفرم‌های بین‌المللی به‌جای صدها پیشنهاد عمومی، ده پیشنهاد شخصی می‌نویسم که مشکل واقعی کارفرما را نام می‌برد. سوم، در انجمن‌های تخصصی به سؤال‌ها پاسخ دقیق و کوتاه می‌دهم. این سه مسیر کیفیت مشتری را بالا می‌برد. در نوشتن پیشنهاد همیشه سه چیز می‌آورم: فهم مسئله، روی پیشنهادم، و یک سؤال واقعی درباره‌ی محدودیت‌ها. سؤال واقعی نشان می‌دهد قبل از اعلام قیمت فکر کرده‌ام. ## انتقال وجه: بخشی که کمتر درباره‌اش صحبت می‌شود این بخش عملی‌ترین قسمت کار من است و کمترین مستندات را دارد. من فقط از مسیرهای قانونی و شفاف استفاده می‌کنم؛ یعنی پرهیز از انتقال‌های ناشناس، حساب‌های جعلی و روش‌هایی که جوابی برای شما ندارند. برای مشتری خارجی دو حالت دارم. حالت اول، قرارداد مستقیم با خود کارفرما است و پرداخت روی پلتفرمی انجام می‌شود که خود کارفرما از آن استفاده می‌کند؛ مسیر انتقال بر عهده‌ی اوست و من فقط مسئول دریافت سرویس هستم. حالت دوم، پلتفرم‌های واسطه‌ای که انتقال را با کمیسیون و در چارچوب رسمی خود انجام می‌دهند؛ هزینه‌ی بیشترش را می‌پذیرم، چون در ایران قابل پیگیری است. در بازار داخلی هم قرارداد مکتوب و پیش‌پرداخت مرحله‌ای برای من غیرقابل مذاکره است. ## قرارداد و اسکوپ؛ مهم‌ترین بخش کاری بیشتر پروژه‌های فریلنسری که خراب می‌شوند به‌خاطر ضعف فنی نیستند؛ به‌خاطر ابهام در اسکوپ‌اند. قبل از شروع مکتوب می‌کنم: خروجی دقیق، تعداد اصلاحات مجاز، معیار پذیرش، زمان‌بندی مرحله‌ای و نحوه‌ی مدیریت درخواست‌های خارج از اسکوپ. جمله‌ای که همیشه می‌گویم این است: «هر درخواستی که در سند اسکوپ نیست، یا زمان اضافه می‌خواهد یا هزینه‌ی اضافه.» بدون آن، دامنه‌ی پروژه باز می‌ماند و پروژه هرگز تمام نمی‌شود. ## تفاوت ساعت کاری و فرهنگ کاری ساعت کاری شما با بازار خارجی هم‌پوشانی کامل ندارد. به‌جای جنگیدن با این واقعیت، آن را مدیریت کنید. من بلوک‌های کاری مشخصی برای همکاری زنده با تیم غربی می‌گذارم و کارهای تمرکزی را به ساعات پربازده منتقل می‌کنم. در جلسات هم صریح می‌گویم کِی در دسترس‌ام. فرهنگ کاری هم تفاوت دارد. برای تیم‌های خارجی، مستندسازی و اعلام زودهنگام مشکل بخشی از کار است نه مزاحمت. توانایی نوشتن انگلیسی فنی، در عمل بیشتر از هر مهارت دیگری نرخ شما را جابه‌جا می‌کند. ## از کلاهبرداری چطور دور بمانیم چند قاعده‌ی ساده که بعد از چند ضرر یاد گرفته‌ام. هیچ پروژه‌ای را بدون پیش‌پرداخت شروع نمی‌کنم؛ اگر کارفرما روی پرداخت کل مبلغ اصرار دارد، همان‌جا پروژه رد است. درخواست ساخت یک برنامه‌ی کامل و بدون پیش‌پرداخت به‌نام کارفرما تقریباً همیشه نشانه‌ی بدی است. درخواست اتصال به حساب، دسترسی بی‌دلیل به سرور یا برگرداندن پول بعد از انجام کار را هم رد می‌کنم. جلسه‌ی تصویری کوتاه با تیم مدیریت، اعتماد را به‌شکل معناداری بالا می‌برد. پورتفولیوی من بدون رضایت مشتری محرمانه منتشر نمی‌شود. ## چند توصیه‌ی پایانی سرعت یادگیری فنی را کند نکنید، چون نرخ شما تقریباً مستقیم به مهارتی است که شش ماه پیش داشته‌اید. روی مهارتی سرمایه‌گذاری کنید که تقاضا دارد و رقابت در آن کم است. و ساعتی از خود را برای دارایی بلندمدت کنار بگذارید؛ محصول، ابزار یا دوره‌ای که مال خودتان باشد، روزی سیستم کارفرمایی شما می‌شود. TEXT, ], [ 'title' => 'هوش مصنوعی و آینده‌ی شغلی برنامه‌نویسی در ایران', 'slug' => 'ai-coding-careers-iran-fa', 'excerpt' => 'یک ارزیابی واقع‌بینانه از ۲۰۲۶: هوش مصنوعی کدام کارها را گرفته، کدام‌ها هنوز انسانی مانده و چرا تهدید واقعی، عقب‌ماندن از آن است نه خودِ هوش مصنوعی.', 'category' => 'career-fa', 'tags' => ['ai-fa', 'career-fa'], 'cover' => 'آینده‌ی شغلی و هوش مصنوعی', 'views' => 2000, 'likes' => 145, 'days_ago' => 6, 'body' => <<<'TEXT' # هوش مصنوعی و آینده‌ی شغلی برنامه‌نویسی در ایران وقتای کدنویسی جدید رونق گرفت، بازار پر شد از جمله‌هایی مثل «برنامه‌نویسی شغل قرن است» و «هوش مصنوعی همه را بیکار می‌کند». هیچ‌کدام دقیق نبود. تجربه‌ی من در تیم‌های محصولی، هم فنی و هم از دید بازار کار ایران، این است که تهدید واقعی نه خودِ هوش مصنوعی بلکه فاصله‌ی ما از آن است. ## تصویر واقع‌بینانه از سال ۲۰۲۶ من هر هفته با هوش مصنوعی کار می‌کنم و تجربه‌ی روزمره‌ام این است: بخش بزرگی از کدی که قبلاً می‌نوشتم، الان در چند ثانیه تولید می‌شود. یک کامپوننت ساده، اسکوئری تکراری، یک تست؛ همه‌ی این‌ها کار شدند و زمان تحویل کارهای تکراری نصف شده است. اما همان تجربه یک نکته‌ی دیگر هم نشان می‌دهد. بیشترین زمان ما در کدنویسی صرف فکر کردن، فهمیدن این‌که کدام راه‌حل با معماری فعلی جور است، و دیباگ کردن می‌شود. هوش مصنوعی اینجا کمک می‌کند اما جای شما را نمی‌گیرد. جایی که کد تولید می‌شود ارزش کم است؛ جایی که تصمیم گرفته می‌شود ارزش بالاست. ## چه کارهایی را بهتر به هوش مصنوعی بسپاریم انتخاب هوشمندانه‌ی ابزار، مهم‌ترین مهارتی است که در یک سال گذشته کسب کردم. کارها را به چهار دسته تقسیم می‌کنم. دسته‌ی اول، کار تکراری و کم‌ریسک؛ تست‌ها، کد تکراری، اسکریپت‌های یک‌بارمصرف و مستندات ساده. این‌ها را کامل به هوش مصنوعی می‌سپارم و فقط خروجی را مرور می‌کنم. دسته‌ی دوم، کد یکنواخت و زیادتکرار، مثل مدل‌ها و کامپوننت‌های فرم. دسته‌ی سوم، کد حساس که به امنیت، پرداخت یا داده‌ی واقعی مربوط است؛ اینجا هوش مصنوعی پیش‌نویس می‌نویسد و من بازبینی می‌کنم. دسته‌ی چهارم، معماری و حل مسئله‌ی محصول است؛ کاملاً خودم انجام می‌دهم. این تقسیم‌بندی باعث می‌شود هوش مصنوعی ابزار شود، نه جایگزین. ## چه چیزی انسانی می‌ماند چند حوزه هست که با وجود هر پیشرفتی انسانی مانده‌اند. اول، فهم محصول: کاربر ایرانی چه می‌خواهد، چه محدودیت‌هایی دارد، کجا اشکال می‌کند و چرا. این دانش در هیچ مدل زبانی نیست و از مصاحبه با کاربر به‌دست می‌آید. دوم، دیباگ و ریشه‌یابی مسئله‌های پیچیده در محیط واقعی؛ وقتی سیستمی در production خراب می‌شود، کسی باید از نشانه‌ها تا علت اصلی را دنبال کند. سوم، معماری و تصمیم‌های بلندمدت که هزینه‌ی اشتباه در آن‌ها شش ماه بعد معلوم می‌شود. چهارم، کار با تیم: مربی‌گری، کد ریویو و رشد دادن تازه‌کارها. پنجم، مسئولیت اخلاقی و امنیتی. ## چرا انگلیسی و مبانی، حالا مهم‌تر از همیشه وقتی بخش زیادی از کار روزمره تعامل با هوش مصنوعی است، کسی که انگلیسی خوبی دارد به ابزارها، مدل‌ها و مستندات گسترده‌تری دسترسی پیدا می‌کند. اما انگلیسی تنها مزیت نیست. مبانی، یعنی درک شبکه، سیستم‌عامل، ساختار داده و معماری، همان چیزی است که مرز بین یک کاربر ابزار و یک مهندس واقعی را می‌کشد. مدل‌ها کد تولید می‌کنند، اما نمی‌توانند تشخیص دهند این کد در مقیاس یک سرویس واقعی چه رفتاری خواهد داشت؛ و این تشخیص از دانش بنیادی می‌آید. تفاوت یک توسعه‌دهنده‌ی سطح متوسط با یک توسعه‌دهنده‌ی ارشد تقریباً همیشه در همین مبانی و توانایی تشخیص ریشه‌ی مسئله است، نه در تعداد فریم‌ورک‌هایی که می‌شناسد. ## چطور در بازار کار ایران جای خود را محکم کنیم بازار کار ایران ویژگی‌های خودش را دارد. هم نرخ‌ها پایین‌تر است و هم انتظارات متفاوت؛ کارفرما معمولاً هم‌زمان چند نقش را از یک نفر می‌خواهد، یعنی اگر فقط در یک حوزه‌ی باریک قوی باشید آسیب‌پذیرید. سه مسیر عملی می‌بینم. مسیر اول، تخصص عمیق در یک حوزه‌ی ارزشمند مثل زیرساخت، داده یا امنیت. مسیر دوم، مهندسی کامل از فرانت تا بک‌اند که در تیم‌های کوچک ایرانی بسیار تقاضا دارد. مسیر سوم، ساختن محصول به‌جای فروش ساعت؛ ریسک بیشتری دارد اما هوش مصنوعی در آن بیشترین اهرم را به شما می‌دهد. در هر سه مسیر، آنچه تمایز می‌کند، استفاده از هوش مصنوعی برای بالا بردن بازدهی خودتان است. ## چطور در رزومه و مصاحبه قوی باشیم اگر الان برای شغل برنامه‌نویسی درخواست می‌دهید، سه چیز را در رزومه برجسته کنید. اول، تجربه‌ی واقعی که با هوش مصنوعی در بهره‌وری داشته‌اید؛ مثلاً کاهش زمان ساخت یک ماژول از چند روز به چند ساعت، با ذکر این‌که خودتان چه تصمیمی گرفته‌اید. دوم، نمونه‌کاری که نشان دهد مسئله را فهمیده‌اید نه فقط کد زده‌اید. سوم، توانایی کار ریویو و ارائه‌ی فنی که در مصاحبه وزن زیادی دارد. در مصاحبه هم آماده باشید که می‌پرسند چطور از هوش مصنوعی استفاده می‌کنید. پاسخ خوب، نشان دادن یک فرآیند است: اول مسئله را تحلیل می‌کنم، بعد پیش‌نویس می‌گیرم و سپس با تست و بازبینی خودم تأیید می‌کنم. ## توصیه‌ی ویژه به تازه‌کارها تازه‌کارها بیشترین آسیب را می‌بینند، چون کارهایی که قبلاً پله‌ی اول شغل بود، مثل نوشتن اولین نسخه‌ی یک CRUD ساده، خودکار شده‌اند. راه‌حل این نیست که از ابزار استفاده نکنید؛ دقیقاً برعکس. با هوش مصنوعی آزمایش کنید، شکست بخورید، دیباگ کنید و بفهمید چرا کدی که ساخته شده کار نمی‌کند. همان تجربه‌ی دیباگ چیزی است که در سه سال اول کار حرفه‌ای به شما می‌دهد، فقط در شش ماه. ## تهدید واقعی چیست جمع‌بندی من این است: هوش مصنوعی تهدید نیست، ابزاری است که تعادل بازار کار را بازتعریف می‌کند. کسانی که از آن استفاده می‌کنند و مهارت عمیق را با آن ترکیب می‌کنند بهره می‌برند؛ کسانی که آن را نادیده می‌گیرند از پس نخواهند آمد. خطر اصلی از دست دادن شغل به‌خاطر هوش مصنوعی نیست؛ این است که شش ماه بعد از او جلو بماند. کاری که من انجام می‌دهم این است: یادگیری را متوقف نمی‌کنم، هوش مصنوعی را در کار روزمره جا می‌اندازم و روی چیزی تمرکز می‌کنم که انسانی می‌ماند، یعنی فهم مسئله، تصمیم‌گیری و مسئولیت‌پذیری. TEXT, ], [ 'title' => 'طراحی سایت برای کسب‌وکارهای کوچک ایرانی؛ چه چیزی واقعاً کار می‌کند', 'slug' => 'web-design-iranian-businesses-fa', 'excerpt' => 'آنچه در بازسازی سایت کسب‌وکارهای کوچک در ایران یاد گرفته‌ام: یک سایت سریع، راست‌به‌چپ و قابل اعتماد که می‌فروشد، به‌جای بروشوری زیبا که روی موبایل کسی بازش نمی‌کند.', 'category' => 'frontend-fa', 'tags' => ['design-fa', 'performance-fa'], 'cover' => 'وب‌سایت سریع برای کسب‌وکارهای کوچک', 'views' => 1800, 'likes' => 125, 'days_ago' => 14, 'body' => <<<'TEXT' # طراحی سایت برای کسب‌وکارهای کوچک ایرانی؛ چه چیزی واقعاً کار می‌کند بیشتر سایت کسب‌وکارهای کوچک ایران را کسی ساخته که هفته‌ی پیش وقت آزاد داشته، روی یک قالب آماده، و بعد کسی دست نزده است. الگو ثابت است: مالک کسب‌وکار مشتری بیشتری می‌خواهد و سایت به او یک اسلایدشو تحویل می‌دهد. این است آنچه در بازسازی این سایت‌ها جواب داده و آنچه آگاهانه کنار می‌گذارم. ## آنچه تقریباً همه‌ی آن‌ها اشتباه می‌کنند - سایت بروشوری. یک تصویر قهرمان، یک پاراگراف «درباره‌ی ما» از سال ۲۰۱۷، فرم تماسی که هیچ‌کس پاسخ نمی‌دهد و هیچ راهی برای خرید یا رزرو. برای تزئین و چاپ روی کارت ویزیت ساخته شده است. - اسلایدر قهرمان. سه تا پنج بنر چرخان که هر چهار ثانیه محو می‌شوند، هر کدام با یک تیتر فارسی غول‌پیکر و سایه. روی گوشی اندروید میان‌رده همین دلیل اصلی حس کندی صفحه است و هیچ‌کس منتظر نمی‌ماند. - فونت‌های حجیم. بارگذاری هم‌زمان وزیرمتن، استعداد، صمیم، ایران‌سنس و یک فونت مخصوص ارقام فارسی، آن هم در چند وزن. فونت‌های وب فارسی حجیم‌اند و بسته‌ی اینترنت موبایل ایران آن‌قدر که مردم فکر می‌کنند نامحدود نیست. - دسکتاپ‌محور بودن. طراحی در عرض ۱۴۴۰ پیکسل و بعد فشرده‌کردن آن. منو به یک همبرگری شکسته جمع می‌شود و شماره‌ی تلفن در فوتری کوچک گم می‌شود که هیچ‌کس لمسش نمی‌کند. - نبودن سیگنال اعتماد. یک لوگوی غیررسمی، بدون آدرس، مجوز و نظر مشتری. ## این سایت‌ها واقعاً به چه چیزی نیاز دارند با یک چیدمان موبایل‌محور و راست‌به‌چپِ شفاف شروع کنید. بیشتر ترافیک از اندرویدِ میان‌رده می‌آید و کاربر از بیوی اینستاگرام یا یک کانال تلگرام وارد می‌شود. یعنی: متن راست‌چین، `dir="rtl"` روی سند، یک نوار پایین چسبان با دکمه‌ی تماس و واتساپ، و دقیقاً یک اقدام روشن در هر صفحه. ترتیب خواندن باید با همان شکلی باشد که متن فارسی واقعاً خوانده می‌شود. تایپوگرافی فارسی بدون سنگینی ساده‌تر از چیزی است که مردم فکر می‌کنند. یک فایل فونت متغیر، دو یا سه وزن، `font-display: swap` و میزبانی روی سرور خودتان؛ همین و بس. متن اصلی با اندازه‌ی ۱۶ تا ۱۷ پیکسل و ارتفاع خط نزدیک ۱.۹، چون فارسی به فضای عمودی بیشتری از لاتین نیاز دارد. قیمت‌ها را با ارقام لاتین نگه دارید تا مردم بتوانند مقایسه کنند، ولی تاریخ و تلفن را همان‌طوری بنویسید که مشتریانتان انتظار دارند. سرعت اینجا خودش سیگنال اعتماد است. هدف من LCP زیر ۲.۵ ثانیه و ترجیحاً زیر ۱.۸ ثانیه است، اندازه‌گیری‌شده روی یک اتصال موبایل ایرانی محدود که تأخیرش اغلب ۶۰ تا ۱۲۰ میلی‌ثانیه است. یعنی یک تصویر قهرمان با اندازه‌ی درست در AVIF یا WebP با ابعاد مشخص، بدون CSS مسدودکننده‌ی رندر، بدون کتابخانه‌ی اسلایدر و لیزی‌لودینگ زیر صفحه‌ی اول. آنچه کاربر را به مشتری تبدیل می‌کند عناصر اعتماد است و این‌ها ساده‌انند: آدرس واقعی کوچه با نقشه، پروانه‌ی کسب‌وکار و نشان «نماد اعتماد» اگر دارید، تلفنی که یک آدم جواب می‌دهد، واتساپ با پیام از پیش نوشته‌شده، ساعت کاری با توضیح اینکه هفته‌ی ایران از شنبه تا پنج‌شنبه است، و نظر مشتری واقعی با نام و تاریخ. برای نقشه از نشان یا مپیر استفاده کنید، چون گوگل روی بیشتر شبکه‌های ایران فیلتر است. آدرس را متن ساده هم نگه دارید تا در هر اپی قابل کپی باشد. ## فروشی که روی گوشی ایرانی جواب می‌دهد بیشتر این کسب‌وکارها به یک کاتالوگ نیاز دارند، نه یک پلتفرم پرداخت. یک شبکه‌ی محصول یا خدمات، با یک عکس، یک قیمت و یک دکمه‌ی واتساپ که پیامی با نام محصول از پیش نوشته‌شده باز می‌کند. این بهتر از سبد خرید جواب می‌دهد، چون خریدار سفارشش را داخل همان اپی که در آن است نهایی می‌کند. اگر مشتری‌هایتان روی بسته‌های محدود یا وای‌فای ضعیف هستند، به‌جای فرم رزروی چندمرحله‌ای بنویسید «تماس بگیرید و رزرو کنید». بسته‌ی محدود یعنی تصمیم کمتر. ## چک‌لیست بازسازی - سایت فعلی را کراول کنید و قبل از هر تغییری، ترافیک، صفحات فرود اصلی و همه‌ی آدرس‌های ایندکس‌شده را ثبت کنید. - هر آدرسی که ترافیک دارد را نگه دارید و بقیه را با ۳۰۱ به نزدیک‌ترین معادل بفرستید. - اسلایدرها، اسلایدشوها و هر افزونه‌ای که تنها کارش انیمیشن است را حذف کنید. - به یک فونت فارسی متغیرِ میزبانی‌شده روی سرور خودتان یکپارچه شوید. - بخش قهرمان را به‌جای یک گرافیک طراحی‌شده، با یک عکس واقعی یا عکس محصول بازسازی کنید. - بلوک اعتماد را اضافه کنید: آدرس، نقشه، مجوز، تلفن، واتساپ، ساعت کاری و نظرات. - فرم تماس را با یک صندوق واقعی به‌علاوه‌ی دکمه‌ی واتساپ جایگزین کنید. - هر تصویر را فشرده کنید و صفت‌های عرض و ارتفاع را اضافه کنید. - لایت‌هاوس را روی پروفایل موبایل اجرا کنید و برای کارایی، دسترس‌پذیری و سئو هدف بگذارید: بالای ۹۰. - سرچ کنسول را با یک نقشه‌ی سایت تمیز یا یک ابزار آنالیتیکس اختصاصی راه‌اندازی کنید. ## هزینه چقدر است یک قالب آماده از مارکت‌پلیس چند میلیون تومان است و اصلاحش بیشتر از چیزی که صرفه‌جویی کرده‌اید خرج برمی‌دارد. یک سایت اختصاصی با نکست‌جی‌س یا یک سایت ایستا برای کسب‌وکار کوچک، بسته به تعداد صفحه‌ها، داشتن کاتالوگ و داشتن CMS هدلس، تقریباً ۱۵ تا ۴۵ میلیون تومان است. هاست و نگهداری هم رقم کوچک ماهانه‌ای است. عدد تومان را لنگر بگیرید، چون نرخ ارز تغییر می‌کند و مقایسه بین واحدهای پولی گمراه‌کننده است. ## حرف آخر سایت یک کسب‌وکار کوچک نباید طراح‌ها را تحت تأثیر بگذارد. باید روی یک گوشی ارزان در چند ثانیه باز شود، دقیقاً بگوید چه چیزی می‌فروشد و چطور به آن برسید، و شبیه یک کسب‌وکار واقعی با آدرس واقعی باشد. بقیه‌اش تزئین است. TEXT, ], [ 'title' => 'بازار کار ری‌اکت در ایران؛ استخدام تمام‌وقت یا فریلنسری؟', 'slug' => 'react-nextjs-job-market-iran-fa', 'excerpt' => 'توسعه‌دهنده‌ی ری‌اکت و نکست‌جی‌س ایرانی چطور در سال ۲۰۲۶ بین حقوق ثابت و کار مستقل انتخاب کند؛ به‌همراه اینکه بازار واقعاً چقدر پرداخت می‌کند.', 'category' => 'career-fa', 'tags' => ['react-fa', 'nextjs-fa', 'career-fa'], 'cover' => 'بازار کار ری‌اکت در ایران', 'views' => 2100, 'likes' => 150, 'days_ago' => 3, 'body' => <<<'TEXT' # بازار کار ری‌اکت در ایران؛ استخدام تمام‌وقت یا فریلنسری؟ تقریباً هر هفته کسی از من می‌پرسد که آیا برای شغل ری‌اکت در ایران همچنان اپلی کند یا مستقل کار کند. پاسخ صادقانه این است که هر دو مسیر وجود دارند، اما پرداختشان تفاوت فاحشی دارد و انتخاب درست بیشتر به سطح شما و ذخیره‌ی مالی‌تان بستگی دارد تا به فریم‌ورک. بازار را آن‌طور که در سال ۲۰۲۶ می‌بینم این است. ## تقاضای واقعی چه شکلی است ری‌اکت هنوز برای هر چیزی که شبیه محصول است در ایران انتخاب پیش‌فرض است: داشبورد، پنل ادمین، محصولات SaaS و سایت‌های بزرگ فروشگاهی و محتوایی. نکست‌جی‌س هم برای هر چیزی که رو به عموم است تقریباً اجباری شده. اما بازار از چند سال پیش کوچک‌تر است. سرمایه‌گذاری کم است، تیم‌ها کوچک‌اند و بخش بزرگی از کاری که «استارتاپی» نامیده می‌شود، در واقع نگهداری محصولات قدیمی‌تر است. نتیجه اینکه سطح انتظار بالا رفته. یک توسعه‌دهنده‌ی جیونیور ری‌اکت بدون پایه‌ی قوی دارد سختی می‌کشد. یک مهندس ارشدی که می‌تواند یک فیچر را از طراحی تا تولید مالکیت کند، سختی نمی‌کشد. ## استک‌هایی که شما را استخدام می‌کنند - تایپ‌اسکریپت همه‌جا، حالت strict، و بدون هیچ `any` در یک پول‌ریکوئست. - اپ‌روتر نکست‌جی‌س با کامپوننت‌های سرور ری‌اکت، سرور اکشن‌ها و استریمینگ، به‌علاوه‌ی قضاوت واقعی درباره‌ی اینکه مرز کلاینت کجا باید باشد. - تسلط بر لایه‌ی داده: پریزما یا درایزل، کوئری‌هایی که آب‌بازی نیستند، و دانستن اینکه چه وقت خود کوئری مشکل اصلی است. - تستی که تزئینی نیست: ویتست یا جست با ری‌اکت تستینگ‌لبرری، و پلی‌رایت برای مسیرهای حیاتی. - کارایی و قابلیت مشاهده: شاخص‌های Core Web Vitals، استراتژی کش، بودجه‌ی باندل و ردیابی خطا. - بک‌اند به‌قدری که هیچ‌وقت جلویتان را نگیرد: نود، صف، کرون، احراز هویت، ذخیره‌سازی اشیا و استقراری که ساعت دو بامداد بتوانید دیباگش کنید. - داکر، پایپ‌لاین‌های CI و زیرساخت به‌عنوان کد، دست‌کم در حدی که گلوگاه نباشید. کار پروژه‌ای معمولاً کل این فهرست را می‌خواهد. به همین دلیل است که اینجا خیلی‌ها خودشان را فول‌استک معرفی می‌کنند، حتی وقتی بک‌اندشان یک فایل بیشتر نیست. ## واقعیت حقوق و دستمزد برای موقعیت‌های حضوری در تهران، یک مهندس قویِ مید تا سنیور ری‌اکت یا نکست‌جی‌س معمولاً ماهانه بین ۶۰ تا ۱۲۰ میلیون تومان می‌گیرد که سقف این بازه در شرکت‌های محصول و شرکت‌های مشاوره‌ای با مشتری خارجی متمرکز است. نقش‌های استاف و لید بیشتر می‌گیرند، ولی تعدادشان بسیار کم است. جیونیور و مید خیلی پایین‌تر جمع می‌شوند و فاصله‌ی پله‌ها پهن است. بعد نوبت دورکاری برای پیمانکار ایرانی است و اینجاست که فاصله‌ی واقعی دیده می‌شود. دورکاری برای یک شرکت ایرانی معمولاً کمتر از معادل حضوری پرداخت می‌کند، چون اجاره‌ی دفتر را از شرکت حذف می‌کنید و طرف مقابل هم این را می‌داند. دورکاری برای کارفرمای خارجی چند برابر و به پول سخت پرداخت می‌کند، اما موانع عینی است: تحریم‌ها، سختی باز کردن حساب و دریافت پول، هم‌پوشانی با ساعات اروپا و مصاحبه به انگلیسی. غیرممکن نیست و تعدادی از مهندسانی که می‌شناسم مدیریتش می‌کنند، ولی برنامه‌ی پیش‌فرض نیست. ## استخدام یا فریلنسری - زیر دو سال تجربه‌ی واقعی: استخدام را انتخاب کنید. به بازبینی کد، راهنمایی و کسی نیاز دارید که مسئول خرابی‌ها باشد. - دو تا پنج سال تجربه همراه با شبکه‌ی ارتباطی: ترکیبی بهترین جواب است. حقوق برای ثبات، شب‌ها یا آخر هفته‌ها برای کارهای نگهداری ماهانه. - ارشد، با اعتبار و حدود شش ماه ذخیره‌ی مالی: فریلنسری می‌تواند از حقوق جلو بزند، اما فقط با قرارداد مکتوب، پیش‌پرداخت و کنترل سخت‌گیرانه‌ی دامنه‌ی کار. - اگر اجاره یا خرج خانه از این درآمد را می‌دهید: حقوق ثابت را نگه دارید. درآمد فریلنسری نوسانی است و ماه ساکت عادی است، نه شکست. ## موتوری که واقعاً پیشنهاد می‌سازد - دو یا سه مطالعه‌ی موردی عمیق، هر کدام با مسئله، محدودیت‌ها، تصمیم‌های شما و یک عدد. عدد بیشتر از اسکرین‌شات می‌نشیند. - انگلیسی، اول نوشتاری. بیشتر گفت‌وگوهای دورکاری بخشی از استخدام را بر پایه‌ی این می‌گذارند که چقدر واضح می‌نویسید و توضیح می‌دهید. - یک مشارکت واقعی در متن‌باز. نه یک کلون آموزشی، بلکه یک پول‌ریکوئست یا یک کتابخانه‌ی کوچک با کاربر واقعی. - لینکدین تمیز و سایت پورتفویویی که سریع باز می‌شود. پورتفویوی کند در این حوزه سیگنال بدی است. ## مذاکره عدد حقوق فعلی‌تان را اول نگویید. بازه‌ی تأییدشده را بپرسید. به خاطر داشته باشید کارمند ایرانی از طریق فیش حقوق به تأمین اجتماعی کمک می‌کند که در مقایسه با صدور فاکتور فریلنسری، بخش قابل‌توجهی از بسته‌ی شما را تشکیل می‌دهد و آنجا کل مبلغ را خودتان می‌دهید. درباره‌ی پاداش، ساعات کاری، مرخصی و اینکه ابزار یا آموزش را پرداخت می‌کنند یا نه بپرسید. با کارفرمای خارجی، واحد پول، نرخ و شرایط پرداخت را پیش از شروع کار مکتوب کنید و همیشه پیش‌پرداخت بگیرید. وقتی هنوز به یادگیری سریع نیاز دارید استخدام را انتخاب کنید. وقتی مهارت و شبکه‌ی ارتباطی را دارید فریلنسری را. بازار این را برای شما تصمیم نمی‌گیرد. TEXT, ], [ 'title' => 'مهاجرت از وردپرس به نکست‌جی‌اس برای وب‌سایت‌های فارسی', 'slug' => 'wordpress-to-nextjs-migration-fa', 'excerpt' => 'مسیر مرحله‌به‌مرحله از یک سایت کند وردپرسی به یک سایت سریع نکست‌جی‌س، با حفظ محتوای فارسی، آدرس‌های فارسی و ترافیک جست‌وجو.', 'category' => 'react-nextjs-fa', 'tags' => ['react-fa', 'nextjs-fa', 'performance-fa'], 'cover' => 'مسیر مهاجرت به نکست‌جی‌اس', 'views' => 2300, 'likes' => 170, 'days_ago' => 1, 'body' => <<<'TEXT' # مهاجرت از وردپرس به نکست‌جی‌اس برای وب‌سایت‌های فارسی وردپرس هنوز بخش بزرگی از وب فارسی را اداره می‌کند، از سایت شرکت‌های کوچک تا ناشران بزرگ. دلیلش دلایل خوبی داشته، اما بسیاری از این سایت‌ها امروز به خاطر قالب و صفحه‌ساز، نه محتوا، در Core Web Vitals امتیاز بدی می‌گیرند. این همان مسیر مرحله‌ای است که برای مهاجرت بدون از دست دادن ترافیک جست‌وجو به کار می‌برم. ## چرا این سؤال این‌قدر زیاد مطرح می‌شود - وردپرس در وب فارسی مسلط است، پس بیشتر کسب‌وکارها سال‌ها آدرس، بک‌لینک و محتوایی دارند که از دست دادنشان را نمی‌خواهند. - صفحه‌سازهایی مثل WPBakery، المنتور و دیوی بسته‌های بزرگ CSS و جاوااسکریپت، جی‌کوئری و درخت DOM عظیم تحویل می‌دهند. این‌ها LCP و INP را می‌کشند، نه تصاویر و نه هاست. - افزونه‌های فارسی برای فرم، اسلایدر، سئو و ترجمه هر کدام وزن اضافه می‌کنند و ریسک نگهداری و امنیت هستند. - مالک می‌خواهد محتوا را بدون دست زدن به کد ویرایش کند و این نیاز در مهاجرت از بین نمی‌رود. ## مرحله‌ی یک: ممیزی و خط پایه قبل از هر تغییری عددها را ثبت کنید تا جواب مهاجرت را ثابت کنید. سایت را کراول کنید و هر آدرس ایندکس‌شده را با کد وضعیت و کانونیکال استخراج کنید. دوازده ماه داده‌ی سرچ کنسول را بیرون بکشید و صفحات فرود برتر را مشخص کنید. لایت‌هاوس را با پروفایل موبایل روی چند قالب نماینده اجرا و LCP، INP و CLS را ذخیره کنید. تنظیمات آنالیتیکس را هم بررسی کنید؛ همین یک چیز در هر مهاجرتی بی‌سروصدا خراب می‌شود. ## مرحله‌ی دو: بیرون کشیدن محتوا REST API برای محتوای استاندارد مسیر تمیزی است: هر نوع محتوا یک آندپوینت دارد و نتایج صفحه‌بندی می‌شوند، پس اسکریپتی بنویسید و تا گرفتن همه‌چیز صفحه‌ها را دنبال کنید. حواستان به نوع‌های محتوای سفارشی و فیلدهای سفارشی باشد، چون آندپوینت پیش‌فرض آن‌ها را برنمی‌گرداند و باید اول ثبت‌شان کنید. خروجی WP-CLI به JSON همه‌ی پایگاه داده را در یک فایل می‌دهد. رسانه‌ها را جداگانه خروجی بگیرید و نام فایل‌های اصلی را نگه دارید. ## مرحله‌ی سه: انتخاب معماری محتوا دو گزینه‌ی واقعی دارید. یا وردپرس را CMS هدلس نگه می‌دارید و محتوا را در زمان بیلد یا درخواست می‌گیرید؛ کارفرما ویرایشگر آشنایش را نگه می‌دارد و شما فرانت‌اند نکست‌جی‌س را می‌گیرید، در ازای پذیرش یک هدف متحرک. یا همه‌چیز را به مارک‌داون، MDX یا CMS هدلس وارد می‌کنید و صفحه‌های ایستا می‌سازید؛ وقتی محتوا فقط چند بار در هفته عوض شود، این روش سریع‌تر و باثبات‌تر است. بیشتر کارفرمایان من در نهایت محتوای ایستا به‌علاوه‌ی یک ابزار ویرایش کوچک را انتخاب می‌کنند. ## مرحله‌ی چهار: آدرس‌ها، اسلاگ‌ها و ریدایرکت‌ها مهاجرت‌ها اینجا برنده یا بازنده می‌شوند. هر آدرس قدیمی را به آدرسی جدید نگاشت کنید و ساختار مسیر را یکسان نگه دارید. آدرسی را که نمی‌توانید حفظ کنید، با ۳۰۱ به نزدیک‌ترین معادل بفرستید، نه صفحه‌ی اول. اسلاگ‌های فارسی و عربی را همان‌طور که بود، دست‌نخورده و نرمال‌نشده، نگه دارید؛ تغییرشان لینک‌ها را می‌شکند و سایت را برای موتور جست‌وجو نو نشان می‌دهد. صفحه‌بندی، آرشیو تاریخی، صفحه‌های برچسب، فیدها و صفحه‌های پیوست را هم نگاشت کنید؛ معمولاً فراموش و ایندکس می‌شوند. نقشه‌ی سایت جدید را بسازید و نقشه‌ی قدیمی را پشت ریدایرکت‌ها نگه دارید. ## مرحله‌ی پنج: ساخت سریع به‌صورت پیش‌فرض از تولید ایستا استفاده کنید و بازتولید افزایشی را فقط جایی بگذارید که محتوا بیشتر از روزی یک بار تغییر می‌کند؛ مثل صفحه‌ی اخبار. تصاویر را با کامپوننت تصویر فریم‌ورک و فرمت مدرن سرو کنید. زبان و جهت را روی عنصر سند با `lang="fa"` و `dir="rtl"` بگذارید و CSS را با ویژگی‌های منطقی مثل `margin-inline-start` بنویسید تا در هر دو جهت درست کار کند. ## تایپوگرافی فارسی، درست و حسابی سراغ بارگذار فونت گوگل نروید. گوگل فونتس روی بیشتر شبکه‌های ایران فیلتر است، پس فونتی که از دامنه‌ی گوگل گرفته شود یا شکست می‌خورد یا به فونت سیستم برمی‌گردد. یک فونت متغیر فارسی مثل وزیرمتن را روی سرور خودتان میزبانی و با `next/font/local` ثبتش کنید تا پریلود را نکست‌جی‌س مدیریت کند. یک فایل، دو یا سه وزن، `font-display: swap` و ارتفاع خط درست. ارقام فارسی و تاریخ شمسی را پیش از لانچ چک کنید. ## گلاچ‌ها - آدرس رسانه‌ها. فایل‌های آپلود را به هاست جدید کپی کنید، نام فایل‌ها را یکسان نگه دارید و ارجاع‌های ثابت درون نوشته‌های قدیمی را درست کنید. آدرس تصویر کهنه از دلایل رایج محتوای مختلط است. - فرم کامنت. کامنت‌های مبتنی بر افزونه به‌ندرت جان سالم به در می‌برند. زود تصمیم بگیرید نگه‌شان می‌دارید یا نه؛ اگر نگه می‌دارید یک فرم ساده با نظارت بسازید. - آنالیتیکس. سرویس‌های گوگل از داخل ایران قابل اتکا نیستند. مطمئن شوید ارائه‌دهنده‌ی شما برای بازدیدکنندگانتان لود می‌شود، یا یک ابزار اختصاصی بدون کوکی را میزبانی کنید تا سابقه از دست نرود. - جست‌وجو. آندپوینت جست‌وجوی وردپرس دیگر وجود نخواهد داشت. اگر سایت به آن تکیه کرده بود، ایندکس واقعی اضافه کنید یا جست‌وجوی داخلی را بپذیرید. - محتوای مختلط، آدرس‌های `http` خام درون محتوای قدیمی و استایل‌ها و اسکریپت‌های درون‌خطی که کسی ممیزی نکرده است. - تست: هر ریدایرکت با curl، هر کد وضعیت، و بعد لایت‌هاوس نهایی روی همان قالب‌های مرحله‌ی اول. ## موفقیت چه شکلی است قبل و بعد را روی صفحه‌های یکسان مقایسه کنید. روی سایت‌هایی که مهاجرت داده‌ام، LCP معمولاً از چهار یا پنج ثانیه به زیر دو ثانیه می‌افتد و INP حتی بیشتر بهتر می‌شود چون صفحه‌ساز حذف شده است. ترافیک باید بعد از جاافتادن ریدایرکت‌ها ثابت بماند و به‌خاطر سرعت رشد کند. قالب‌ها را یکی‌یکی مهاجرت دهید و اعتبار جست‌وجو را معامله نکنید. TEXT, ], ]; $now = now(); $frontUrl = env('FRONT_URL', 'https://parsaaghayi.ir'); $postIds = []; foreach ($posts as $index => $post) { $created = Post::create([ 'title' => $post['title'], 'slug' => $post['slug'], 'body' => $post['body'], 'excerpt' => $post['excerpt'], 'author_id' => $author->id, 'category_id' => $categoryIds[$post['category']], 'featured_image' => $frontUrl.'/og-image?text='.rawurlencode($post['cover']), 'views' => $post['views'], 'likes' => $post['likes'], 'published_at' => $now->copy()->subDays($post['days_ago']), ]); $postIds[$index] = $created->id; $created->tags()->attach( array_map(fn ($tag) => $tagIds[$tag], $post['tags']) ); } // Related posts: keep every "you might like" list inside the reader's // language. The blog is a strict English/Persian mirror, so a reader on // the Persian version must never see English cards and vice versa. $byLanguage = ['en' => [], 'fa' => []]; foreach ($posts as $index => $post) { $lang = str_ends_with($post['slug'], '-fa') ? 'fa' : 'en'; $byLanguage[$lang][] = $postIds[$index]; } foreach ($byLanguage as $ids) { foreach ($ids as $ownerId) { $owner = Post::find($ownerId); $owner->relatedPosts()->attach( collect($ids)->reject(fn ($id) => $id === $ownerId)->values()->all() ); } } $this->command->info('Real blog content seeded: ' .count($categories).' categories, ' .count($tags).' tags, ' .count($posts).' posts.'); } }