Home Blog Work About
ESC
Nima Ghorbani

Nima Code

senior_backend_developer

Backend developer with 9+ years across PHP, Python & Go — Laravel, Django, WordPress, Docker. Touch of React.

PHP Laravel Python Go Docker
nima@nimacode:~
$
02.

Blog

// latest_posts.filter(by=<tag>)

Back End

Building Reliable Laravel Queue Workers

Patterns for resilient Laravel queue workers — retries, backoff, idempotency, and graceful shutdown under load.

php artisan queue:work \
  --tries=3 --backoff=5 \
  --max-time=3600
2026-05-20 7 min
Back End

Go Concurrency Patterns for Web Services

Practical goroutine patterns — worker pools, fan-out/fan-in, and context cancellation — for production Go services.

ctx, cancel := context.WithTimeout(
  ctx, 2*time.Second)
defer cancel()
2026-05-10 9 min
Back EndTools

Docker Compose for Local Backend Development

Reproducible local environments for polyglot backends — Postgres, Redis, and your app in one compose file.

services:
  app:
    build: .
  db:
    image: postgres:16
2026-04-28 6 min
Back End

Killing N+1 Queries in Laravel Eloquent

How to detect, diagnose, and eliminate N+1 query problems in Laravel Eloquent using eager loading, constrained loads, and preventLazyLoading().

Post::with(['author', 'tags'])
  ->withCount('comments')
  ->get();
2026-04-12 7 min
Back End

Token Auth for Laravel APIs with Sanctum

A practical guide to Laravel Sanctum — personal access tokens with scopes, SPA cookie auth, middleware setup, revocation, and when Passport is the right tool instead.

$token = $user->createToken(
  'mobile-app',
  ['orders:read', 'orders:write']
)->plainTextToken;
2026-03-30 8 min
Back End

Modern PHP: Enums, Readonly Props, and Fibers

A practical look at the PHP 8.1–8.2 features that actually change how you write production code — backed enums, readonly properties, constructor promotion, first-class callables, and a clear-eyed take on Fibers.

enum Status: string {
  case Active   = 'active';
  case Archived = 'archived';
}
2026-03-18 6 min
Back End

Taming the Django ORM: select_related and Beyond

How to diagnose and eliminate Django ORM performance problems — from N+1 queries with select_related and prefetch_related to deferred fields, annotations, and streaming large querysets.

posts = Post.objects.select_related('author')\
    .prefetch_related('tags')\
    .only('title', 'published_at', 'author__username')
2026-03-05 8 min
Back End

Practical asyncio for Backend Services

A ground-level tour of asyncio for backend engineers — event loop mechanics, gather, Semaphore-bounded concurrency, timeouts, and avoiding the blocking-call trap with run_in_executor.

async with asyncio.Semaphore(20):\
    results = await asyncio.gather(\
        *[fetch(url) for url in urls],\
        return_exceptions=True)
2026-02-20 9 min
Back End

Error Handling Patterns in Go

Sentinel errors, wrapping with fmt.Errorf, errors.Is/As, and custom error types — the patterns that keep Go error handling honest and usable.

if errors.Is(err, ErrNotFound) {
  return http.StatusNotFound
}
var ve *ValidationError
if errors.As(err, &ve) {
  log.Println(ve.Field)
}
2026-02-08 7 min
Back End

PostgreSQL Indexing That Actually Helps

B-tree, GIN, partial, and composite indexes explained with real EXPLAIN ANALYZE output — plus covering indexes and how to spot bloat before it kills your queries.

CREATE INDEX CONCURRENTLY idx_orders_user
  ON orders (user_id, created_at DESC)
  INCLUDE (status, total);
2026-01-25 8 min
Back EndTools

Caching Patterns with Redis

Cache-aside, write-through, stampede protection, and cache key design — practical Redis patterns with the failure modes that make or break them in production.

SET user:42 '{"id":42,"email":"[email protected]"}'
  EX 300 NX
SET lock:user:42 1 EX 5 NX
2026-01-10 7 min
Back End

WordPress as a Headless API Backend

WordPress ships a capable REST API — here's how to extend it with custom routes, ACF fields, and proper authentication so a decoupled frontend can treat WP as a real backend.

add_action('rest_api_init', function() {
  register_rest_route('myapp/v1', '/products',
    ['callback' => 'myapp_get_products']);
});
2025-12-15 7 min
Back End

Decoupling Services with RabbitMQ

Exchanges, bindings, consumer acks, dead-letter queues, and idempotent consumers — the pieces you need to build reliable async messaging with RabbitMQ.

channel.basic_qos(prefetch_count=10)
channel.basic_consume(
  queue='orders',
  on_message_callback=handle,
  auto_ack=False)
2025-11-28 8 min
Back End

JWT vs Sessions: Choosing Auth for APIs

Sessions and JWTs solve different problems — here's the honest tradeoff analysis so you pick the right one instead of cargo-culting whichever you've seen most recently.

// Short-lived access + refresh token pair
{
  "access_token": "eyJ...",
  "expires_in": 900,
  "refresh_token": "def50200..."
}
2025-11-10 6 min
Back EndTools

Safe Database Migrations in Production

Zero-downtime schema changes require more than running migrations before a deploy — here's the expand/contract pattern, lock-safe Postgres operations, and rollback strategy that actually works.

-- Add column without locking the table
ALTER TABLE orders
  ADD COLUMN status_v2 varchar(32);
CREATE INDEX CONCURRENTLY idx_orders_status_v2
  ON orders (status_v2);
2025-10-22 7 min
ToolsBack End

Tuning Nginx + PHP-FPM for Throughput

Default PHP-FPM and Nginx configs leave most of your server's capacity on the table — here's how to size worker pools correctly, tune FastCGI buffers, enable OPcache properly, and stop bleeding requests under load.

pm = dynamic
pm.max_children = 40
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
2025-10-05 8 min
Back End

Full-Text Search with Elasticsearch

How Elasticsearch analyzers, mappings, and query DSL work together to deliver relevant full-text search — and when Postgres FTS is a better starting point.

GET /posts/_search
{
  "query": {
    "match": { "title": "django performance" }
  }
}
2025-09-18 7 min
Back End

Clean Architecture in a PHP Codebase

How to layer a PHP application into domain, application, and infrastructure tiers — keeping business logic framework-free, testable, and honest about its dependencies.

interface OrderRepository {
  public function findById(OrderId $id): Order;
  public function save(Order $order): void;
}
2025-08-30 9 min
Tools

CI/CD Pipelines with GitHub Actions

A complete GitHub Actions pipeline for a PHP/Laravel project — dependency caching, matrix test runs, Docker image builds, and a deploy step that only fires on main.

jobs:
  test:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
      - uses: shivammathur/setup-php@v2
2025-08-12 6 min
Back End

Rate Limiting Strategies for APIs

Fixed window, sliding window, and token bucket algorithms for API rate limiting — implemented with Redis atomics and paired with correct 429 response headers.

local count = redis.call('INCR', KEYS[1])
if count == 1 then
  redis.call('EXPIRE', KEYS[1], ARGV[1])
end
return count
2025-07-25 6 min
03.

Work

// sites.live().preview()

LIVE
Open site

taberna.ir

Multi-tenant e-commerce platform.

Visit
LIVE
Open site

vigorv.shop

Vigorv — sportswear e-commerce store.

Visit
LIVE
Open site

goldima.nimacode.dev

Gold accessories e-commerce.

Visit
04.

About

// whoami && cat skills.json

about.sh
$ whoami
Nima Code — Senior Backend Developer
$ cat bio.txt
9+ years building backends — PHP/Laravel, Python/Django, and Go. WordPress, REST APIs, and containerized infra with Docker. I care about reliability, clean data models, and systems that scale. A little React on the side.
$ cat experience.log
2026–NowBack End Developer @ Freelance
2025–2026Back End Developer @ Melligold
2024–2025Fullstack Developer @ BigShot
2021–2024Senior Back-end Developer @ Insooo
2020–2021Back-end Developer @ Poshtiban
2019–2020Back-end Developer @ Zhaket
2018–2019Back-end Developer @ NegarWeb
2018Back End Developer @ Payment24
$

Tech Stack

PHP / Laravel / Yii295%
Python / Django90%
Go80%
REST APIs90%
PostgreSQL / MariaDB / MongoDB85%
Redis / Elasticsearch80%
Docker / CI-CD80%
React40%