<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: lamaizi hajar</title>
    <description>The latest articles on DEV Community by lamaizi hajar (@lamaizi_hajar_b310d8837b4).</description>
    <link>https://dev.to/lamaizi_hajar_b310d8837b4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4185611%2F74a1924c-9f5c-49b4-bdb9-77e201f178c3.png</url>
      <title>DEV Community: lamaizi hajar</title>
      <link>https://dev.to/lamaizi_hajar_b310d8837b4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lamaizi_hajar_b310d8837b4"/>
    <language>en</language>
    <item>
      <title>I packaged my go-to Node.js/TypeScript backend setup into a boilerplate</title>
      <dc:creator>lamaizi hajar</dc:creator>
      <pubDate>Wed, 14 Oct 2026 23:06:38 +0000</pubDate>
      <link>https://dev.to/lamaizi_hajar_b310d8837b4/i-packaged-my-go-to-nodejstypescript-backend-setup-into-a-boilerplate-35em</link>
      <guid>https://dev.to/lamaizi_hajar_b310d8837b4/i-packaged-my-go-to-nodejstypescript-backend-setup-into-a-boilerplate-35em</guid>
      <description>&lt;p&gt;Every time I started a new backend project, I rebuilt the same things: JWT auth, CSRF protection, Docker setup, and, when a client needed it, invoicing. After doing it one time too many, I packaged it all into a boilerplate. Here's what's inside and the choices I made.&lt;/p&gt;

&lt;h2&gt;
  
  
  The stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js + TypeScript + Express&lt;/li&gt;
&lt;li&gt;Prisma + PostgreSQL&lt;/li&gt;
&lt;li&gt;Docker Compose (nginx + api + db), ready to deploy&lt;/li&gt;
&lt;li&gt;Headless: no frontend included, so it works with web, mobile, or nothing at all&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Auth: JWT + CSRF
&lt;/h2&gt;

&lt;p&gt;Authentication uses JWT with CSRF protection, covered by integration tests. Role-based access (USER / ADMIN) is built in, so protected routes like "create a product" are restricted to admins from day one.&lt;/p&gt;

&lt;h2&gt;
  
  
  A billing module (the part I'm most happy with)
&lt;/h2&gt;

&lt;p&gt;Most boilerplates stop at auth. I added a billing flow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Company settings → Client → Product → Order → Invoice (PDF)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Two design decisions worth sharing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Price snapshots.&lt;/strong&gt; When an order is created, the product's price and VAT rate are copied into the order line. Changing the catalog price later never alters past orders.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idempotent invoicing.&lt;/strong&gt; Calling "generate invoice" twice on the same order returns the same invoice instead of creating a duplicate, so the sequential invoice numbering never gets a gap or a duplicate (a legal requirement in Morocco).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Invoices are generated as PDFs with the legal mentions required in Morocco (ICE, IF, RC, patente, HT/TVA/TTC totals). The structure is generic enough to adapt to other markets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus modules for Morocco/MENA
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SMS/OTP phone verification&lt;/strong&gt; via EnvoiSMS.ma, tested with real SMS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PayZone and CMI payment gateway integrations.&lt;/strong&gt; Be aware these need your own merchant account to activate, and I have not been able to validate them against live gateways. They are documented, but treat them as a solid starting point rather than a finished integration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's not included
&lt;/h2&gt;

&lt;p&gt;No frontend, no hosting setup beyond Docker, and no merchant accounts for the payment modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get it
&lt;/h2&gt;

&lt;p&gt;It's $29 on Gumroad: &lt;a href="https://hajarlmz.gumroad.com/l/noduk" rel="noopener noreferrer"&gt;https://hajarlmz.gumroad.com/l/noduk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd really like feedback: is the feature set right? What would you want added? Let me know in the comments.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>docker</category>
      <category>node</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
