My Stack

Med Ali Jerbi

Here's where I'm currently most productive:

1. Framework (Next.js, React, and NestJS)

I primarily build applications using Next.js and React, complemented by NestJS for backend services. I always use TypeScript for type safety and maintainability.

Data Fetching

For data fetching, I leverage both Server Components and API routes in Next.js:

Server Components & API Routes

I use Next.js API routes for backend logic and fetch data efficiently within Server Components. With React Server Components, data loading happens at the server level, reducing client-side JavaScript payload.

export default async function Page() {
  let data = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/products`, {
    cache: "no-store", // Ensures fresh data
  });
  let products = await data.json();
  return (
    <ul>
      {products.map((product) => (
        <li key={product.id}>{product.name}</li>
      ))}
    </ul>
  );
}

For real-time capabilities, I integrate WebSockets or Redis Pub/Sub within NestJS. For GraphQL APIs, I use Apollo Server or Mercurius.

2. Styling (Tailwind CSS and shadcn/ui)

I use Tailwind CSS for utility-first styling and shadcn/ui for well-structured, accessible UI components.

Why Tailwind?

Tailwind helps keep styling consistent and minimal, reducing unnecessary CSS. It’s easy to customize with tailwind.config.js, integrates seamlessly with Next.js, and optimizes for performance using PurgeCSS.

3. Database (PostgreSQL and Prisma)

For databases, I use PostgreSQL, managed through Prisma as my ORM.

Why Prisma?

Example Prisma Query:

const products = await prisma.product.findMany({
  where: { inStock: true },
  orderBy: { createdAt: "desc" },
});

4. Caching & Performance (Redis, Cloudflare R2, and Edge Functions)

For optimizing performance and caching API responses, I rely on:

Example Redis Caching in NestJS:

const cachedData = await redis.get("products");
if (!cachedData) {
  const products = await fetchProductsFromDB();
  await redis.set("products", JSON.stringify(products), "EX", 3600); // Cache for 1 hour
}

5. AI & Automation

I integrate AI into my workflow using:

6. Deployment & DevOps

For hosting, I use:

Example GitHub Actions CI Workflow:

name: Deploy API

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: "18"
      - run: npm install && npm run build
      - run: npm run deploy

7. Coding Patterns


This is my current stack, but I'm always exploring new tools and techniques to enhance my workflow. 🚀