<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Filip Jerga on Medium]]></title>
        <description><![CDATA[Stories by Filip Jerga on Medium]]></description>
        <link>https://medium.com/@filipjerga?source=rss-5a2a1f2d2580------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WMsLlIoD8e-JLczmC5OMiQ.jpeg</url>
            <title>Stories by Filip Jerga on Medium</title>
            <link>https://medium.com/@filipjerga?source=rss-5a2a1f2d2580------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:16:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@filipjerga/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Smallest Game, the Clearest Lesson: Modernizing a Chrome-Dino Clone with AI]]></title>
            <link>https://medium.com/eincode/the-smallest-game-the-clearest-lesson-modernizing-a-chrome-dino-clone-with-ai-04fd53bbec65?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/04fd53bbec65</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Thu, 27 Aug 2026 14:16:29 GMT</pubDate>
            <atom:updated>2026-08-27T14:16:29.170Z</atom:updated>
            <content:encoded><![CDATA[<p><em>It’s ~300 lines in a single file, exactly the kind of game people now ask AI to “just generate.” Here’s what that game’s architecture actually looks like, and what happened when I used AI to modernize the one I built years ago.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a3zgH14Ic0Q-thbe-iAttw.png" /></figure><p>Everyone’s first instinct with AI and games is the same: “make me the Chrome dinosaur game.” Small, iconic, the perfect one-prompt demo.</p><p>So here’s a useful data point: I built one by hand years ago for my Udemy Phaser course. Recently I used AI to modernize it — Phaser 3 → 4, JS → TS, Webpack → Vite, npm → Bun. It’s the smallest game I’ve done this to, which is exactly why the lesson lands so clearly:</p><p>Even a “trivial” game has architecture. AI’s value is in respecting it, not replacing it.</p><p>Let me show you.</p><p><strong><em>Want the full source and the playable game?</em></strong></p><p><a href="https://dino-ts.vercel.app/">▶️ Play the game</a> · <a href="https://www.patreon.com/cw/filipjerga">💾 Get the source on Patreon</a></p><h3>It’s one file — but it’s a state machine</h3><p>There are no scenes-plural, no menus. The whole game is one PlayScene. But it isn&#39;t a soup of code: it&#39;s a small <strong>state machine</strong> tracked by a single flag.</p><pre>// PlayScene fields<br>private hasGameStarted = false;   // the state flag<br>private gameSpeed = 10;<br>private score = 0;</pre><p>The states:</p><ol><li><strong>Idle</strong> — the dino stands still; an invisible sensor waits for it.</li><li><strong>Intro</strong> — a timer rolls the ground out from zero width while the dino runs on the spot.</li><li><strong>Running</strong> — obstacles spawn, the world scrolls, the speed ramps.</li><li><strong>Game over</strong> — physics pause, the best score is recorded, restart resets everything.</li></ol><p>And the whole per-frame loop is gated on that one flag:</p><pre>override update(_time: number, delta: number): void {<br>  if (!this.hasGameStarted) return;   // nothing happens until we&#39;re &quot;running&quot;<br>  // …spawn obstacles, scroll, score, animate…<br>}</pre><p>That’s the backbone. One flag, four states, one guard. Simple — but <em>deliberate</em>.</p><h3>Three mechanics worth naming</h3><p><strong>Object pooling.</strong> Obstacles aren’t created and destroyed forever. They live in a group, scroll left, and get recycled when they exit the screen:</p><pre>Phaser.Actions.IncX(this.obsticles.getChildren(), -this.gameSpeed);</pre><pre>this.obstacles.getChildren().forEach((o) =&gt; {<br>  if ((o as Phaser.GameObjects.Sprite).getBounds().right &lt; 0) {<br>    this.obsticles.killAndHide(o);   // reuse, don&#39;t destroy<br>  }<br>});</pre><p><strong>A speed ramp.</strong> gameSpeed creeps up on every score tick and also scales how often obstacles spawn — so difficulty rises the longer you survive. That single number is the entire difficulty curve.</p><p><strong>A shrinking hitbox.</strong> Ducking shrinks the dino’s collision box and restores it on release. That one detail is also where the migration got interesting.</p><h3>Then AI came in — and the details mattered</h3><p>Modernizing sounds mechanical, and mostly it is. But “mostly” is the trap. A small game upgraded across two engine-major-versions still hits real breaking changes, and this is exactly where a careful AI loop earns its keep. A few examples from this project:</p><p><strong>Keyboard events were renamed.</strong> Phaser removed the old underscore event names, so the controls were silently dead:</p><pre>// before (Phaser 3, pre-3.16) — no longer fires<br>this.input.keyboard.on(&quot;keydown_SPACE&quot;, jump);<br>// after (Phaser 4)<br>this.input.keyboard!.on(&quot;keydown-SPACE&quot;, jump);</pre><p><strong>Body.height became read-only.</strong> The original changed the duck hitbox by assigning to the body directly. In Phaser 4 that&#39;s a type error — you must go through setSize/setOffset:</p><pre>// before (Phaser 3)<br>this.dino.body.height = 58;<br>this.dino.body.offset.y = 34;</pre><pre>// after (Phaser 4) - wrapped in a small helper<br>private setDinoHitbox(height: number, offsetY: number) {<br>  const body = this.dinoBody;<br>  body.setSize(body.width, height, false);<br>  body.setOffset(body.offset.x, offsetY);<br>}</pre><p><strong>Invisible sprites now need a texture.</strong> The start sensor used to be created with no texture; Phaser 4 requires one, so it’s created with a texture and hidden.</p><p>None of these are dramatic. But they’re the kind of thing that turns “the AI rewrote my game” into “the game silently doesn’t respond to the spacebar.” <strong>TypeScript caught most of them at compile time</strong> — the read-only Body.height, the texture argument, the boolean-not-number play() flag — which is the whole argument for converting to types as part of the modernization.</p><h3>Why the small size is the point</h3><p>Here’s what I keep coming back to. You <em>can</em> ask an AI to generate a dino game from scratch, and you’ll get something that runs. What you won’t necessarily get is:</p><ul><li>a clean state machine instead of tangled booleans,</li><li>pooled obstacles instead of leaking sprites,</li><li>a difficulty curve that’s one honest number,</li><li>and a codebase where the next change lands in an obvious place.</li></ul><p>This game had all of that already, because a human thought about it years ago. The AI’s job wasn’t to invent that structure — it was to <strong>carry it forward</strong>: swap the toolchain, add types, apply the engine’s breaking changes, and let the type-checker and a couple of unit tests confirm nothing broke.</p><p>I even split the tiny bit of pure logic (score formatting, best-score comparison) into plain functions and unit-tested them:</p><pre>export function formatScore(score: number): string {<br>  return String(Math.max(0, Math.floor(score))).padStart(5, &quot;0&quot;);<br>}</pre><pre>test(&quot;zero-pads to the display width&quot;, () =&gt; {<br>  expect(formatScore(42)).toBe(&quot;00042&quot;);<br>});</pre><p>Six little tests, no browser, instant confidence. That’s the loop that makes AI modernization safe: <strong>AI proposes, types and tests verify.</strong></p><h3>The takeaway</h3><p>The dino game is the smallest thing I could show you, and that’s exactly why it’s convincing. “AI, make me a game” gets you a demo. “AI, help me carry <em>this</em> game forward” — with its state machine, its pooling, its one-number difficulty curve — gets you a maintained, typed, tested project two engine versions newer.</p><p>Architecture is still the human’s job. Even at 300 lines. <strong>Especially</strong> at 300 lines, because that’s where you can actually see it.</p><p><em>Building small JS games with AI? Give it a clear structure to work in, convert to types so mistakes fail loudly, and make it prove its changes. The machine handles the rest.</em></p><p>This game, full source, assets, and a playable build is available to my Patreon supporters. It’s alsopart of my Udemy Phaser course, where I build it step by step.</p><p><a href="https://dino-ts.vercel.app/">▶️ Play the game</a> · <a href="https://www.patreon.com/cw/filipjerga">💾 Get the source on Patreon</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04fd53bbec65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/the-smallest-game-the-clearest-lesson-modernizing-a-chrome-dino-clone-with-ai-04fd53bbec65">The Smallest Game, the Clearest Lesson: Modernizing a Chrome-Dino Clone with AI</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Architecture of a Platformer I Built 6 Years Ago and Modernized with AI.]]></title>
            <link>https://medium.com/eincode/the-architecture-of-a-platformer-i-built-6-years-ago-and-modernized-with-ai-d26961c36c9d?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/d26961c36c9d</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 15:43:53 GMT</pubDate>
            <atom:updated>2026-08-26T15:43:53.390Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Everyone wants to build games with AI right now, especially in JavaScript. Here’s the honest version: a hand-built Phaser platformer, the architecture that made it last, and what AI was and wasn’t good at.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZG5YvG81aDgynffFBu9Aw.png" /></figure><p>Confession: I didn’t build this game with AI. I made it by hand ~6 years ago for my Udemy Phaser course a 2D platformer with jumping, sword-swinging, and patrolling enemies.</p><p>Recently I used AI to modernize it, not write it: Phaser 3 → 4, JS → TS, Webpack → Vite, npm → Bun.</p><p>The lesson: AI shines inside a well-structured codebase but is weak at inventing the structure. That’s what this post is about.</p><p><strong><em>Want the full source and the playable game?</em></strong></p><p><a href="https://platformer-game-ts.vercel.app/">▶️ Play the game</a> · <a href="https://www.patreon.com/cw/filipjerga">💾 Get the source on Patreon</a></p><h3>The game in one breath</h3><p>A Phaser game is a set of <strong>scenes</strong> (menu, level select, gameplay, credits). Only one or two run at a time; the engine manages them. Inside the gameplay scene, entities (the player, enemies), attacks (projectiles, a sword), pickups, and a HUD all interact through arcade physics.</p><p>Everything below is about how those pieces are organized so they don’t turn into spaghetti.</p><h3>1. Scenes are the backbone</h3><p>Booting the game is just declaring the scenes and some config:</p><pre>// src/main.ts<br>const config: Phaser.Types.Core.GameConfig = {<br>  type: Phaser.AUTO,          // WebGL where available, Canvas fallback<br>  width: SHARED_CONFIG.width,<br>  height: SHARED_CONFIG.height,<br>  pixelArt: true,<br>  physics: { default: &quot;arcade&quot;, arcade: { debug: false } },<br>  scene: [PreloadScene, MenuScene, LevelScene, PlayScene, CreditsScene],<br>};</pre><pre>export default new Phaser.Game(config);</pre><p>Each scene owns one screen and one responsibility. PreloadScene loads every asset up front, so the rest of the game can assume things exist. The menu scenes share a BaseScene (common background, a menu builder). PlayScene is the only heavy one — it assembles a level.</p><p><strong>Decision:</strong> one scene = one responsibility. Loading, menus, and gameplay never bleed into each other.</p><h3>2. Inheritance for what things are</h3><p>The actors form a tiny hierarchy on top of Phaser’s sprite:</p><pre>Phaser.Physics.Arcade.Sprite<br>├── Player              (movement, attacks, taking damage)<br>└── Enemy               (patrol + ledge detection)<br>    ├── Birdman         (flaps in place)<br>    └── Snaky           (walks and spits fireballs)</pre><p>A Birdman <strong>is an</strong> Enemy, which <strong>is a</strong> Sprite. Inheritance models that &quot;is-a&quot; relationship perfectly. The base Enemy handles patrolling and turning around at ledges; subclasses only add what&#39;s unique:</p><pre>// src/entities/Snaky.ts<br>class Snaky extends Enemy {<br>  override update(time: number): void {<br>    super.update(time);                 // patrol logic from Enemy<br>    if (this.timeFromLastAttack + this.attackDelay &lt;= time) {<br>      this.projectiles.fireProjectile(this, &quot;fireball&quot;);   // Snaky&#39;s own thing<br>      // ...<br>    }<br>  }<br>}</pre><p><strong>Decision:</strong> use inheritance only for genuine “is-a”. A Snaky really is a specialized Enemy, so it earns a subclass.</p><h3>3. Mixins for what things can do</h3><p>Here’s the more interesting decision. Both the <strong>Player</strong> and the <strong>Enemies</strong> need to add physics colliders and cast rays to detect walls — but a Player is <em>not</em> an Enemy, and neither is a “Collider” type. Forcing that into the inheritance tree would be wrong.</p><p>So those cross-cutting abilities are <strong>mixins</strong> — small bundles of behavior mixed onto any class that needs them:</p><pre>// src/mixins/collidable.ts  (abridged)<br>export const collidable = {<br>  addCollider(other, callback, context) {<br>    this.scene.physics.add.collider(this, other, callback, undefined, context ?? this);<br>    return this;<br>  },<br>  raycast(body, layer, options) { /* detect a ledge/wall ahead */ },<br>};</pre><p>They’re attached in the constructor:</p><pre>// src/entities/Player.ts<br>class Player extends Phaser.Physics.Arcade.Sprite {<br>  constructor(scene, x, y) {<br>    super(scene, x, y, &quot;player&quot;);<br>    Object.assign(this, collidable);   // now Player can addCollider / raycast<br>    Object.assign(this, anims);        // …and query its current animation<br>  }<br>}</pre><p>This is <strong>composition over inheritance</strong>: “can-do” abilities are plugged in horizontally, instead of being forced into a vertical class tree. The Player, the Enemy, and the Enemies <em>group</em> all mix in collidable without being related.</p><p>(In the TypeScript version we teach the compiler about this with a one-line interface Player extends Collidable {} next to the class — &quot;declaration merging&quot; — so this.addCollider(...) is fully typed. More on the TS conversion later.)</p><h3>4. Object pooling: reuse, don’t spawn</h3><p>Firing a projectile every frame and destroying it on impact would thrash memory. Instead, each shooter owns a small <strong>pool</strong> of projectiles, created once and recycled:</p><pre>// src/attacks/Projectiles.ts<br>class Projectiles extends Phaser.Physics.Arcade.Group {<br>  constructor(scene, key) {<br>    super(scene.physics.world, scene);<br>    this.createMultiple({ frameQuantity: 5, active: false, visible: false, key, classType: Projectile });<br>  }</pre><pre>fireProjectile(initiator, anim) {<br>    const projectile = this.getFirstDead(false);   // grab an idle one<br>    if (!projectile) return;                        // pool empty → skip<br>    // …aim it, activate it, fire.<br>  }<br>}</pre><p>Five projectiles exist forever; firing just wakes a sleeping one. <strong>Decision:</strong> pool anything you spawn frequently.</p><h3>5. Decouple with an event bus</h3><p>When the player dies, the <em>Play scene</em> needs to restart the level — but the Player shouldn’t know anything about scenes. So the Player just shouts into a shared event bus:</p><pre>// src/events/Emitter.ts<br>class EventEmitter extends Phaser.Events.EventEmitter {}<br>export default new EventEmitter();   // one shared instance</pre><pre>// Player: &quot;I lost&quot; — no idea who&#39;s listening<br>EventEmitter.emit(&quot;PLAYER_LOOSE&quot;);</pre><pre>// PlayScene: &quot;when anyone loses, restart&quot;<br>EventEmitter.on(&quot;PLAYER_LOOSE&quot;, () =&gt; this.scene.restart({ gameStatus: &quot;PLAYER_LOOSE&quot; }));</pre><p><strong>Decision:</strong> entities emit facts; scenes decide consequences. Neither holds a reference to the other.</p><h3>6. Levels are data, not code</h3><p>The levels aren’t hand-coded — they’re designed in <a href="https://www.mapeditor.org/">Tiled</a> and exported as JSON. The scene reads <em>layers</em> (platforms, spikes, background) and <em>object layers</em> (where the player starts, where enemies spawn, where the coins are):</p><pre>// src/scenes/Play.ts (abridged)<br>const map = this.make.tilemap({ key: `level_${this.getCurrentLevel()}` });<br>const platforms = map.createLayer(&quot;platforms&quot;, tileset);<br>const enemySpawns = map.getObjectLayer(&quot;enemy_spawns&quot;);</pre><pre>enemySpawns.objects.forEach((spawn) =&gt; {<br>  const EnemyClass = ENEMY_TYPES[spawn.type];   // &quot;Birdman&quot; | &quot;Snaky&quot;<br>  enemies.add(new EnemyClass(this, spawn.x, spawn.y));<br>});</pre><p>Want a new level? Draw it. Want a Snaky over there? Drop an object with type: &quot;Snaky&quot;. <strong>Decision:</strong> content lives in data, so building levels never means editing code.</p><h3>7. Keep the rules out of the engine</h3><p>Phaser objects need a canvas and a browser, which makes them painful to test. So the pure <em>decisions</em> are pulled into plain functions with no Phaser in sight:</p><pre>// src/game/lib/damage.ts<br>export function resolveDamage(source: HitSource): number {<br>  // weapons/enemies carry `damage`; trap tiles carry `properties.damage`<br>  return source.damage ?? source.properties?.damage ?? 0;<br>}</pre><pre>// tests/damage.test.ts — no browser needed<br>test(&quot;falls back to trap tile properties&quot;, () =&gt; {<br>  expect(resolveDamage({ properties: { damage: 25 } })).toBe(25);<br>});</pre><p>Combat itself is <strong>duck-typed</strong>: anything with takesHit() can be hit, anything with damage can hurt it. A projectile, a sword, a trap tile, and an enemy are all just &quot;hit sources&quot; — no shared base class required.</p><h3>The decisions, in one list</h3><ul><li><strong>Inheritance for “is-a”</strong> (a Snaky is an Enemy), <strong>mixins for “can-do”</strong> (Player and Enemy can both collide).</li><li><strong>Pool</strong> anything spawned often.</li><li><strong>Decouple</strong> with events — emit facts, decide consequences elsewhere.</li><li><strong>Content as data</strong> (Tiled maps), not code.</li><li><strong>Rules as pure functions</strong>, kept out of the engine and unit-tested.</li></ul><p>None of this is clever. It’s just each piece having one clear job and one clear seam. Which brings me to AI.</p><h3>Then AI came in</h3><p>Five years later, the game still ran, but the toolchain was a museum: Phaser 3.24, plain JS, Webpack 4, npm, a dead Facebook Instant Games integration. I used an AI coding agent to modernize it. Here’s what it actually did — and what it couldn’t.</p><p><strong>What AI was great at:</strong></p><ul><li><strong>The mechanical migration.</strong> Converting 30+ files from JS to strict TypeScript, swapping Webpack for Vite and npm for Bun, and applying Phaser 4’s breaking changes (createStaticLayer → createLayer, tint changes, removed plugins). This is exactly the kind of broad, pattern-following work that&#39;s tedious by hand and quick for a machine.</li><li><strong>Polish and game feel.</strong> “Flash the player red and shake the camera on damage.” “Make the jump rise faster but keep the same height.” “Add a white hit-flash to enemies at 70% opacity.” Each of these is a small, well-contained change — and because the code had clear seams, the AI could make them without touching anything else.</li></ul><p><strong>Where the human architecture carried the AI:</strong></p><p>The clean structure is <em>why</em> those changes were safe. When I asked for a damage flash, there was one obvious place: Player.takesHit(). When I asked for faster jumps, the jump physics were three named constants, not magic numbers scattered around. Small files, clear responsibilities, and (after conversion) types meant the AI could reason locally instead of holding the whole game in its head.</p><p><strong>A concrete example — a bug only the combination created:</strong></p><p>The base Enemy constructor calls an overridable init() to set up subclass state — a pattern I wrote years ago and that worked fine in JavaScript. But modern TypeScript class fields run <em>after</em> super(), so when we converted to TS, a subclass field like Snaky.projectiles was being reset to undefined right after init() set it — a crash. The fix was a one-word change (declare), but finding it needed both an understanding of the old pattern <em>and</em> the new semantics. The AI proposed a fix; I made it prove it with a minimal reproduction before we trusted it. That loop — AI proposes, tests verify — is the whole game.</p><p><strong>Vendored knowledge.</strong> Phaser ships official <a href="https://github.com/phaserjs/phaser/tree/master/skills">“skill” files</a> — focused references per subsystem, written for AI assistants. Dropping them into the repo meant the AI read the <em>current</em> Phaser 4 API for my exact version instead of half-remembering Phaser 3 from its training data. That single step turned “an AI that kind of knows Phaser” into “an AI that knows <em>my</em> Phaser.”</p><h3>The honest take on “AI + gamedev”</h3><p>Everyone wants to type “make me a platformer” and get a finished game. You can get a <em>demo</em> that way. What you can’t get is a codebase that survives contact with the second feature request.</p><p>This game is the counter-example. A human designed it — scenes, entities, mixins, pooling, events, data-driven levels — 5–6 years ago. That design is exactly what let an AI modernize it two engine-major-versions forward, add real game feel, and stay green on type-checks and tests the whole way.</p><p>The takeaway isn’t “AI can’t build games.” It’s: <strong>architecture is the part that’s still yours.</strong> Good structure is what makes AI a force multiplier instead of a spaghetti generator. Draw the seams well, and the machine will happily do the rest — and catch the odd 6-year-old bug on the way.</p><p><em>If you’re using AI on your own JS games: give it clear seams, give it types, give it the real docs — and make it prove its fixes. Then let it fly.</em></p><p>This game, full source, assets, and a playable build is available to my Patreon supporters. It’s alsopart of my Udemy Phaser course, where I build it step by step.</p><p><a href="https://platformer-game-ts.vercel.app/">▶️ Play the game</a> · <a href="https://www.patreon.com/cw/filipjerga">💾 Get the source on Patreon</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d26961c36c9d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/the-architecture-of-a-platformer-i-built-6-years-ago-and-modernized-with-ai-d26961c36c9d">The Architecture of a Platformer I Built 6 Years Ago and Modernized with AI.</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rebuilding Flappy Bird with Phaser 4, TypeScript & an AI That Actually Knows the Engine]]></title>
            <link>https://medium.com/eincode/rebuilding-flappy-bird-with-phaser-4-typescript-an-ai-that-actually-knows-the-engine-95e842b2a7f3?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/95e842b2a7f3</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 19:47:27 GMT</pubDate>
            <atom:updated>2026-08-25T20:14:35.448Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How I modernised a dusty Phaser 3 game into a clean, typed, test-backed project and the architecture decisions that made it a joy to extend (by me and by an AI).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Q4W3By1cS38eVvpRpse8g.png" /></figure><p>I built this Flappy Bird clone from scratch years ago to teach Phaser in my Udemy course — Phaser 3.24, plain JavaScript, Webpack 4, npm. Digging it back out recently felt like opening a time capsule.</p><p>So I modernised it: new toolchain, two engine-major-versions up, a coin-and-combo mechanic with particles and screen shake, a chiptune soundtrack synthesized from scratch — with an AI assistant along for the ride. The key word is modernised, not generated: the game was already mine.</p><p><strong><em>Want the full source and the playable game?</em></strong></p><p><a href="https://flappy-bird-ts.vercel.app/">▶️ Play the game</a> · <a href="https://www.patreon.com/cw/filipjerga">💾 Get the source on Patreon</a></p><h3>The stack, and why each piece earns its place</h3><ul><li><a href="https://phaser.io/"><strong>Phaser 4.2</strong></a> — the game engine, with a brand-new WebGL renderer.</li><li><a href="https://www.typescriptlang.org/"><strong>TypeScript</strong></a> (strict mode) — every line is typed.</li><li><a href="https://vite.dev/"><strong>Vite</strong></a> — dev server + bundler.</li><li><a href="https://bun.sh/"><strong>Bun</strong></a> — package manager <em>and</em> test runner.</li><li><a href="https://biomejs.dev/"><strong>Biome</strong></a> — lint + format in a single fast binary.</li><li><a href="https://lefthook.dev/"><strong>lefthook</strong></a> — Git pre-commit hooks.</li></ul><p>The reasoning behind each swap, because “use the shiny thing” isn’t a reason:</p><p><strong>Webpack 4 → Vite.</strong> The old project had a webpack.common.js, a webpack.prod.js, Babel presets, and a clutch of loader plugins — a few hundred lines of build config to turn JS into JS. Vite needs a ~15-line vite.config.ts, speaks TypeScript natively, and its dev server cold-starts in ~120ms because it serves native ES modules instead of pre-bundling everything. The build config stopped being a thing I maintain.</p><p><strong>npm → Bun.</strong> Bun is the package manager (bun install), the script runner (bun run dev), <em>and</em> the test runner (bun test) — one tool instead of three, no separate Jest/Vitest install, no ts-jest transform config. Tests are just import { test, expect } from &quot;bun:test&quot;. Fewer moving parts is itself an architecture decision.</p><p><strong>ESLint + Prettier → Biome.</strong> One binary does both linting and formatting, it’s fast, and it’s a single biome.json instead of an .eslintrc + .prettierrc + the plugins that glue them together. Fewer configs, fewer version conflicts.</p><p><strong>Babel → TypeScript (strict).</strong> The original was untyped JS. Going strict-typed isn’t just safety theatre — as you’ll see, it’s what lets both me <em>and</em> an AI refactor confidently, because a wrong method name or a malformed config object fails tsc instantly.</p><h3>The scripts</h3><p>The whole developer workflow lives in package.json, and every task is one word:</p><pre>bun run dev        vite                          Dev server with hot-module reload<br>bun run build      tsc --noEmit &amp;&amp; vite build    Type-check first, then bundle<br>bun run preview    vite preview                  Serve the production build locally<br>bun run typecheck  tsc --noEmit                  Types only; the bundler does the transpile<br>bun run lint       biome check .                 Lint + format check, no writes (the CI gate)<br>bun run lint:fix   biome check --write .         Auto-fix and format in place<br>bun test           bun test                      Run the unit tests</pre><p>Two decisions hide in that table:</p><ol><li><strong>build runs </strong><strong>tsc --noEmit <em>before</em> Vite.</strong> TypeScript never emits JS here, Vite owns bundling. tsc&#39;s only job is to be the gatekeeper: no build ships with a type error. Separating &quot;check types&quot; from &quot;produce output&quot; keeps each tool doing one thing.</li><li><strong>lint (check-only) and </strong><strong>lint:fix (write) are separate.</strong> CI runs the check; humans run the fix. And a prepare hook installs a lefthook pre-commit that auto-formats staged files and type-checks, so the repo stays clean without anyone remembering to.</li></ol><h3>A deliberately simple project structure</h3><pre>.<br>├── index.html            # Vite entry; mounts the game canvas<br>├── public/assets/        # Sprites, images, and generated audio<br>├── scripts/              # generate-sounds.py — synthesizes the chiptune audio<br>├── src/<br>│   ├── main.ts           # Boots Phaser, registers the scenes<br>│   ├── config.ts         # Canvas size + shared scene config<br>│   ├── game/lib/         # Pure, framework-free game logic (unit-tested)<br>│   │   ├── difficulty.ts<br>│   │   ├── score.ts<br>│   │   └── combo.ts<br>│   └── scenes/           # Phaser scenes (Preload, Menu, Play, Pause, Score)<br>├── tests/                # Bun unit tests for the pure logic<br>└── .claude/skills/       # ← the AI&#39;s knowledge of Phaser (more on this later)</pre><p>The single most important line in that tree is src/game/lib/. Everything else follows from one rule: <strong>the rules of the game are separate from the engine that renders them.</strong></p><h3>How it works, in one breath</h3><p>A Phaser game is a collection of <strong>scenes</strong>. Only one or two are active at a time; the engine starts, pauses and resumes them.</p><pre>PreloadScene → MenuScene → PlayScene ⇄ PauseScene<br>                    ↕<br>                ScoreScene</pre><p>Booting is just wiring scenes into a config object:</p><pre>// src/main.ts<br>const config: Phaser.Types.Core.GameConfig = {<br>  type: Phaser.AUTO,          // WebGL where available, Canvas fallback<br>  width: SHARED_CONFIG.width,<br>  height: SHARED_CONFIG.height,<br>  pixelArt: true,             // crisp scaling for the sprites<br>  parent: &quot;game-container&quot;,<br>  physics: { default: &quot;arcade&quot;, arcade: { debug: false } },<br>  scene: createScenes(),      // [Preload, Menu, Score, Play, Pause]<br>};</pre><pre>export default new Phaser.Game(config);</pre><p>Now the interesting part.</p><h3>The architecture decisions</h3><h3>1. A pure core and a reactive shell</h3><p>Phaser objects need a canvas, WebGL and a DOM — which makes them miserable to unit-test. So the codebase splits along a hard line:</p><ul><li><strong>src/game/lib/</strong> — pure functions. Difficulty curve, best-score rules, coin/combo math. No Phaser, no DOM, no side effects. Same input, same output.</li><li><strong>src/scenes/</strong> — the Phaser layer. It <em>reacts</em> to what the pure core decides, and owns everything visual: sprites, particles, camera, sound.</li></ul><p>The coin-combo system is the clearest example. “Collect coins in a row and a multiplier climbs; miss one and it resets” is just arithmetic:</p><pre>// src/game/lib/combo.ts<br>export const COINS_PER_TIER = 3;<br>export const MAX_MULTIPLIER = 5;</pre><pre>export interface ComboState {<br>  readonly combo: number;      // consecutive coins collected<br>  readonly multiplier: number; // score multiplier the combo grants<br>}<br>/** 0–2 coins → ×1, 3–5 → ×2, 6–8 → ×3, … capped at MAX_MULTIPLIER. */<br>export function comboMultiplier(combo: number): number {<br>  if (combo &lt;= 0) return 1;<br>  return Math.min(1 + Math.floor(combo / COINS_PER_TIER), MAX_MULTIPLIER);<br>}<br>export function collectCoin(state: ComboState) {<br>  const combo = state.combo + 1;<br>  const multiplier = comboMultiplier(combo);<br>  return {<br>    state: { combo, multiplier },<br>    points: multiplier,<br>    multiplierIncreased: multiplier &gt; state.multiplier, // → trigger a shake!<br>  };<br>}</pre><p>Because it’s pure, the test needs no browser:</p><pre>// tests/combo.test.ts<br>test(&quot;flags when a coin bumps the multiplier to a new tier&quot;, () =&gt; {<br>  let state = INITIAL_COMBO_STATE;<br>  const increases: number[] = [];<br>  for (let i = 1; i &lt;= COINS_PER_TIER; i++) {<br>    const result = collectCoin(state);<br>    state = result.state;<br>    if (result.multiplierIncreased) increases.push(i);<br>  }<br>  expect(increases).toEqual([COINS_PER_TIER]); // tiers up on the 3rd coin<br>});</pre><p>And the scene just translates the result into feel:</p><pre>// src/scenes/PlayScene.ts (excerpt)<br>private onCoinCollected(coin: Phaser.Physics.Arcade.Sprite): void {<br>  const result = collectCoin(this.comboState);   // ← pure decision<br>  this.comboState = result.state;<br>  this.coinScore += result.points;</pre><pre>this.coinBurst.explode(12, coin.x, coin.y);    // ← reaction: particles<br>  this.sound.play(&quot;coinSfx&quot;, { volume: 0.5 });   // ← reaction: sound<br>  if (result.multiplierIncreased) {              // ← the flag drives the juice<br>    this.cameras.main.shake(120, 0.008);<br>    this.cameras.main.flash(150, 255, 235, 130);<br>    this.sound.play(&quot;combo&quot;, { volume: 0.6 });<br>  }<br>}</pre><p>Notice multiplierIncreased is computed by the <em>pure</em> module but <em>spent</em> by the scene. The logic decides &quot;something worth celebrating happened&quot;; the scene decides what celebration looks like. That&#39;s the whole pattern in two lines.</p><h3>2. Shared behaviour lives in a BaseScene</h3><p>Four of the five scenes share the same skeleton: draw the sky, maybe a back button, lay out a vertical menu, manage music. Rather than copy-paste, they extend a BaseScene. New scenes get the background, the menu builder, and the music switcher for free — the subclass just adds what&#39;s unique. It&#39;s classic inheritance, but here it genuinely pays off because scenes really are variations on a theme.</p><h3>3. Object pooling: recycle, don’t spawn</h3><p>The naïve way to make endless pipes is to spawn a pair, and destroy it when it leaves the screen. That churns the garbage collector forever. Instead, a fixed pool of <strong>four</strong> pipe pairs scrolls left, and when one exits the left edge it’s teleported back to the right with a fresh gap:</p><pre>private recyclePipes(): void {<br>  for (const pair of this.pipePairs) {<br>    if (pair.upper.getBounds().right &lt;= 0) {<br>      if (!pair.coinCollected) this.breakCombo();  // missed coin resets combo<br>      this.placePipe(pair);                        // reposition to the right<br>      this.increaseScore();<br>      this.increaseDifficulty();<br>    }<br>  }<br>}</pre><p>Four pairs, forever. Memory stays flat, and the scoring/difficulty ramp naturally hangs off the recycle event.</p><h3>4. Model an obstacle as one thing</h3><p>When I added coins, the question was: where do they live? A separate coins array, tracked in parallel with pipes? That’s two things to keep in sync. Instead, an obstacle is <em>one</em> object — the pipes and the coin that floats in their gap, bundled:</p><pre>interface PipePair {<br>  upper: Phaser.Physics.Arcade.Sprite;<br>  lower: Phaser.Physics.Arcade.Sprite;<br>  coin: Phaser.Physics.Arcade.Sprite;<br>  coinCollected: boolean;   // did the player grab this one?<br>}</pre><p>Now “recycle the obstacle” repositions the pipes <em>and</em> re-arms the coin in one place, and “was the coin missed?” is a property on the same object that scrolled by. Bundling the related state killed a whole category of sync bugs.</p><h3>5. The game registry as cross-scene shared state</h3><p>The trickiest bit of state isn’t in any one scene: the background music. It has to keep playing <em>across</em> scenes, switch tracks when you enter/leave gameplay, and never stack two tracks. Scenes are created and destroyed as you navigate, so a scene field won’t survive.</p><p>Phaser has a shared, game-wide key/value store — this.registry — that outlives individual scenes. So the music switcher lives on BaseScene, keeps its state in the registry, and any scene can call it:</p><pre>// src/scenes/BaseScene.ts (excerpt)<br>protected playMusic(key: string, volume = 0.35): void {<br>  this.registry.set(&quot;desiredMusicKey&quot;, key);   // record intent synchronously</pre><pre>const startTrack = () =&gt; {<br>    if (this.registry.get(&quot;desiredMusicKey&quot;) !== key) return; // superseded<br>    const current = this.registry.get(&quot;music&quot;) as Phaser.Sound.BaseSound | undefined;<br>    if (this.registry.get(&quot;musicKey&quot;) === key &amp;&amp; current?.isPlaying) return; // no-op<br>    current?.stop();<br>    current?.destroy();<br>    const music = this.sound.add(key, { loop: true, volume });<br>    music.play();<br>    this.registry.set(&quot;music&quot;, music);<br>    this.registry.set(&quot;musicKey&quot;, key);<br>  };<br>  if (this.sound.locked) {<br>    this.sound.once(Phaser.Sound.Events.UNLOCKED, startTrack); // defer past autoplay lock<br>  } else {<br>    startTrack();<br>  }<br>}</pre><p>MenuScene calls playMusic(&quot;menu&quot;), PlayScene calls playMusic(&quot;bgm&quot;), and the rest is handled: it no-ops if the track is already playing (so death-restarts don&#39;t restart the music), and it stops the old track before starting the new one.</p><h3>6. Design around the engine’s realities</h3><p>Three small snags in that last snippet are worth calling out, because they’re the kind of thing that separates “works on my machine” from “works”:</p><ul><li><strong>Browsers block autoplay.</strong> Audio is locked until the first user gesture. So playMusic checks this.sound.locked and defers the start to the UNLOCKED event.</li><li><strong>The unlock races the first click.</strong> That first click both unlocks audio <em>and</em> starts the game — so a deferred “menu” start could fire <em>after</em> gameplay begins and wrongly override the track. The fix: record a desiredMusicKey synchronously, and a later request supersedes an earlier deferred one.</li><li><strong>update() runs every frame.</strong> The death check runs ~60×/second, so gameOver() would fire its burst, shake and jingle dozens of times before the restart timer kicks in. A one-line isGameOver guard makes it idempotent.</li></ul><p>None of these are Phaser’s fault — they’re the reality of games, browsers and frame loops. Good architecture is partly just naming these hazards and handling them in one obvious place.</p><h3>7. Generated, not shipped: assets as code</h3><p>The soundtrack — a looping menu theme, an energetic gameplay track, and effects for flap/score/coin/combo/game-over — isn’t a folder of downloaded WAVs. It’s a single Python script (scripts/generate-sounds.py, standard library only, under 300 lines) that synthesizes chiptune waveforms:</p><pre>def square(phase, duty=0.5):<br>    return 1.0 if (phase % 1.0) &lt; duty else -1.0   # the classic 8-bit tone</pre><p>It builds tones with attack/release envelopes (so they don’t click), assembles little arpeggios into seamless loops, and writes 16-bit WAVs. The same idea shows up for the particle “spark”: a soft dot generated at runtime with Graphics.generateTexture() instead of an image file. Treating assets as <em>code</em> means they&#39;re diffable, tweakable, and free of binary bloat — change a note, re-run the script, done.</p><h3>The part where AI gets interesting</h3><p>Here’s the bit I actually wanted to write about.</p><p>Phaser 4 is a big release — a new renderer, FX and masks unified into filters, Geom.Point replaced by Vector2, and a long list of other breaking changes. Migrating blind would be a slog.</p><p>But the Phaser team ships something clever: a <a href="https://github.com/phaserjs/phaser/tree/master/skills">skills/ folder in the repo</a> — 28 focused SKILL.md files, one per subsystem (physics, particles, cameras, tweens, tilemaps…), plus a dedicated <strong>v3-to-v4 migration guide</strong>. Each file is written to be read by an AI coding assistant, and each one carries frontmatter:</p><pre>---<br>name: v3-to-v4-migration<br>description: &quot;Use this skill when migrating a Phaser 3 project to Phaser 4,<br>  or when a user asks about breaking changes... Triggers on: migrate, upgrade,<br>  v3 to v4, breaking changes, Phaser 3 to 4.&quot;<br>---</pre><p>I vendored all 28 into .claude/skills/. Because they carry that frontmatter, my assistant (<a href="https://claude.com/claude-code">Claude Code</a>) loads them on demand: ask it to &quot;add a particle trail behind the bird&quot; and it pulls in the particles skill; ask about the upgrade and it reads the migration guide. The &quot;documents&quot; are first-class engine knowledge maintained by the people who built the engine.</p><p>The migration itself? Because the game only touches the standard API (arcade physics, sprites, text, scenes), the assistant worked the migration checklist, confirmed none of the breaking changes applied, bumped one dependency, and the type-check, tests and build stayed green. A two-major-version engine upgrade came down to phaser: &quot;^4.2.1&quot;.</p><h3>Why the architecture is “AI-friendly”</h3><p>Every decision above compounds into something an AI can work with safely:</p><ol><li><strong>Strict TypeScript: </strong>instant, precise feedback. A wrong method name or bad config shape fails tsc immediately, so mistakes never reach the browser.</li><li><strong>Pure logic + unit tests: </strong>the game’s rules are verifiable without a canvas. The AI can change scoring logic and <em>prove</em> it still works with bun test, not just eyeball it.</li><li><strong>Clear seams: </strong>the pure/reactive split, the BaseScene, the PipePair, the registry-backed music: each is an obvious place to make a change. An AI (or a human six months later) doesn&#39;t have to hold the whole game in their head to add a feature.</li><li><strong>Vendored skills: </strong>the model reads the current, correct docs for the exact version I’m on, instead of half-remembering a v3-shaped API from its training data.</li></ol><p>That last point matters more than it sounds. Game engines have enormous surface areas and move fast. An AI guessing at emitter config from memory is a recipe for subtle, silent bugs. An AI reading the official particle skill for <em>your installed version</em> just gets it right.</p><h3>Takeaways</h3><ul><li><strong>Pick tools that collapse steps.</strong> Bun (install + run + test), Vite (dev + build), Biome (lint + format) each replaced two or three things. Fewer configs is fewer things to break.</li><li><strong>Draw a hard line between rules and rendering.</strong> It’s better design, it’s the part you can actually test, and it’s the part an AI can safely refactor.</li><li><strong>Name the hazards.</strong> Autoplay locks, frame-loop re-entry, cross-scene state — handle each in one obvious place and they stop being bugs.</li><li><strong>Feed your AI real, versioned documentation.</strong> Vendoring the Phaser skill files was the single highest-leverage thing I did — it turned “AI that kind of knows Phaser” into “AI that knows <em>my</em> Phaser.”</li></ul><p>The interesting part was never the game. It’s how little friction there is between an idea, a typed implementation, a passing test, and an AI that understands all three.</p><p><em>Now go add a screen shake to something.</em></p><p>This game, full source, assets, and a playable build is available to my Patreon supporters. It’s alsopart of my Udemy Phaser course, where I build it step by step.</p><p><a href="https://flappy-bird-ts.vercel.app/">▶️ Play the game</a> · <a href="https://www.patreon.com/cw/filipjerga">💾 Get the source on Patreon</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95e842b2a7f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/rebuilding-flappy-bird-with-phaser-4-typescript-an-ai-that-actually-knows-the-engine-95e842b2a7f3">Rebuilding Flappy Bird with Phaser 4, TypeScript &amp; an AI That Actually Knows the Engine</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Make Claude Code Follow Your Project Rules]]></title>
            <link>https://medium.com/eincode/how-to-make-claude-code-follow-your-project-rules-5df71163886c?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/5df71163886c</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 19:45:05 GMT</pubDate>
            <atom:updated>2026-07-14T19:49:41.243Z</atom:updated>
            <content:encoded><![CDATA[<h4>Use CLAUDE.md, scoped rules, and reusable skills to make AI a reliable part of your development workflow.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UI8hbn0bAtztndZlBdJ-YA.png" /></figure><p>AI can write code quickly.</p><p>It can create components, refactor functions, explain unfamiliar code, write tests, and help you move through repetitive work much faster.</p><p>But there is a problem.</p><p>Without context, AI does not know how your project is structured. It does not know which commands you use, where API logic belongs, whether a file is generated, or which patterns already exist in the codebase.</p><p>That is how you end up with AI-generated code that works in isolation but does not fit the project.</p><p>It might use npm in a Bun project. It might write a custom fetch function instead of using your generated API hooks. It might edit generated files. It might put database logic in the frontend. Or it might introduce a new pattern when the project already has a better one.</p><p>The solution is not to stop using AI.</p><p>The solution is to give AI a clear environment to work in.</p><p>In this article, I will show how to use Claude Code rules and skills to make AI-assisted development more consistent in a modern TypeScript monorepo.</p><p>The examples use a stack built with Next.js, NestJS, Bun, Turborepo, Biome, Prisma, Swagger, Orval, TanStack Query, and nuqs.</p><p>You can explore the full project here:</p><p><a href="https://github.com/Jerga99/next-modern-stack">View the GitHub repository</a></p><p>And if you want to build the complete stack step by step:</p><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E">Check out my Next JS Modern Stack — Tooling and AI course</a></p><h3>The Problem with Generic AI Prompts</h3><p>A prompt like this is common:</p><blockquote><em>Add note creation to my app.</em></blockquote><p>Claude can probably create something useful.</p><p>But it still has to guess:</p><ul><li>Which package manager should it use?</li><li>Is this a monorepo?</li><li>Does the API already exist?</li><li>Should it add a NestJS endpoint?</li><li>Should the frontend call the API directly?</li><li>Are types written manually or generated from Swagger?</li><li>Should it use React state, TanStack Query, or URL state?</li><li>What should it run after making changes?</li></ul><p>The more Claude has to guess, the less predictable the result becomes.</p><p>A strong AI workflow removes unnecessary guessing.</p><p>Instead of repeatedly explaining your project in chat, you store the important context inside the repository.</p><h3>The Three Layers of an AI-Ready Project</h3><p>I like to think about Claude Code setup in three layers:</p><pre>CLAUDE.md          Project-wide facts and rules<br>.claude/rules/     Focused rules for specific parts of the codebase<br>.claude/skills/    Repeatable multi-step workflows</pre><p>Each layer has a different purpose.</p><h3>CLAUDE.md</h3><p>Use this for rules that apply across the project.</p><p>Examples:</p><ul><li>package manager and commands</li><li>repository structure</li><li>code-quality commands</li><li>important architecture boundaries</li><li>generated-code rules</li><li>shared conventions</li></ul><h3>.claude/rules/</h3><p>Use this for rules that apply only to a specific area.</p><p>For example:</p><ul><li>frontend rules for apps/web</li><li>NestJS rules for apps/api</li><li>rules for generated API clients</li><li>database conventions</li><li>testing requirements</li></ul><h3>.claude/skills/</h3><p>Use skills for repeatable procedures.</p><p>For example:</p><ul><li>adding a new API feature</li><li>generating the API client</li><li>reviewing a pull request</li><li>deploying the application</li><li>preparing a release</li></ul><p>The difference is simple:</p><blockquote><em>Rules explain how the project works. Skills explain how to perform a recurring task.</em></blockquote><h3>Start with a Useful CLAUDE.md</h3><p>Your root CLAUDE.md should contain the information that Claude needs in almost every session.</p><p>Keep it short, specific, and practical.</p><p>Here is a good starting point for a Next.js and NestJS monorepo:</p><pre># Next Modern Stack</pre><pre>## Project Structure</pre><pre>- `apps/web` contains the Next.js frontend.<br>- `apps/api` contains the NestJS backend.<br>- The project uses Bun workspaces and Turborepo.<br>- Use Bun commands. Do not use npm, pnpm, or yarn.</pre><pre>## Commands</pre><pre>- Start the full stack: `bun run dev`<br>- Start the frontend only: `bun run dev:web`<br>- Start the API only: `bun run dev:api`<br>- Check code quality: `bun run lint`<br>- Fix formatting and lint issues: `bun run lint:fix`<br>- Generate API client code: `bun run generate`</pre><pre>## Architecture Rules</pre><pre>- Keep database access inside `apps/api`.<br>- Use Prisma only in the API workspace.<br>- Use Swagger as the backend API contract.<br>- Use generated Orval hooks in `apps/web`.<br>- Do not manually edit generated files in `apps/web/src/generated`.<br>- Use TanStack Query for server state.<br>- Use nuqs for URL-driven UI state.</pre><pre>## Code Quality</pre><pre>- Run `bun run lint:fix` after code changes.<br>- Do not consider a task complete until Biome passes.<br>- Prefer existing patterns before creating new abstractions.</pre><p>This is much better than vague instructions such as:</p><pre>Write clean code.<br>Use best practices.<br>Keep everything scalable.</pre><p>Those statements sound good, but they are difficult to verify.</p><p>Claude works better with concrete instructions.</p><p>For example:</p><pre>Use generated Orval hooks from `src/generated`.</pre><p>is much more useful than:</p><pre>Use the existing API layer.</pre><h3>Keep Rules Specific and Small</h3><p>A common mistake is putting every possible instruction into one giant CLAUDE.md.</p><p>That makes the file harder to maintain and gives Claude too much unrelated information.</p><p>Instead, keep the root file focused on project-wide facts.</p><p>Then move specific instructions into scoped rule files.</p><p>A useful structure could look like this:</p><pre>.claude/<br>├── rules/<br>│   ├── frontend.md<br>│   ├── backend.md<br>│   ├── generated-code.md<br>│   └── testing.md<br>│<br>└── skills/<br>    ├── add-api-feature/<br>    │   └── SKILL.md<br>    ├── generate-api-client/<br>    │   └── SKILL.md<br>    └── review-changes/<br>        └── SKILL.md</pre><p>This keeps rules easy to find and easier to update.</p><h3>Add Frontend Rules</h3><p>Your frontend has different concerns from your API.</p><p>For a Next.js app using TanStack Query, nuqs, Tailwind, and generated API hooks, a frontend rule file could look like this:</p><pre>---<br>paths:<br>  - &quot;apps/web/**/*.ts&quot;<br>  - &quot;apps/web/**/*.tsx&quot;<br>---</pre><pre># Frontend Rules</pre><pre>- Use generated hooks from `src/generated/api.ts` for API communication.<br>- Do not create custom fetch functions unless there is a clear reason.<br>- Use TanStack Query for server state and mutations.<br>- Invalidate the relevant query after a successful mutation.<br>- Use nuqs when UI state should persist in the URL.<br>- Keep feature-specific code inside `src/modules`.<br>- Do not edit generated files manually.<br>- Use Tailwind classes and existing component patterns.</pre><p>The paths field is useful because the rule should only matter when Claude is working on frontend files.</p><p>Now Claude does not need backend instructions while editing a React component.</p><p>That keeps the context more relevant.</p><h3>Add Backend Rules</h3><p>The API workspace has its own architecture and conventions.</p><p>A backend rules file might look like this:</p><pre>---<br>paths:<br>  - &quot;apps/api/**/*.ts&quot;<br>  - &quot;apps/api/**/*.prisma&quot;<br>---</pre><pre># Backend Rules</pre><pre>- Use NestJS modules, controllers, and services.<br>- Keep controllers focused on HTTP concerns.<br>- Put business logic and database access in services.<br>- Use Prisma through the existing Prisma service.<br>- Document public endpoints with Swagger decorators.<br>- Use DTOs for request and response shapes where appropriate.<br>- Do not expose Prisma models directly when a DTO is needed.<br>- Keep API changes compatible with Orval code generation.</pre><p>This gives Claude a clear direction when you ask it to add a feature.</p><p>For example:</p><blockquote><em>Add an endpoint that returns notes for a folder.</em></blockquote><p>Instead of inventing a new style, Claude now has a checklist:</p><ol><li>Find the existing NestJS module.</li><li>Add the route in a controller.</li><li>Add logic in a service.</li><li>Use Prisma in the API workspace.</li><li>Add Swagger metadata.</li><li>Regenerate the frontend API client.</li><li>Run Biome.</li></ol><p>That is a much more reliable workflow.</p><h3>Protect Generated Files</h3><p>Generated code is one of the easiest places for AI to make a mess.</p><p>In this stack, Swagger documents the NestJS API and Orval generates the frontend API client.</p><p>The generated client is written to:</p><pre>apps/web/src/generated/api.ts</pre><p>That means the rule should be explicit:</p><pre># Generated Code Rules</pre><pre>- Do not manually edit files inside `apps/web/src/generated`.<br>- Update NestJS controllers and Swagger DTOs first.<br>- Run `bun run generate` after API contract changes.<br>- Fix frontend TypeScript errors after regeneration.</pre><p>This protects the source of truth.</p><p>The backend defines the contract.</p><p>Orval generates the frontend client.</p><p>The frontend consumes the generated hooks.</p><p>That is much safer than asking AI to manually duplicate API types across applications.</p><h3>Turn Repeated Work into Skills</h3><p>Rules are useful for facts and constraints.</p><p>Skills are better for multi-step workflows.</p><p>For example, adding an API feature is not a one-line rule. It is a repeatable process.</p><p>You can create a project skill at:</p><pre>.claude/skills/add-api-feature/SKILL.md</pre><pre>---<br>description: Add a complete NestJS API feature and update the generated frontend client.<br>disable-model-invocation: true<br>---</pre><pre># Add API Feature</pre><pre>Use this skill when adding a new API feature.</pre><pre>1. Inspect existing modules in `apps/api/src`.<br>2. Follow the existing module, controller, service, and DTO structure.<br>3. Add Swagger decorators to public endpoints.<br>4. Keep Prisma access inside the service layer.<br>5. Run the API locally if needed.<br>6. Run `bun run generate` to update the frontend API client.<br>7. Check whether the frontend needs a new generated query or mutation hook.<br>8. Run `bun run lint:fix`.<br>9. Summarize changed files and any manual follow-up work.</pre><p>You can then invoke it directly:</p><pre>/add-api-feature</pre><p>And add your task:</p><pre>Create note tagging for the terminal notepad.</pre><p>The value is not that Claude suddenly becomes perfect.</p><p>The value is that Claude follows the same workflow every time.</p><h3>Create a Skill for API Generation</h3><p>Generated clients are another good candidate for a skill.</p><pre>.claude/skills/generate-api-client/SKILL.md</pre><pre>---<br>description: Regenerate the frontend API client from the NestJS Swagger document and verify the result.<br>disable-model-invocation: true<br>---</pre><pre># Generate API Client</pre><pre>1. Confirm the NestJS API is running on port 3001.<br>2. Confirm Swagger JSON is available at `/api-docs-json`.<br>3. Run `bun run generate`.<br>4. Do not manually modify generated files.<br>5. Review generated changes.<br>6. Run `bun run lint:fix`.<br>7. Report any changed endpoint types or hooks.</pre><p>Now the workflow is documented, reusable, and available to everyone working in the repository.</p><p>It also avoids the classic problem where one developer remembers to regenerate API types and another forgets.</p><h3>Use Skills for Workflows, Not Random Prompts</h3><p>A skill should solve a recurring problem.</p><p>Good skills usually fit one of these categories:</p><ul><li>build or deployment workflows</li><li>code generation</li><li>code review</li><li>test setup</li><li>release preparation</li><li>feature scaffolding</li><li>migration workflows</li><li>debugging checklists</li></ul><p>Examples for this stack:</p><pre>/add-api-feature<br>/generate-api-client<br>/review-changes<br>/prepare-release<br>/deploy-web<br>/deploy-api</pre><p>Do not create a skill for every tiny action.</p><p>A skill is useful when you repeatedly paste the same instructions or checklist into Claude.</p><h3>Pair AI Rules with Real Verification</h3><p>CLAUDE.md and skills help guide Claude.</p><p>They are not a replacement for actual checks.</p><p>A reliable AI-assisted workflow should still include automated verification.</p><p>For this project, that includes Biome and Lefthook.</p><p>The root command runs Biome across the workspace:</p><pre>bun run lint</pre><p>And the fix command applies formatting and lint fixes:</p><pre>bun run lint:fix</pre><p>The pre-commit hook also checks staged files automatically:</p><pre>pre-commit:<br>  commands:<br>    lint:<br>      run: &quot;bun run lint:fix {staged_files}&quot;<br>      stage_fixed: true</pre><p>This gives you several layers of protection:</p><pre>Claude rules        Guide how code should be written<br>Skills              Standardize repeatable workflows<br>Biome               Checks formatting and lint rules<br>Git hooks           Catch problems before commits<br>TypeScript          Finds type errors<br>Tests and CI        Validate behavior before release</pre><p>The goal is not to trust AI blindly.</p><p>The goal is to create a workflow where AI can move faster without bypassing your quality standards.</p><h3>A Better Prompting Pattern</h3><p>Even with good project rules, the way you ask matters.</p><p>Instead of this:</p><blockquote><em>Add note deletion.</em></blockquote><p>Use something more specific:</p><blockquote><em>Add note deletion using the existing NestJS module structure. Update Swagger documentation, regenerate the Orval client, use the generated mutation hook in the frontend, invalidate the affected query, and run Biome when finished.</em></blockquote><p>This tells Claude what success looks like.</p><p>Over time, many of those instructions can move into rules and skills. Then your prompts become shorter:</p><blockquote><em>Use </em><em>/add-api-feature to add note deletion.</em></blockquote><p>That is the ideal outcome.</p><p>Your workflow holds the context, not every individual chat message.</p><h3>Avoid These Common Mistakes</h3><h3>1. Writing vague rules</h3><p>Avoid:</p><pre>Use clean code.<br>Follow best practices.</pre><p>Prefer:</p><pre>Use `bun run lint:fix` after every change.<br>Do not manually edit `apps/web/src/generated`.<br>Use generated Orval hooks for API calls.</pre><h3>2. Putting everything in one file</h3><p>A massive CLAUDE.md becomes hard to maintain.</p><p>Keep global facts at the root. Move feature-specific rules into .claude/rules.</p><h3>3. Using rules for procedures</h3><p>A rule should be a rule.</p><p>A workflow with multiple steps should become a skill.</p><h3>4. Letting AI edit generated files</h3><p>Generated code should be regenerated, not manually patched.</p><h3>5. Skipping verification</h3><p>AI-generated code still needs linting, type checking, tests, and review.</p><h3>6. Adding contradictory instructions</h3><p>Rules should not fight each other.</p><p>Review your files occasionally and remove outdated guidance.</p><h3>A Simple Starting Checklist</h3><p>You do not need a huge AI configuration to get value from Claude Code.</p><p>Start here:</p><pre>[ ] Add a root CLAUDE.md with project structure and commands<br>[ ] Document architecture boundaries<br>[ ] Add rules for frontend and backend work<br>[ ] Protect generated code with an explicit rule<br>[ ] Create one useful skill for a repeated workflow<br>[ ] Run Biome after changes<br>[ ] Add pre-commit checks<br>[ ] Keep rules short, specific, and up to date</pre><p>That alone can make AI much more useful inside a real project.</p><h3>Build an AI Workflow, Not Just an AI Prompt</h3><p>The best use of AI is not asking it to write everything for you.</p><p>It is creating a codebase where AI understands:</p><ul><li>where code belongs</li><li>which tools to use</li><li>which commands to run</li><li>what not to edit</li><li>how frontend and backend stay in sync</li><li>how to verify the final result</li></ul><p>That is how AI becomes part of a reliable engineering workflow instead of a source of random code snippets.</p><p>In my course, <strong>Next JS Modern Stack — Tooling and AI</strong>, I show how to build this kind of workflow from scratch with Next.js, NestJS, Prisma, Neon, Swagger, Orval, TanStack Query, nuqs, Biome, and Claude Code.</p><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E">Enroll in the course</a></p><p>You can also explore the source code and project structure here:</p><p><a href="https://github.com/Jerga99/next-modern-stack">View the GitHub repository</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5df71163886c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/how-to-make-claude-code-follow-your-project-rules-5df71163886c">How to Make Claude Code Follow Your Project Rules</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Packages Behind My Modern Next.js and NestJS Stack]]></title>
            <link>https://medium.com/eincode/the-packages-behind-my-modern-next-js-and-nestjs-stack-a64e0fe6a792?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/a64e0fe6a792</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 14:38:31 GMT</pubDate>
            <atom:updated>2026-07-14T19:49:54.641Z</atom:updated>
            <content:encoded><![CDATA[<h4>A practical look at the tools and packages behind my full-stack TypeScript monorepo, from API generation and server state to code quality and developer workflow.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OHTcKApL8bkjYN86blFp1Q.png" /></figure><p>A modern full-stack project is not only about choosing a frontend framework and a backend framework.</p><p>The real difference comes from the smaller tools around them: how you manage the workspace, keep code clean, connect frontend and backend, handle server state, and avoid duplicating types.</p><p>In my terminal-inspired notepad project, I use Next.js and NestJS as the main frameworks, but the supporting packages are what make the workflow feel fast, structured, and scalable.</p><p>This article is a quick rundown of the most important packages in the stack, plus two additions I would strongly consider for larger TypeScript projects.</p><p>You can explore the complete source code here:</p><p><a href="https://github.com/Jerga99/next-modern-stack">View the GitHub repository</a></p><p>And if you want to build the whole project step by step, including the monorepo, API, database, generated hooks, and AI-assisted workflow:</p><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E">Check out my Next JS Modern Stack — Tooling and AI course</a></p><h3>Bun and Turborepo</h3><p>Bun manages dependencies and workspaces in this project, while Turborepo coordinates tasks across the frontend and backend.</p><p>The root project exposes a few commands that make the full stack easy to run:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;turbo run dev&quot;,<br>    &quot;dev:web&quot;: &quot;bun --filter web dev&quot;,<br>    &quot;dev:api&quot;: &quot;bun --filter api start:dev&quot;,<br>    &quot;lint&quot;: &quot;biome check .&quot;,<br>    &quot;lint:fix&quot;: &quot;biome check --unsafe --fix .&quot;,<br>    &quot;generate&quot;: &quot;turbo run generate&quot;<br>  }<br>}</pre><p>This gives you a simple workflow:</p><pre># Run Next.js and NestJS together<br>bun run dev</pre><pre># Run only the frontend<br>bun run dev:web</pre><pre># Run only the API<br>bun run dev:api</pre><pre># Generate the API client<br>bun run generate</pre><p>Turborepo does not replace the scripts inside each application. It gives the monorepo one consistent way to run them.</p><p>That becomes useful as the project grows and starts to include builds, tests, code generation, and CI workflows.</p><h3>Biome and Lefthook</h3><p>Biome is the code-quality tool in this stack.</p><p>It replaces the usual ESLint and Prettier combination with one fast tool for linting and formatting.</p><pre>bun run lint</pre><p>To automatically apply safe fixes:</p><pre>bun run lint:fix</pre><p>The project also uses Lefthook to run checks before commits:</p><pre>pre-commit:<br>  commands:<br>    lint:<br>      run: &quot;bun run lint:fix {staged_files}&quot;<br>      stage_fixed: true</pre><p>This is a small detail, but it makes a real difference.</p><p>Instead of hoping that formatting is correct before every commit, the workflow checks staged files automatically. This is especially useful when code is written quickly or generated with AI assistance.</p><h3>Next.js and React</h3><p>The frontend is built with Next.js and React.</p><p>Next.js handles routing, rendering, and the application structure. React handles interactive UI components.</p><p>The project uses a feature-oriented structure inside src/modules, which keeps related UI and logic together instead of placing everything in one large components folder.</p><p>For example, the terminal UI lives in its own module:</p><pre>src/<br>├── app/<br>└── modules/<br>    ├── shared/<br>    └── terminal/</pre><p>The goal is to keep the app easy to navigate as it gets more features.</p><p>Next.js gives the project a strong frontend foundation, but it becomes much more useful when combined with good data fetching and URL state tools.</p><h3>NestJS</h3><p>NestJS is the backend framework.</p><p>It gives the API a clean module-based structure, decorators for defining routes, dependency injection, and a good integration with Swagger.</p><p>A small NestJS controller can look like this:</p><pre>import { Controller, Get } from &quot;@nestjs/common&quot;;<br>import { ApiOperation, ApiResponse } from &quot;@nestjs/swagger&quot;;<br>import { FolderDto } from &quot;./folder.dto&quot;;<br>import { FoldersService } from &quot;./folders.service&quot;;</pre><pre>@Controller(&quot;folders&quot;)<br>export class FoldersController {<br>  constructor(private readonly foldersService: FoldersService) {}</pre><pre>  @Get()<br>  @ApiOperation({<br>    summary: &quot;Get all folders&quot;,<br>    operationId: &quot;getFolders&quot;,<br>  })<br>  @ApiResponse({<br>    status: 200,<br>    description: &quot;List of folders&quot;,<br>    type: [FolderDto],<br>  })<br>  async findAll() {<br>    return this.foldersService.findAll();<br>  }<br>}</pre><p>The controller stays focused on HTTP concerns.</p><p>The actual database work belongs in the service layer.</p><p>That separation makes backend code easier to test, extend, and reason about.</p><h3>Prisma</h3><p>Prisma is the database toolkit used by the NestJS API.</p><p>The project uses PostgreSQL, and Prisma defines the database models for folders and notes.</p><pre>model Folder {<br>  id        Int      @id @default(autoincrement())<br>  name      String<br>  parentId  Int?<br>  parent    Folder?  @relation(&quot;FolderToFolder&quot;, fields: [parentId], references: [id])<br>  children  Folder[] @relation(&quot;FolderToFolder&quot;)<br>  notes     Note[]<br>  createdAt DateTime @default(now())<br>}</pre><pre>model Note {<br>  id        Int      @id @default(autoincrement())<br>  text      String<br>  folderId  Int<br>  folder    Folder   @relation(fields: [folderId], references: [id])<br>  createdAt DateTime @default(now())<br>}</pre><p>Then, inside a NestJS service, creating a note is simple and fully typed:</p><pre>create(text: string, folderId: number) {<br>  return this.prisma.note.create({<br>    data: {<br>      text,<br>      folderId,<br>    },<br>  });<br>}</pre><p>Prisma keeps database code readable and gives you strong TypeScript types without manually writing SQL for every query.</p><p>In the course, I use Prisma with PostgreSQL through Neon, including migrations, schema design, and connecting the database to NestJS.</p><h3>Swagger</h3><p>Swagger is where the backend becomes the source of truth for the API contract.</p><p>NestJS can generate Swagger documentation directly from your controllers and DTOs.</p><pre>import { DocumentBuilder, SwaggerModule } from &quot;@nestjs/swagger&quot;;</pre><pre>const config = new DocumentBuilder()<br>  .setTitle(&quot;Next Modern Stack API&quot;)<br>  .setDescription(&quot;API documentation for Next Modern Stack&quot;)<br>  .setVersion(&quot;1.0&quot;)<br>  .build();</pre><pre>const document = SwaggerModule.createDocument(app, config);</pre><pre>SwaggerModule.setup(&quot;api-docs&quot;, app, document);</pre><p>This creates interactive API documentation at:</p><pre>http://localhost:3001/api-docs</pre><p>More importantly, it also gives the frontend a machine-readable API document.</p><p>That is where Orval comes in.</p><h3>Orval</h3><p>Orval generates TypeScript API types, request functions, and TanStack Query hooks from the Swagger document.</p><p>The frontend configuration is small:</p><pre>import { defineConfig } from &quot;orval&quot;;</pre><pre>export default defineConfig({<br>  api: {<br>    input: &quot;http://localhost:3001/api-docs-json&quot;,<br>    output: {<br>      target: &quot;./src/generated/api.ts&quot;,<br>      client: &quot;react-query&quot;,<br>      httpClient: &quot;fetch&quot;,<br>      baseUrl: &quot;http://localhost:3001&quot;,<br>    },<br>  },<br>});</pre><p>Then run:</p><pre>bun run generate</pre><p>Now the frontend receives generated code based on the actual API contract.</p><p>This is much better than manually copying request types between the frontend and backend.</p><p>When the backend changes, you regenerate the client. The TypeScript compiler can then show you where the frontend needs to be updated.</p><p>That is one of my favorite parts of the stack because it reduces repetitive work and prevents frontend-backend mismatches.</p><h3>TanStack Query</h3><p>TanStack Query manages server state in the frontend.</p><p>It handles fetching, caching, mutations, loading states, refetching, and cache invalidation.</p><p>Because Orval generates React Query hooks, the frontend can use the API with very little boilerplate:</p><pre>import { useQueryClient } from &quot;@tanstack/react-query&quot;;<br>import {<br>  getGetFoldersQueryKey,<br>  useCreateNote,<br>  useGetFolders,<br>} from &quot;@/generated/api&quot;;</pre><pre>const queryClient = useQueryClient();</pre><pre>const { data: foldersData } = useGetFolders();<br>const { mutateAsync: createNote } = useCreateNote();</pre><pre>async function handleCreateNote(text: string, folderId: number) {<br>  await createNote({<br>    data: {<br>      text,<br>      folderId,<br>    },<br>  });</pre><pre>  await queryClient.invalidateQueries({<br>    queryKey: getGetFoldersQueryKey(),<br>  });<br>}</pre><p>The flow is clear:</p><ol><li>Fetch folders with a generated query hook.</li><li>Create a note with a generated mutation hook.</li><li>Invalidate the folder query.</li><li>TanStack Query fetches fresh data.</li></ol><p>You do not have to manually manage cache state or write a custom fetching layer for every endpoint.</p><h3>nuqs</h3><p>nuqs is a small but powerful package for synchronizing React state with URL search parameters.</p><p>In the terminal app, the selected folder path is stored in the URL:</p><pre>import { useQueryState } from &quot;nuqs&quot;;</pre><pre>const [path, setPath] = useQueryState(&quot;folder&quot;, {<br>  defaultValue: &quot;&quot;,<br>});</pre><p>A folder path can then be saved like this:</p><pre>setPath([1, 4, 12].join(&quot;,&quot;));</pre><p>The URL becomes shareable:</p><pre>/?folder=1,4,12</pre><p>This is useful for more than folder navigation.</p><p>You can use the same pattern for:</p><ul><li>search queries</li><li>filters</li><li>pagination</li><li>sorting</li><li>selected tabs</li><li>modal state</li><li>dashboards</li></ul><p>Keeping this type of UI state in the URL makes an application easier to share, refresh, debug, and navigate.</p><h3>Tailwind CSS and classnames</h3><p>Tailwind CSS keeps styling close to the component.</p><p>Instead of maintaining large CSS files for every UI variation, you compose utility classes directly where the component is rendered.</p><p>The project also includes classnames for conditional class handling:</p><pre>import classNames from &quot;classnames&quot;;</pre><pre>type Props = {<br>  isSelected: boolean;<br>};</pre><pre>export function TerminalItem({ isSelected }: Props) {<br>  return (<br>    &lt;button<br>      className={classNames(<br>        &quot;rounded px-2 py-1 font-mono text-sm&quot;,<br>        isSelected<br>          ? &quot;bg-green-500 text-black&quot;<br>          : &quot;text-green-500 hover:bg-gray-800&quot;,<br>      )}<br>    &gt;<br>      documents<br>    &lt;/button&gt;<br>  );<br>}</pre><p>This is not a complicated package, but it keeps conditional styles readable when components become more interactive.</p><h3>Two Packages I Would Add: Zod and ts-pattern</h3><p>The packages above are part of the current project.</p><p>These next two are not currently included in the repository, but I would recommend them for many larger TypeScript applications.</p><h3>Zod for Runtime Validation</h3><p>TypeScript validates code while you develop.</p><p>It does not validate data at runtime.</p><p>That matters when data comes from places you do not fully control:</p><ul><li>forms</li><li>URL parameters</li><li>environment variables</li><li>webhooks</li><li>third-party APIs</li><li>local storage</li><li>user-generated content</li></ul><p>Zod lets you define a schema once and validate unknown data safely.</p><pre>import { z } from &quot;zod&quot;;</pre><pre>const createNoteSchema = z.object({<br>  text: z.string().trim().min(1).max(10_000),<br>  folderId: z.coerce.number().int().positive(),<br>});</pre><pre>const result = createNoteSchema.safeParse({<br>  text: &quot;My new note&quot;,<br>  folderId: &quot;5&quot;,<br>});</pre><pre>if (!result.success) {<br>  console.error(result.error.flatten());<br>} else {<br>  console.log(result.data);<br>  // { text: &quot;My new note&quot;, folderId: 5 }<br>}</pre><p>Zod is especially useful on the frontend before submitting a form, or at any external boundary where TypeScript types alone are not enough.</p><h3>ts-pattern for Safer Conditional Logic</h3><p>ts-pattern is useful when a large switch statement starts to become hard to read.</p><p>It gives you pattern matching with strong TypeScript inference and exhaustive checks.</p><pre>import { match } from &quot;ts-pattern&quot;;</pre><pre>type SaveState = &quot;idle&quot; | &quot;saving&quot; | &quot;success&quot; | &quot;error&quot;;</pre><pre>function getStatusText(state: SaveState) {<br>  return match(state)<br>    .with(&quot;idle&quot;, () =&gt; &quot;Ready to save&quot;)<br>    .with(&quot;saving&quot;, () =&gt; &quot;Saving...&quot;)<br>    .with(&quot;success&quot;, () =&gt; &quot;Saved&quot;)<br>    .with(&quot;error&quot;, () =&gt; &quot;Could not save&quot;)<br>    .exhaustive();<br>}</pre><p>The useful part is .exhaustive().</p><p>If you later add another state, TypeScript forces you to handle it.</p><p>This works well for:</p><ul><li>request states</li><li>modal states</li><li>notification types</li><li>event handlers</li><li>complex API responses</li><li>discriminated unions</li></ul><p>It is not required for every project, but it can make complicated UI logic much easier to understand.</p><h3>The Stack Is About Workflow, Not Dependency Count</h3><p>None of these packages are useful just because they are popular.</p><p>They work well together because each one has a clear responsibility:</p><ul><li>Bun manages the workspace and scripts.</li><li>Turborepo coordinates work across apps.</li><li>Biome and Lefthook protect code quality.</li><li>Next.js and React power the frontend.</li><li>NestJS structures the backend.</li><li>Prisma manages database access.</li><li>Swagger documents the API.</li><li>Orval generates the frontend client.</li><li>TanStack Query manages server state.</li><li>nuqs keeps UI state in the URL.</li><li>Tailwind and classnames make UI styling practical.</li><li>Zod and ts-pattern are strong additions when runtime validation and complex state logic become important.</li></ul><p>The goal is not to install every package.</p><p>The goal is to build a workflow where the frontend, backend, database, tooling, and AI assistance all work together cleanly.</p><p>To see the full project structure and source code:</p><p><a href="https://github.com/Jerga99/next-modern-stack">View the GitHub repository</a></p><p>To build the complete stack step by step, including the monorepo, NestJS API, Prisma, Neon, Swagger, Orval, TanStack Query, nuqs, Biome, and Claude workflow:</p><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E">Enroll in Next JS Modern Stack — Tooling and AI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a64e0fe6a792" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/the-packages-behind-my-modern-next-js-and-nestjs-stack-a64e0fe6a792">The Packages Behind My Modern Next.js and NestJS Stack</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Writing API Types Twice: NestJS Swagger + Orval + Next.js]]></title>
            <link>https://medium.com/eincode/stop-writing-api-types-twice-nestjs-swagger-orval-next-js-10cf367fd481?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/10cf367fd481</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Thu, 25 Jun 2026 14:35:26 GMT</pubDate>
            <atom:updated>2026-06-25T14:51:38.757Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to keep your NestJS API and Next.js frontend in sync with Swagger, Orval, and generated TanStack Query hooks.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSRP5QnbbGfM5TOT1DWDIg.png" /></figure><p>Building a full-stack TypeScript app often starts with duplicate work.</p><p>You create a request type in your NestJS backend. Then you create the same type again in your Next.js frontend. You write a controller endpoint, then manually write a fetch function. You change an API response, then hope you remember every frontend file affected by that change.</p><p>It works at first.</p><p>But as the API grows, duplicated types and hand-written request functions become a source of bugs and wasted time.</p><p>A better approach is to make the backend API contract the source of truth.</p><p>In this article, I will show a practical workflow using:</p><ul><li>NestJS</li><li>Swagger</li><li>Orval</li><li>Next.js</li><li>TanStack Query</li></ul><p>The idea is simple:</p><pre>NestJS endpoints + Swagger DTOs<br>→ OpenAPI document<br>→ Orval generation<br>→ TypeScript types, request functions, and React Query hooks<br>→ Next.js frontend</pre><p>Instead of manually keeping frontend and backend types aligned, you regenerate the client from the API contract.</p><p>You can explore the full project here:</p><p><a href="https://github.com/Jerga99/next-modern-stack">View the GitHub repository</a></p><p>And if you want to build this workflow step by step, including the monorepo, Prisma, Neon, TanStack Query, nuqs, Biome, and Claude AI workflow:</p><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E">Check out my Next JS Modern Stack — Tooling and AI course</a></p><h3>The Problem: API Types Drift Apart</h3><p>Imagine you are adding note creation to a terminal-inspired notepad app.</p><p>A typical manual frontend implementation might look like this:</p><pre>type CreateNoteInput = {<br>  text: string;<br>  folderId: number;<br>};</pre><pre>type Note = {<br>  id: number;<br>  text: string;<br>  folderId: number;<br>  createdAt: string;<br>};</pre><pre>export async function createNote(input: CreateNoteInput): Promise&lt;Note&gt; {<br>  const response = await fetch(&quot;http://localhost:3001/notes&quot;, {<br>    method: &quot;POST&quot;,<br>    headers: {<br>      &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    },<br>    body: JSON.stringify(input),<br>  });</pre><pre>  if (!response.ok) {<br>    throw new Error(&quot;Could not create note&quot;);<br>  }</pre><pre>  return response.json();<br>}</pre><p>There is nothing wrong with this code by itself.</p><p>The problem is that you now have several things to maintain manually:</p><ul><li>the request type</li><li>the response type</li><li>the endpoint URL</li><li>the HTTP method</li><li>request error handling</li><li>loading state</li><li>mutation state</li><li>caching and refetching logic</li></ul><p>Then the backend changes.</p><p>Maybe folderId is renamed. Maybe the response gets another property. Maybe the route changes. Maybe the API starts returning a different shape.</p><p>Your frontend type can silently become outdated.</p><p>The solution is to stop treating the frontend and backend as two separate sources of truth.</p><h3>Make Swagger the API Contract</h3><p>Swagger lets your NestJS API describe its endpoints, request bodies, and response models.</p><p>NestJS can then generate an OpenAPI document from that metadata.</p><p>Here is a DTO for creating a note:</p><pre>import { ApiProperty, ApiSchema } from &quot;@nestjs/swagger&quot;;</pre><pre>@ApiSchema({ name: &quot;CreateNote&quot; })<br>export class CreateNoteDto {<br>  @ApiProperty({<br>    description: &quot;The text content of the note&quot;,<br>  })<br>  text: string;</pre><pre>  @ApiProperty({<br>    description: &quot;The ID of the folder this note belongs to&quot;,<br>  })<br>  folderId: number;<br>}</pre><p>This tells Swagger what the request body should look like.</p><p>Next, document the endpoint itself:</p><pre>import { Body, Controller, Post } from &quot;@nestjs/common&quot;;<br>import { ApiOperation, ApiResponse } from &quot;@nestjs/swagger&quot;;<br>import { CreateNoteDto } from &quot;./create-note.dto&quot;;<br>import { NoteDto } from &quot;./note.dto&quot;;<br>import { NotesService } from &quot;./notes.service&quot;;</pre><pre>@Controller(&quot;notes&quot;)<br>export class NotesController {<br>  constructor(private readonly notesService: NotesService) {}</pre><pre>  @Post()<br>  @ApiOperation({<br>    summary: &quot;Create a note&quot;,<br>    operationId: &quot;createNote&quot;,<br>  })<br>  @ApiResponse({<br>    status: 201,<br>    description: &quot;The note has been successfully created.&quot;,<br>    type: NoteDto,<br>  })<br>  create(@Body() createNoteDto: CreateNoteDto) {<br>    return this.notesService.create(<br>      createNoteDto.text,<br>      createNoteDto.folderId,<br>    );<br>  }<br>}</pre><p>There are two especially useful things here:</p><ul><li>CreateNoteDto describes the request body.</li><li>NoteDto describes the successful response.</li></ul><p>The operationId is also important.</p><pre>operationId: &quot;createNote&quot;;</pre><p>It gives this endpoint a stable, readable name in the generated client.</p><p>That is why the frontend can later use a hook named:</p><pre>useCreateNote();</pre><p>Instead of something vague or auto-generated from the route path.</p><h3>Publish Swagger Documentation from NestJS</h3><p>Once controllers and DTOs are documented, configure Swagger when the NestJS app starts.</p><pre>import { NestFactory } from &quot;@nestjs/core&quot;;<br>import { DocumentBuilder, SwaggerModule } from &quot;@nestjs/swagger&quot;;<br>import { AppModule } from &quot;./app.module&quot;;</pre><pre>async function bootstrap() {<br>  const app = await NestFactory.create(AppModule);</pre><pre>  app.enableCors({<br>    origin: &quot;http://localhost:3000&quot;,<br>  });</pre><pre>  const config = new DocumentBuilder()<br>    .setTitle(&quot;Next Modern Stack API&quot;)<br>    .setDescription(&quot;API documentation for Next Modern Stack&quot;)<br>    .setVersion(&quot;1.0&quot;)<br>    .build();</pre><pre>  const document = SwaggerModule.createDocument(app, config);</pre><pre>  SwaggerModule.setup(&quot;api-docs&quot;, app, document);</pre><pre>  await app.listen(process.env.PORT ?? 3001);<br>}</pre><pre>bootstrap();</pre><p>With the API running locally, Swagger gives you two useful URLs:</p><pre>http://localhost:3001/api-docs<br>http://localhost:3001/api-docs-json</pre><p>The first is the interactive Swagger UI.</p><p>The second is the machine-readable OpenAPI document that Orval will use to generate your frontend client.</p><h3>Generate the Next.js API Client with Orval</h3><p>Orval reads your OpenAPI document and generates TypeScript code for your frontend.</p><p>In this project, the configuration lives in the Next.js app:</p><pre>import { defineConfig } from &quot;orval&quot;;</pre><pre>export default defineConfig({<br>  api: {<br>    input: &quot;http://localhost:3001/api-docs-json&quot;,<br>    output: {<br>      target: &quot;./src/generated/api.ts&quot;,<br>      client: &quot;react-query&quot;,<br>      httpClient: &quot;fetch&quot;,<br>      baseUrl: &quot;http://localhost:3001&quot;,<br>    },<br>  },<br>});</pre><p>This configuration says:</p><ul><li>Read the Swagger JSON from the NestJS API.</li><li>Generate the client into src/generated/api.ts.</li><li>Generate TanStack Query hooks.</li><li>Use the browser fetch API.</li><li>Send requests to the local NestJS server.</li></ul><p>The Next.js app exposes a generation script:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;generate&quot;: &quot;orval --config orval.config.ts&quot;<br>  }<br>}</pre><p>At the root of the monorepo, Turborepo runs generation tasks across workspaces:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;generate&quot;: &quot;turbo run generate&quot;<br>  }<br>}</pre><p>Now you can generate the client from the repository root:</p><pre>bun run generate</pre><p>Your NestJS API must be running first because Orval reads the OpenAPI document from:</p><pre>http://localhost:3001/api-docs-json</pre><h3>What Orval Generates</h3><p>After running the generator, the frontend gets a file like this:</p><pre>apps/web/src/generated/api.ts</pre><p>You should not edit this file manually.</p><p>It is generated output.</p><p>Instead, update your backend DTOs and Swagger decorators, then regenerate the client.</p><p>From the API contract, Orval can generate:</p><ul><li>TypeScript request and response types</li><li>typed request functions</li><li>TanStack Query query hooks</li><li>TanStack Query mutation hooks</li><li>query-key helpers for cache invalidation</li></ul><p>For example, the folder endpoint uses this operation ID:</p><pre>@ApiOperation({<br>  summary: &quot;Get all folders&quot;,<br>  operationId: &quot;getFolders&quot;,<br>})</pre><p>That becomes a generated frontend hook:</p><pre>useGetFolders();</pre><p>And its query-key helper:</p><pre>getGetFoldersQueryKey();</pre><p>The naming is predictable because the backend explicitly defines the operation IDs.</p><h3>Use Generated Hooks in Next.js</h3><p>Once Orval has generated the client, your frontend does not need custom fetch functions for every endpoint.</p><p>Here is the main pattern from the terminal notepad feature:</p><pre>import { useQueryClient } from &quot;@tanstack/react-query&quot;;<br>import {<br>  getGetFoldersQueryKey,<br>  useCreateNote,<br>  useGetFolders,<br>} from &quot;@/generated/api&quot;;</pre><pre>export function TerminalContent() {<br>  const queryClient = useQueryClient();</pre><pre>  const { data: foldersData } = useGetFolders();</pre><pre>  const { mutateAsync: createNote } = useCreateNote();</pre><pre>  async function handleCreateNote(text: string, folderId: number) {<br>    await createNote({<br>      data: {<br>        text,<br>        folderId,<br>      },<br>    });</pre><pre>    await queryClient.invalidateQueries({<br>      queryKey: getGetFoldersQueryKey(),<br>    });<br>  }</pre><pre>  return null;<br>}</pre><p>The workflow is straightforward:</p><ol><li>useGetFolders() fetches the folder data.</li><li>useCreateNote() creates a note.</li><li>The mutation succeeds.</li><li>getGetFoldersQueryKey() identifies the affected cached query.</li><li>TanStack Query refetches the folder data.</li></ol><p>The UI receives fresh server data without manually updating nested React state.</p><p>That is a major advantage of combining generated hooks with TanStack Query.</p><h3>Use Initial Data When the Server Already Has It</h3><p>In a Next.js app, you may already have data available before the client component starts.</p><p>For example, the terminal component can receive folders as props and use them as initial query data:</p><pre>const { data: foldersData } = useGetFolders({<br>  query: {<br>    initialData: {<br>      data: initialFolders,<br>      status: 200,<br>      headers: new Headers(),<br>    },<br>  },<br>});</pre><p>This lets the UI render immediately with the data it already has, while TanStack Query still manages caching and future updates.</p><p>You get the benefits of generated server-state tooling without throwing away the data Next.js has already loaded.</p><h3>The Workflow When Your API Changes</h3><p>This is the workflow I recommend whenever you add or change an endpoint:</p><pre>1. Update the NestJS controller or service<br>2. Update Swagger DTOs and endpoint metadata<br>3. Start the API locally<br>4. Run bun run generate<br>5. Review the generated API client changes<br>6. Update frontend usage where needed<br>7. Run bun run lint:fix<br>8. Let TypeScript show you any remaining mismatches</pre><p>For example, imagine you change the create-note request from:</p><pre>{<br>  text: string;<br>  folderId: number;<br>}</pre><p>to:</p><pre>{<br>  text: string;<br>  folderId: number;<br>  isPinned: boolean;<br>}</pre><p>You update the backend DTO:</p><pre>@ApiSchema({ name: &quot;CreateNote&quot; })<br>export class CreateNoteDto {<br>  @ApiProperty()<br>  text: string;</pre><pre>  @ApiProperty()<br>  folderId: number;</pre><pre>  @ApiProperty()<br>  isPinned: boolean;<br>}</pre><p>Then regenerate:</p><pre>bun run generate</pre><p>Now your frontend call to createNote() will require isPinned.</p><p>TypeScript will immediately show you every place that needs to be updated.</p><p>That is much safer than hoping you remember to update a hand-written type in another application.</p><h3>Why This Is Better Than a Shared Types Package</h3><p>A common approach in a monorepo is creating a package like this:</p><pre>packages/<br>└── types/</pre><p>Then both frontend and backend import the same TypeScript interfaces.</p><p>That can work in some cases.</p><p>But it does not solve the whole API problem.</p><p>A shared interface does not automatically give you:</p><ul><li>documented endpoints</li><li>typed request functions</li><li>typed mutation hooks</li><li>cache keys</li><li>endpoint URLs</li><li>HTTP methods</li><li>API documentation</li><li>a contract that other clients can use</li></ul><p>Swagger and Orval give you an API-first workflow.</p><p>The backend owns the contract.</p><p>The frontend consumes generated code from that contract.</p><p>This creates a clearer boundary between applications.</p><h3>Common Mistakes to Avoid</h3><h3>Manually editing generated files</h3><p>Do not patch this file directly:</p><pre>apps/web/src/generated/api.ts</pre><p>Your edits will disappear the next time you generate the client.</p><p>Fix the backend contract instead, then regenerate.</p><h3>Skipping operationId</h3><p>Routes can generate awkward names when you do not define operation IDs.</p><p>Use readable IDs such as:</p><pre>operationId: &quot;getFolders&quot;;<br>operationId: &quot;createNote&quot;;<br>operationId: &quot;updateNote&quot;;</pre><p>This gives you better generated hook names in the frontend.</p><h3>Forgetting to regenerate after backend changes</h3><p>The frontend cannot know about API changes until you run generation again.</p><p>Make it part of your normal development flow.</p><h3>Writing custom fetch functions beside generated hooks</h3><p>Use generated hooks by default.</p><p>Write a custom fetch function only when you have a specific reason that the generated client cannot handle.</p><p>Otherwise, you are bringing duplicated API logic back into the project.</p><h3>Treating generated types as runtime validation</h3><p>Generated TypeScript types help while you write code.</p><p>They do not validate unknown user input at runtime.</p><p>For form validation, URL input, webhooks, or third-party data, consider adding runtime validation with a tool such as Zod.</p><h3>One API Contract, Less Repetitive Work</h3><p>The real value of Swagger and Orval is not just type safety.</p><p>It is reducing the number of decisions you need to repeat.</p><p>Instead of rebuilding the same API layer on the frontend for every endpoint, you define the contract once and generate the predictable parts.</p><pre>NestJS endpoint<br>→ Swagger contract<br>→ Orval generated client<br>→ TanStack Query hook<br>→ Next.js UI</pre><p>That gives you:</p><ul><li>fewer duplicate types</li><li>fewer hand-written request functions</li><li>clearer frontend-backend boundaries</li><li>stronger TypeScript feedback when the API changes</li><li>built-in query and mutation hooks</li><li>cleaner cache invalidation</li><li>API documentation your team can inspect</li></ul><p>It also makes AI-assisted development safer.</p><p>When Claude adds a backend endpoint, you can guide it through a clear workflow:</p><pre>Update the NestJS controller and DTOs<br>→ document the endpoint with Swagger<br>→ run bun run generate<br>→ use the generated hook in Next.js<br>→ run Biome</pre><p>That is much more reliable than asking AI to create and maintain separate API code in several places.</p><h3>Build the Full Workflow</h3><p>This Swagger and Orval flow is one part of my wider modern TypeScript stack.</p><p>In my course, <strong>Next JS Modern Stack — Tooling and AI</strong>, I build a full-stack terminal-inspired notepad application with:</p><ul><li>Next.js and NestJS</li><li>Bun workspaces and Turborepo</li><li>PostgreSQL, Neon, and Prisma</li><li>Swagger and Orval</li><li>TanStack Query and nuqs</li><li>Biome and Lefthook</li><li>Claude rules and reusable AI skills</li></ul><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E">Enroll in the course</a></p><p>You can also inspect the complete source code here:</p><p><a href="https://github.com/Jerga99/next-modern-stack">View the GitHub repository</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10cf367fd481" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/stop-writing-api-types-twice-nestjs-swagger-orval-next-js-10cf367fd481">Stop Writing API Types Twice: NestJS Swagger + Orval + Next.js</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Structure a Modern Next.js and NestJS Monorepo]]></title>
            <link>https://medium.com/eincode/how-to-structure-a-modern-next-js-and-nestjs-monorepo-d7f8961e3a69?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7f8961e3a69</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 08:43:36 GMT</pubDate>
            <atom:updated>2026-06-24T08:44:38.794Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to Build a Modern Next.js and NestJS Monorepo with Bun and Turbo. Most full-stack projects start simple.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bo8UXXxPOLuUSfSW0qrj3w.png" /></figure><p>You create a Next.js frontend. Then you add an API. Then a database. Then code generation, linting, formatting, deployment scripts, environment variables, and AI tools.</p><p>At some point, the challenge is no longer writing a feature.</p><p>The challenge is keeping the project clean while it grows.</p><p>That is why I like using a monorepo for full-stack TypeScript applications.</p><p>In this article, I will walk through the foundation of a modern stack built with:</p><ul><li>Next.js for the frontend</li><li>NestJS for the backend</li><li>Bun for package management and workspaces</li><li>Turborepo for running tasks across the repository</li><li>Biome for formatting and linting</li><li>Lefthook for pre-commit checks</li></ul><p>The application in this stack is intentionally small: a terminal-inspired notepad. The real goal is building a project setup that is easy to extend, easy to understand, and friendly to both developers and AI tools.</p><blockquote><em>Want the complete, step-by-step version?<br>My course, </em><strong><em>Next JS Modern Stack — Tooling and AI</em></strong><em>, builds this project from scratch and covers Prisma, Neon, Swagger, Orval, TanStack Query, nuqs, and AI-assisted development with Claude.</em></blockquote><blockquote><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E"><em>Watch the course on Udemy</em></a></blockquote><p>You can also explore the companion code here:</p><p><a href="https://github.com/Jerga99/next-modern-stack"><strong>View the GitHub repository</strong></a></p><h3>Why Use a Monorepo?</h3><p>A monorepo is simply one repository that contains multiple related applications.</p><p>For a full-stack project, that usually means putting the frontend and backend in the same workspace:</p><pre>next-modern-stack/<br>├── apps/<br>│   ├── api/<br>│   └── web/<br>├── biome.json<br>├── lefthook.yaml<br>├── package.json<br>├── turbo.json<br>└── bun.lock</pre><p>This does not mean the frontend and backend become one application.</p><p>They remain separate applications with their own dependencies and scripts. The monorepo gives them a shared home, consistent tooling, and a predictable way to run common tasks.</p><p>This approach is especially useful when the frontend and backend are built together.</p><p>You get:</p><ul><li>one repository to clone and manage</li><li>one place for shared project conventions</li><li>one command to start the development environment</li><li>one formatting and linting workflow</li><li>a cleaner path for generated API clients</li><li>a better structure for AI instructions and automation</li></ul><p>The important part is not creating a huge folder structure on day one.</p><p>It is creating a clear boundary between applications.</p><h3>Keep the Structure Small at First</h3><p>A common mistake is creating a long list of shared packages before there is anything to share.</p><p>You do not need this immediately:</p><pre>packages/<br>├── ui/<br>├── types/<br>├── utils/<br>├── constants/<br>├── hooks/<br>├── config/<br>└── shared-everything/</pre><p>For this project, the starting point is deliberately simple:</p><pre>apps/<br>├── api/<br>└── web/</pre><p>The api workspace owns backend code, database access, API endpoints, and Swagger documentation.</p><p>The web workspace owns the Next.js interface, UI state, server-state queries, and generated API hooks.</p><p>That is enough to start.</p><p>Later, when you have genuinely reusable code with a clear owner, you can introduce shared packages. But a monorepo does not require them from day one.</p><h3>Create the Root Workspace</h3><p>The root package.json defines the workspace and provides commands for working with the whole project.</p><p>Here is the root setup:</p><pre>{<br>  &quot;name&quot;: &quot;next-modern-stack&quot;,<br>  &quot;module&quot;: &quot;index.ts&quot;,<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;private&quot;: true,<br>  &quot;packageManager&quot;: &quot;bun@1.2.22&quot;,<br>  &quot;workspaces&quot;: [&quot;apps/*&quot;],<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;turbo run dev&quot;,<br>    &quot;dev:web&quot;: &quot;bun --filter web dev&quot;,<br>    &quot;dev:api&quot;: &quot;bun --filter api start:dev&quot;,<br>    &quot;lint&quot;: &quot;biome check .&quot;,<br>    &quot;lint:fix&quot;: &quot;biome check --unsafe --fix .&quot;,<br>    &quot;format&quot;: &quot;biome format --write .&quot;,<br>    &quot;generate&quot;: &quot;turbo run generate&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;@biomejs/biome&quot;: &quot;^2.5.0&quot;,<br>    &quot;@types/bun&quot;: &quot;latest&quot;,<br>    &quot;lefthook&quot;: &quot;^2.1.9&quot;,<br>    &quot;turbo&quot;: &quot;^2.9.18&quot;<br>  },<br>  &quot;peerDependencies&quot;: {<br>    &quot;typescript&quot;: &quot;^5&quot;<br>  }<br>}</pre><p>There are a few decisions here worth understanding.</p><h3>Make the root package private</h3><pre>{<br>  &quot;private&quot;: true<br>}</pre><p>The root project is not something you want to publish to npm. It exists to manage your applications and tooling.</p><p>Setting private to true prevents accidental publishing.</p><h3>Define workspaces</h3><pre>{<br>  &quot;workspaces&quot;: [&quot;apps/*&quot;]<br>}</pre><p>This tells Bun that every application inside apps is part of the same workspace.</p><p>In this case, Bun discovers:</p><pre>apps/api/package.json<br>apps/web/package.json</pre><p>Each application can keep its own dependencies and scripts, while the root manages the development workflow.</p><h3>Keep root commands predictable</h3><p>The root scripts are the commands developers should reach for first.</p><p>Start everything:</p><pre>bun run dev</pre><p>Run only the Next.js app:</p><pre>bun run dev:web</pre><p>Run only the NestJS API:</p><pre>bun run dev:api</pre><p>Run code-quality checks across the whole repository:</p><pre>bun run lint</pre><p>Apply formatting and automatic fixes:</p><pre>bun run lint:fix</pre><p>Generate code across workspaces:</p><pre>bun run generate</pre><p>This matters more than it might seem.</p><p>A project becomes easier to work in when developers do not need to remember a different workflow for every folder.</p><h3>Separate the Frontend and Backend Clearly</h3><p>Inside apps, each application has a focused responsibility.</p><pre>apps/<br>├── api/<br>│   ├── prisma/<br>│   ├── src/<br>│   ├── package.json<br>│   └── prisma.config.ts<br>│<br>└── web/<br>    ├── public/<br>    ├── src/<br>    ├── package.json<br>    └── orval.config.ts</pre><p>The backend is a NestJS application.</p><pre>apps/api/<br>├── prisma/<br>│   ├── migrations/<br>│   ├── schema.prisma<br>│   └── seed.ts<br>│<br>└── src/<br>    ├── folders/<br>    ├── notes/<br>    ├── prisma/<br>    ├── app.module.ts<br>    └── main.ts</pre><p>The frontend is a Next.js application.</p><pre>apps/web/<br>└── src/<br>    ├── app/<br>    └── modules/</pre><p>This setup keeps domain logic close to the application that owns it.</p><p>The frontend does not need to know how Prisma works.</p><p>The backend does not need to know how the terminal UI stores its selected folder in the URL.</p><p>They communicate through the API contract.</p><p>That boundary is one of the most useful parts of this architecture.</p><h3>Use Turborepo to Run Tasks Across Applications</h3><p>Turborepo coordinates tasks across the workspace.</p><p>The root turbo.json is intentionally small:</p><pre>{<br>  &quot;tasks&quot;: {<br>    &quot;generate&quot;: {},<br>    &quot;dev&quot;: {<br>      &quot;persistent&quot;: true<br>    },<br>    &quot;build&quot;: {<br>      &quot;outputs&quot;: [&quot;dist/**&quot;, &quot;.next/**&quot;]<br>    }<br>  },<br>  &quot;ui&quot;: &quot;tui&quot;<br>}</pre><p>The key task here is dev.</p><pre>{<br>  &quot;dev&quot;: {<br>    &quot;persistent&quot;: true<br>  }<br>}</pre><p>Development servers keep running, so Turbo needs to know that the task is persistent.</p><p>When you run:</p><pre>bun run dev</pre><p>Turbo finds each workspace with a dev script and runs it.</p><p>In this project, that means:</p><ul><li>Next.js starts the web application</li><li>NestJS starts the API in watch mode</li><li>Turbo gives you one place to manage both processes</li></ul><p>Each workspace still owns its own command.</p><p>The frontend uses:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;next dev&quot;<br>  }<br>}</pre><p>The backend uses:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;nest start --watch&quot;<br>  }<br>}</pre><p>Turborepo does not replace the individual application scripts.</p><p>It coordinates them.</p><h3>Build outputs</h3><p>The build task defines where each application writes its production files:</p><pre>{<br>  &quot;build&quot;: {<br>    &quot;outputs&quot;: [&quot;dist/**&quot;, &quot;.next/**&quot;]<br>  }<br>}</pre><p>NestJS commonly outputs to dist.</p><p>Next.js outputs to .next.</p><p>By defining those outputs, Turborepo can understand what a successful build produces. This becomes especially helpful when you add CI later and want to avoid rebuilding unchanged work.</p><p>You do not need a complex Turbo pipeline immediately.</p><p>Start with the commands you actually use, then expand it when the project needs more.</p><h3>One Code-Quality Workflow with Biome</h3><p>A monorepo can become inconsistent very quickly.</p><p>One application uses one formatter. Another uses a different linter. A third package has its own rules. Soon, developers and AI tools are producing code in different styles.</p><p>This project keeps formatting and linting at the root with Biome.</p><pre>{<br>  &quot;$schema&quot;: &quot;https://biomejs.dev/schemas/2.5.0/schema.json&quot;,<br>  &quot;files&quot;: {<br>    &quot;includes&quot;: [<br>      &quot;**&quot;,<br>      &quot;!!.vscode&quot;,<br>      &quot;!!**/.next&quot;,<br>      &quot;!!**/node_modules&quot;,<br>      &quot;!!**/apps/web/public&quot;,<br>      &quot;!!**/apps/api/dist&quot;,<br>      &quot;!!**/test&quot;,<br>      &quot;!!**/generated&quot;,<br>      &quot;!!**/.agents&quot;,<br>      &quot;!!**/.claude&quot;<br>    ]<br>  },<br>  &quot;linter&quot;: {<br>    &quot;enabled&quot;: true,<br>    &quot;rules&quot;: {<br>      &quot;suspicious&quot;: {<br>        &quot;noConsole&quot;: &quot;off&quot;<br>      },<br>      &quot;style&quot;: {<br>        &quot;useImportType&quot;: &quot;off&quot;<br>      }<br>    }<br>  },<br>  &quot;formatter&quot;: {<br>    &quot;enabled&quot;: true,<br>    &quot;indentStyle&quot;: &quot;space&quot;,<br>    &quot;indentWidth&quot;: 2<br>  },<br>  &quot;javascript&quot;: {<br>    &quot;parser&quot;: {<br>      &quot;unsafeParameterDecoratorsEnabled&quot;: true<br>    }<br>  },<br>  &quot;css&quot;: {<br>    &quot;parser&quot;: {<br>      &quot;cssModules&quot;: true,<br>      &quot;tailwindDirectives&quot;: true<br>    }<br>  }<br>}</pre><p>There are a few practical details in this configuration.</p><h3>Ignore generated and build files</h3><p>Generated code should not usually be formatted manually.</p><p>The same applies to dependency folders and build output.</p><p>That is why the configuration excludes paths such as:</p><pre>node_modules<br>.next<br>dist<br>generated</pre><p>This keeps checks focused on code your team actually owns.</p><h3>Support NestJS decorators</h3><p>NestJS uses decorators extensively.</p><pre>@Controller(&quot;notes&quot;)<br>export class NotesController {}</pre><p>Biome needs decorator support enabled in the JavaScript parser configuration:</p><pre>{<br>  &quot;javascript&quot;: {<br>    &quot;parser&quot;: {<br>      &quot;unsafeParameterDecoratorsEnabled&quot;: true<br>    }<br>  }<br>}</pre><p>Without that, linting and formatting can become frustrating in a NestJS project.</p><h3>Use one root command</h3><p>The most important part is not the individual rule settings.</p><p>It is having one shared command:</p><pre>bun run lint</pre><p>That checks the full repository.</p><p>And one command for fixing issues:</p><pre>bun run lint:fix</pre><p>When you use AI to generate or modify code, this becomes even more important.</p><p>AI can help you move faster, but automated quality checks keep the resulting changes consistent with the rest of the project.</p><h3>Protect Commits with Lefthook</h3><p>Running lint checks manually is useful.</p><p>Running them automatically before every commit is better.</p><p>This project uses Lefthook with a small pre-commit configuration:</p><pre>pre-commit:<br>  commands:<br>    lint:<br>      run: &quot;bun run lint:fix {staged_files}&quot;<br>      stage_fixed: true</pre><p>When you commit changes, Lefthook runs Biome against the staged files.</p><p>If Biome can safely fix formatting or linting issues, the fixed files are added back to the commit automatically.</p><p>That gives you a simple flow:</p><ol><li>Write code.</li><li>Stage your changes.</li><li>Commit.</li><li>Biome checks and fixes staged files.</li><li>Commit cleaner code.</li></ol><p>This is not a replacement for testing or code review.</p><p>It is a fast first line of defense.</p><h3>Keep Database Code Inside the API</h3><p>The database belongs to the backend.</p><p>In this project, Prisma lives inside the NestJS application:</p><pre>apps/api/<br>├── prisma/<br>│   ├── schema.prisma<br>│   ├── migrations/<br>│   └── seed.ts<br>└── src/<br>    └── prisma/</pre><p>The schema defines a small folder and note model for the terminal-inspired notepad:</p><pre>model Folder {<br>  id        Int      @id @default(autoincrement())<br>  name      String<br>  parentId  Int?<br>  parent    Folder?  @relation(&quot;FolderToFolder&quot;, fields: [parentId], references: [id])<br>  children  Folder[] @relation(&quot;FolderToFolder&quot;)<br>  notes     Note[]<br>  createdAt DateTime @default(now())<br>}</pre><pre>model Note {<br>  id        Int      @id @default(autoincrement())<br>  text      String<br>  folderId  Int<br>  folder    Folder   @relation(fields: [folderId], references: [id])<br>  createdAt DateTime @default(now())<br>}</pre><p>The frontend does not import this Prisma model.</p><p>It should not.</p><p>The frontend talks to the backend through HTTP. The backend owns the database and decides how data is stored.</p><p>That separation becomes more valuable as your application grows.</p><h3>Let the API Contract Connect Your Applications</h3><p>The frontend and backend need to agree on requests, responses, routes, and types.</p><p>You could manually duplicate those types.</p><p>But that creates two sources of truth.</p><p>This project uses Swagger in NestJS to expose API documentation and then uses Orval in the frontend to generate a typed client.</p><p>The NestJS bootstrap creates Swagger documentation:</p><pre>import { NestFactory } from &quot;@nestjs/core&quot;;<br>import { DocumentBuilder, SwaggerModule } from &quot;@nestjs/swagger&quot;;<br>import { AppModule } from &quot;./app.module&quot;;</pre><pre>async function bootstrap() {<br>  const app = await NestFactory.create(AppModule);</pre><pre>  app.enableCors({<br>    origin: &quot;http://localhost:3000&quot;,<br>  });</pre><pre>  const config = new DocumentBuilder()<br>    .setTitle(&quot;Next Modern Stack API&quot;)<br>    .setDescription(&quot;API documentation for Next Modern Stack&quot;)<br>    .setVersion(&quot;1.0&quot;)<br>    .build();</pre><pre>  const document = SwaggerModule.createDocument(app, config);</pre><pre>  SwaggerModule.setup(&quot;api-docs&quot;, app, document);</pre><pre>  await app.listen(process.env.PORT ?? 3001);<br>}</pre><pre>bootstrap();</pre><p>The frontend then points Orval at the generated Swagger document:</p><pre>import { defineConfig } from &quot;orval&quot;;</pre><pre>export default defineConfig({<br>  api: {<br>    input: &quot;http://localhost:3001/api-docs-json&quot;,<br>    output: {<br>      target: &quot;./src/generated/api.ts&quot;,<br>      client: &quot;react-query&quot;,<br>      httpClient: &quot;fetch&quot;,<br>      baseUrl: &quot;http://localhost:3001&quot;,<br>    },<br>  },<br>});</pre><p>Running this command:</p><pre>bun run generate</pre><p>runs the generation task through Turborepo.</p><p>The result is generated TypeScript types and React Query hooks based on the backend contract.</p><p>This means the frontend does not need to manually recreate API types for folders, notes, requests, and responses.</p><p>For this article, the important idea is simple:</p><blockquote><em>The API contract is the connection between the web app and the API. It is better than treating shared TypeScript files as the only way to keep applications in sync.</em></blockquote><p>I cover this workflow in much more detail in the course, including how to document endpoints, generate hooks, and use them with TanStack Query.</p><h3>Give AI a Predictable Project Structure</h3><p>AI tools are more helpful when the project has clear boundaries and conventions.</p><p>A repository with one obvious home for each responsibility gives AI useful context:</p><pre>apps/web        # Next.js frontend<br>apps/api        # NestJS backend<br>biome.json      # Code-quality rules<br>turbo.json      # Workspace task orchestration<br>CLAUDE.md       # AI guidance<br>.claude/skills  # Reusable AI skills<br>.cursor/rules   # Editor-specific AI rules</pre><p>This does not mean AI should make every decision.</p><p>It means your project can give AI instructions before it starts generating code.</p><p>For example, an AI rule can say:</p><ul><li>use Bun commands instead of npm commands</li><li>run Biome after changes</li><li>keep database code in the API workspace</li><li>do not edit generated API files manually</li><li>follow the existing module structure</li></ul><p>The goal is not to make AI autonomous.</p><p>The goal is to make it reliable inside an existing workflow.</p><h3>A Good Starting Point for a Full-Stack Monorepo</h3><p>You do not need dozens of packages and complicated infrastructure to start building a scalable app.</p><p>You need a few clear decisions:</p><pre>[ ] Keep frontend and backend in separate applications<br>[ ] Use one root workspace<br>[ ] Use one command to start the development environment<br>[ ] Use Turborepo to coordinate common tasks<br>[ ] Keep formatting and linting rules at the root<br>[ ] Run code-quality checks before commits<br>[ ] Keep database access inside the API<br>[ ] Use an API contract instead of duplicating types manually<br>[ ] Give AI tools clear project instructions</pre><p>That is enough to create a project that stays understandable as features are added.</p><p>The monorepo is not the product.</p><p>It is the foundation that makes product development smoother.</p><h3>What Comes Next?</h3><p>This article focused on the foundation:</p><ul><li>workspace structure</li><li>app boundaries</li><li>Turborepo</li><li>Biome</li><li>Lefthook</li><li>API contracts</li></ul><p>The next step is looking at the packages that make the workflow practical day to day.</p><p>That includes:</p><ul><li>Prisma and PostgreSQL</li><li>Swagger and Orval</li><li>TanStack Query</li><li>nuqs</li><li>generated API hooks</li><li>AI rules and reusable skills</li><li>additional packages that fit well into a modern Next.js stack</li></ul><p>In my course, <strong>Next JS Modern Stack — Tooling and AI</strong>, I walk through the complete setup by building a terminal-inspired notepad application from scratch.</p><p>You will not just build a small app.</p><p>You will build a reusable workflow for modern, scalable, AI-ready TypeScript projects.</p><p><a href="https://www.udemy.com/course/next-js-modern-stack-tooling-and-ai/?referralCode=1C8A91B609FFC5C4671E"><strong>Enroll in the course on Udemy</strong></a></p><p>You can also explore the companion code here:</p><p><a href="https://github.com/Jerga99/next-modern-stack"><strong>View the GitHub repository</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7f8961e3a69" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/how-to-structure-a-modern-next-js-and-nestjs-monorepo-d7f8961e3a69">How to Structure a Modern Next.js and NestJS Monorepo</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Sui and Its Most Exciting Projects for Developers]]></title>
            <link>https://medium.com/eincode/exploring-sui-and-its-most-exciting-protocols-for-developers-8d1427fe1504?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d1427fe1504</guid>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[sui]]></category>
            <category><![CDATA[move]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 15:19:55 GMT</pubDate>
            <atom:updated>2025-02-19T18:23:31.723Z</atom:updated>
            <content:encoded><![CDATA[<h4>Unleashing Innovation: Exploring Sui’s High-Performance Blockchain and Its Most Exciting Developer-Focused Projects</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_iD7nG7zeTiNAsJJYw6jg.jpeg" /></figure><p>The Sui blockchain is redefining the standards of decentralized application development with its high scalability, low latency, and developer-friendly ecosystem. Built by Mysten Labs, Sui leverages a Directed Acyclic Graph (DAG)-based consensus mechanism that enables parallel transaction execution, making it one of the fastest and most efficient Layer 1 blockchains available.</p><h3>Why Developers Choose Sui</h3><p>Sui’s architecture is designed to overcome the limitations of traditional blockchains, such as congestion and high fees. Its ability to process independent transactions simultaneously ensures unmatched throughput and cost efficiency. For developers, Sui offers a fertile ground for building innovative decentralized applications (dApps) with minimal friction.</p><h3>Resources</h3><p><em>If you want to learn Move and Sui in-depth, check out my full course on building real projects with Move and React: </em><a href="https://academy.eincode.com/courses/sui-dapps-with-move-react-build-real-projects"><strong><em>academy.eincode.com</em></strong></a><strong><em>.</em></strong></p><h3>Key Strengths of Sui:</h3><ul><li><strong>Scalability</strong>: Horizontal scaling allows the network to handle increasing workloads seamlessly.</li><li><strong>Low Latency</strong>: Transactions achieve sub-second finality, ideal for high-performance applications.</li><li><strong>Developer-Friendly Tools</strong>: A robust set of APIs and frameworks simplifies the dApp development process.</li></ul><h3>Move Programming Language: A Developer’s Ally</h3><p>At the core of Sui’s developer ecosystem is the Move programming language. Designed specifically for blockchain use cases, Move emphasizes security and flexibility, making it an ideal choice for building smart contracts.</p><h3>Why Move Stands Out:</h3><ul><li><strong>Resource-Oriented Design</strong>: Prevents common vulnerabilities like reentrancy attacks by treating assets as resources that cannot be duplicated or destroyed.</li><li><strong>Customizability</strong>: Allows developers to create tailored assets and logic for their applications.</li><li><strong>Efficiency</strong>: Lightweight and optimized for Sui’s high-speed infrastructure.</li></ul><p>Move not only enhances security but also reduces complexity in building robust dApps, making it a favorite among developers.</p><h3>Top Protocols on Sui That Developers Should Know</h3><p>Sui’s ecosystem is rapidly expanding with innovative protocols that leverage its technical strengths. Here are some standout projects that offer exciting opportunities for developers:</p><h3>1. DeepBook Protocol</h3><p><a href="https://docs.sui.io/standards/deepbook">https://docs.sui.io/standards/deepbook</a></p><p>DeepBook is a decentralized Central Limit Order Book (CLOB) designed to provide efficient and transparent trading on the blockchain. Unlike Automated Market Makers (AMMs), DeepBook enables traders to place buy and sell orders directly on-chain, ensuring precise price discovery.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Integrate DeepBook as a liquidity source for DeFi applications.</li><li>Build advanced trading tools such as algorithmic trading bots or market-making strategies.</li><li><strong>Technical Highlights:</strong></li><li>Leverages Sui’s parallel transaction processing for high-frequency trading.</li><li>Supports market and limit orders with sub-second settlement speeds.</li></ul><h3>2. Bluefin</h3><p><a href="https://learn.bluefin.io/bluefin">https://learn.bluefin.io/bluefin</a></p><p>Bluefin is a decentralized exchange (DEX) specializing in derivatives trading, including perpetual futures. It combines the user experience of centralized exchanges with the transparency and security of decentralized platforms.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Create custom trading interfaces or analytics tools using Bluefin’s API.</li><li>Build financial products like delta-neutral strategies or staking mechanisms around Bluefin’s $BLUE token.</li><li><strong>Technical Highlights:</strong></li><li>Achieves sub-second transaction finality using Sui’s high-performance infrastructure.</li><li>Features zkLogin for seamless user onboarding without requiring wallets.</li></ul><h3>3. NAVI Protocol</h3><p><a href="https://naviprotocol.gitbook.io/navi-protocol-docs">https://naviprotocol.gitbook.io/navi-protocol-docs</a></p><p>NAVI is a decentralized liquidity protocol focused on lending and borrowing. It offers dynamic interest rates based on market conditions, making it an essential component of Sui’s DeFi ecosystem.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Build dApps that integrate NAVI’s lending pools to offer users passive income opportunities.</li><li>Leverage NAVI’s composability to create interconnected financial solutions.</li><li><strong>Technical Highlights:</strong></li><li>Fully audited smart contracts ensure security and reliability.</li><li>Optimized for low-latency operations on the Sui blockchain.</li></ul><h3>4. Suilend</h3><p><a href="https://docs.suilend.fi/">https://docs.suilend.fi/</a></p><p>Suilend is another leading DeFi protocol offering decentralized lending and borrowing services. It features dual lending pools — main pools for stable assets and isolated pools for riskier tokens.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Integrate lending functionalities into multi-purpose DeFi platforms.</li><li>Use its swap feature to enhance user experience in financial dApps.</li><li><strong>Technical Highlights:</strong></li><li>Built with Move for enhanced security and flexibility.</li><li>Utilizes Sui’s scalability for fast and cost-effective transactions.</li></ul><h3>5. Cetus Protocol</h3><p><a href="https://cetus-1.gitbook.io/cetus-docs">https://cetus-1.gitbook.io/cetus-docs</a></p><p>Cetus is a DEX that uses a Concentrated Liquidity Market Maker (CLMM) model, enabling liquidity providers to allocate capital efficiently within specific price ranges.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Build advanced trading tools using Cetus’ SDK.</li><li>Develop automated strategies like range orders or limit orders leveraging Cetus’ programmable liquidity features.</li><li><strong>Technical Highlights:</strong></li><li>High composability with other DeFi protocols on Sui.</li><li>Double-token model (CETUS and xCETUS) incentivizes participation sustainably.</li></ul><h3>6. Axelar</h3><p><a href="https://docs.axelar.dev/">https://docs.axelar.dev/</a></p><p>Axelar brings cross-chain interoperability to Sui, enabling seamless communication between different blockchains. Developers can build applications that interact with multiple ecosystems without complex bridging mechanisms.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Create multi-chain dApps that leverage assets or data from other blockchains.</li><li>Build cross-chain DeFi platforms or NFT marketplaces with ease.</li><li><strong>Technical Highlights:</strong></li><li>Fully interoperable with major blockchain networks like Ethereum and Solana.</li><li>Simplifies cross-chain asset transfers through its unified API.</li></ul><h3>7. Wormhole</h3><p><a href="https://wormhole.com/docs/">https://wormhole.com/docs/</a></p><p>Wormhole is another cross-chain protocol integrated with Sui, enabling asset transfers and communication across blockchains. Its focus on interoperability makes it an invaluable tool for developers building multi-chain applications.</p><ul><li><strong>Developer Opportunities:</strong></li><li>Enable users to move tokens seamlessly between ecosystems while leveraging Sui’s performance advantages.</li><li>Build applications that utilize data or functionality from other chains through Wormhole integration.</li><li><strong>Technical Highlights:</strong></li><li>Supports a wide range of blockchain networks, enhancing versatility.</li><li>Offers low-latency operations thanks to its integration with Sui.</li></ul><h3>Conclusion</h3><p>The combination of Sui’s high-performance infrastructure, the secure Move programming language, and a growing ecosystem of innovative protocols creates an unparalleled environment for developers. Projects like DeepBook, Bluefin, NAVI Protocol, Cetus, Axelar, Wormhole, and Suilend showcase the vast opportunities available on this blockchain. Whether you’re interested in DeFi, cross-chain interoperability, or building entirely new use cases, Sui provides all the tools you need to succeed in today’s competitive blockchain landscape.</p><p>For developers eager to shape the future of Web3, there has never been a better time to start building on Sui!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d1427fe1504" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/exploring-sui-and-its-most-exciting-protocols-for-developers-8d1427fe1504">Exploring Sui and Its Most Exciting Projects for Developers</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Coin Locking in Move on Sui: A Deep Dive]]></title>
            <link>https://medium.com/eincode/demystifying-coin-locking-in-move-on-sui-a-deep-dive-33b96d27eb72?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/33b96d27eb72</guid>
            <category><![CDATA[sui]]></category>
            <category><![CDATA[move]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[web3]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 17:00:38 GMT</pubDate>
            <atom:updated>2025-02-11T17:00:38.717Z</atom:updated>
            <content:encoded><![CDATA[<h4>Unlock the Power of Secure Coin Management on Sui with Move’s Time-Locking Mechanism.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THQ5wxZk0nzFJNrpLnsdDw.jpeg" /></figure><p>In this article, we’ll explore how to implement <strong>time-locked coins</strong> on the Sui blockchain using the Move programming language. Time-locked coins are a crucial primitive for building secure and transparent applications, enabling functionality like vesting schedules, rewards, or governance systems. This guide focuses exclusively on the <strong>locking and unlocking mechanism</strong>, breaking it down line-by-line to ensure you fully understand the implementation.</p><h3>Resources</h3><p><em>If you want to learn Move and Sui in-depth, check out my full course on building real projects with Move and React: </em><a href="https://academy.eincode.com/courses/sui-dapps-with-move-react-build-real-projects"><strong><em>academy.eincode.com</em></strong></a><strong><em>.</em></strong></p><p><strong><em>Full Contract Code:</em></strong><em> </em><a href="https://github.com/Jerga99/sui-jelo-coin/blob/main/contracts/jelo_coin/sources/jelo_coin.move"><em>https://github.com/Jerga99/sui-jelo-coin/blob/main/contracts/jelo_coin/sources/jelo_coin.move</em></a></p><h3>1. The Locker Object — Your Time-Locked Container</h3><p>To enable time-locking, we need a specialized object that securely holds coins until they are eligible for release. Enter the Locker object:</p><pre>public struct Locker has key, store {<br> id: UID,<br> unlock_date: u64,<br> balance: Balance&lt;JELO&gt;,<br>}</pre><h3>Key Fields and Attributes:</h3><ul><li><strong>key:</strong> This is an “ability” in Move that enforces the addition of an id field in the struct. The id acts as a unique identifier, ensuring that the object can be stored on the blockchain.</li><li><strong>store:</strong> This ability allows the struct to be stored within another struct, making it suitable for hierarchical or compositional object designs.</li><li><strong>id</strong>: The UID field provides the Locker with a unique identifier, ensuring it is distinguishable as an independent object. This unique identifier allows the Locker to be stored and tracked on the blockchain.</li><li><strong>unlock_date</strong>: This field is a Unix timestamp (in milliseconds) that specifies when the coins inside the Locker can be accessed.</li><li><strong>balance</strong>: Instead of using Coin, we use Balance for efficient storage. Balance acts as a container for locked funds that can later be converted back to a spendable Coin.</li></ul><h3>Why Use Balance Instead of Coin?</h3><ul><li><strong>Coin</strong>: Represents a spendable coin, optimized for immediate transactions.</li><li><strong>Balance</strong>: Optimized for storage and used in scenarios where the coins are not immediately accessible, such as time-locking.</li></ul><h3>2. Minting Locked Coins</h3><p>The mint_locked function handles the minting of new coin and encapsulates it in a Locker object before sending it to the recipient. Here&#39;s the implementation:</p><pre>public fun mint_locked(<br>    mint_cap: &amp;mut MintCapability,<br>    amount: u64,<br>    recipient: address,<br>    duration: u64,<br>    clock: &amp;Clock,<br>    ctx: &amp;mut TxContext<br>) {<br>    // 1. Mint coin<br>    let coin = mint_internal(mint_cap, amount, ctx);<br>    <br>    // 2. Calculate unlock time<br>    let start_date = clock.timestamp_ms();<br>    let unlock_date = start_date + duration;<br><br>    // 3. Create locked container<br>    let locker = Locker {<br>        id: object::new(ctx),<br>        unlock_date,<br>        balance: coin::into_balance(coin) // Convert Coin → Balance<br>    };<br><br>    // 4. Send Locker to recipient<br>    transfer::public_transfer(locker, recipient);<br>}</pre><h3>Key Steps Explained:</h3><ol><li><strong>Mint Coin</strong>: The mint_internal function creates coins in the form of a Coin object. It ensures the minted amount does not exceed the defined supply limits for the coin.</li><li><strong>Calculate Unlock Time</strong>: The current timestamp is obtained from Sui’s decentralized Clock object. Adding the specified duration to this timestamp gives us the unlock_date.</li><li><strong>Create the Locker</strong>:</li></ol><ul><li>A new Locker object is created, with its id generated using the object::new() function.</li><li>The Coin object is converted into a Balance using coin::into_balance(). This makes the coins storable in the Locker.</li></ul><p>4. <strong>Transfer the Locker</strong>: Finally, the Locker object is transferred to the specified recipient, effectively locking the coins in their account until the unlock date.</p><h3>3. Withdrawing Locked Funds</h3><p>The withdraw_locked function enables users to retrieve their locked coins once the specified time has passed. Here’s how it works:</p><pre>entry fun withdraw_locked(locker: Locker, clock: &amp;Clock, ctx: &amp;mut TxContext): u64 {<br>    // Unwrap Locker object<br>    let Locker { id, mut balance, unlock_date } = locker;<br><br>    // 1. Check lock expiration<br>    assert!(clock.timestamp_ms() &gt;= unlock_date, ETokenLocked);<br><br>    // 2. Convert Balance → Coin<br>    let locked_balance_value = balance.value();<br>    transfer::public_transfer(<br>        coin::take(&amp;mut balance, locked_balance_value, ctx), // Magic happens here<br>        ctx.sender()<br>    );<br><br>    // 3. Cleanup empty Balance<br>    balance.destroy_zero();<br>    object::delete(id);<br><br>    // Return withdrawn amount<br>    locked_balance_value<br>}</pre><h3>Key Steps and Security Measures:</h3><ol><li><strong>Validate Unlock Time</strong>:</li></ol><ul><li>The function first checks whether the current timestamp (from the Clock) is greater than or equal to the unlock_date. If not, it throws an error (ETokenLocked), preventing premature access.</li></ul><p>2. <strong>Convert Balance to Spendable Coin</strong>:</p><ul><li>The coin::take() function extracts the full value of the Balance and converts it into a spendable Coin.</li><li>This Coin is then transferred to the sender’s account (ctx.sender()).</li></ul><p>3. <strong>Clean Up Resources</strong>:</p><ul><li>The destroy_zero() function ensures that the Balance is empty after the transfer, preventing any residual values.</li><li>The Locker’s unique ID is deleted using object::delete(), removing it from the system entirely.</li></ul><h3>Key Concepts Explained</h3><h3>Why Use Balance for Locked Funds?</h3><ul><li><strong>Efficiency</strong>: Balance is designed for storage, making it ideal for coins that are not immediately accessible.</li><li><strong>Security</strong>: By separating locked funds from spendable assets, it ensures strict enforcement of access restrictions.</li></ul><h3>Decentralized Clock</h3><ul><li>Sui’s Clock object provides a globally agreed-upon timestamp, ensuring users cannot manipulate local time to unlock coins prematurely.</li></ul><h3>Safety Mechanisms</h3><ul><li><strong>destroy_zero</strong>: Ensures no residual value remains in the Balance after withdrawal.</li><li><strong>Object Deletion</strong>: Prevents reuse or duplication of the Locker object, maintaining system integrity.</li><li><strong>entry Modifier</strong>: Exposes the function as a transaction endpoint, allowing users to call it directly via transactions.</li></ul><h3>Visualizing the Flow</h3><p>Here’s a high-level summary of the process:</p><ol><li><strong>Mint Tokens</strong>: Create coins using standard minting procedures.</li><li><strong>Convert to Balance</strong>: Prepare the coins for storage by converting them into a non-spendable Balance.</li><li><strong>Lock in Container</strong>: Store the Balance in a Locker with an unlock date.</li><li><strong>Wait for Unlock Date</strong>: The Locker remains inaccessible until the specified time passes.</li><li><strong>Validate and Unlock</strong>: Once the unlock date is reached, validate the time and convert the Balance back into spendable Coin.</li></ol><h3>Why This Matters</h3><p>Time-locked coins are a versatile building block for decentralized applications. Here are some real-world use cases:</p><ul><li><strong>Vesting Schedules</strong>: Founders’ coins allocations can be locked to ensure long-term commitment.</li><li><strong>Time-Locked Rewards</strong>: GameFi platforms can use this mechanism to reward users after achieving milestones.</li><li><strong>DAO Governance</strong>: Voting power can be time-locked to prevent sudden sell-offs or manipulation.</li></ul><p>By leveraging Move’s strict type system and Sui’s decentralized architecture, this pattern ensures <strong>secure and flexible asset management</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33b96d27eb72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/demystifying-coin-locking-in-move-on-sui-a-deep-dive-33b96d27eb72">Demystifying Coin Locking in Move on Sui: A Deep Dive</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Meme Coin on Sui Blockchain: Simplicity Meets Power]]></title>
            <link>https://medium.com/eincode/creating-a-meme-coin-on-sui-blockchain-simplicity-meets-power-f7d1dc1118cd?source=rss-5a2a1f2d2580------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7d1dc1118cd</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[sui]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[move]]></category>
            <dc:creator><![CDATA[Filip Jerga]]></dc:creator>
            <pubDate>Fri, 07 Feb 2025 15:41:54 GMT</pubDate>
            <atom:updated>2025-02-07T15:41:54.919Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn how to harness Sui’s unique features to launch your own digital currency effortlessly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0NWbqdt8wtp2296CrjcfyQ.jpeg" /></figure><p>In this tutorial, we’ll break down how to create your own meme coin on Sui using Move — the blockchain’s native smart contract language. Sui’s object-centric model and developer-friendly approach make it special, and we’ll demonstrate this with actual code. By the end, you’ll understand why Sui is becoming a favorite for Web3 projects.</p><h3>Complete Meme Coin Code</h3><p>Full Project: <a href="https://github.com/Jerga99/sui-jelo-coin">https://github.com/Jerga99/sui-jelo-coin</a></p><pre>module jelo_coin::jelo;<br>use sui::coin::{Self, TreasuryCap};<br>use sui::url::new_unsafe_from_bytes;<br><br>public struct JELO has drop {}<br><br>const TOTAL_SUPPLY: u64 = 1_000_000_000_000_000_000;<br><br>fun init(otw: JELO, ctx: &amp;mut TxContext) {<br>    let (mut treasury, metadata) = coin::create_currency(<br>        otw,<br>        9,<br>        b&quot;JELO&quot;,<br>        b&quot;JELO&quot;,<br>        b&quot;Meet JELO the cutest jellyfish meme coin...&quot;,<br>        option::some(new_unsafe_from_bytes(b&quot;data:image/jpeg;base64,...&quot;)),<br>        ctx<br>    );<br>    mint(&amp;mut treasury, TOTAL_SUPPLY, ctx.sender(), ctx);<br>    transfer::public_freeze_object(metadata);<br>    transfer::public_freeze_object(treasury);<br>}<br><br>public fun mint(<br>    treasury_cap: &amp;mut TreasuryCap&lt;JELO&gt;,<br>    amount: u64,<br>    recipient: address,<br>    ctx: &amp;mut TxContext<br>) {<br>    let coin = coin::mint(treasury_cap, amount, ctx);<br>    transfer::public_transfer(coin, recipient);<br>}</pre><h3>Key Components Explained</h3><h3>1. Module Initialization</h3><pre>module jelo_coin::jelo;<br>use sui::coin::{Self, TreasuryCap};</pre><ul><li><strong>Package Structure:</strong> The jelo_coin package contains the jelo module, where the logic for creating and managing the meme coin resides.</li><li><strong>Core Imports:</strong> The module uses Sui’s built-in coin module for token standards, simplifying development and ensuring compatibility with the Sui ecosystem.</li></ul><h3>2. Coin Configuration</h3><pre>public struct JELO has drop {}<br>const TOTAL_SUPPLY: u64 = 1_000_000_000_000_000_000;</pre><ul><li><strong>Purpose</strong>:<br>The JELO struct serves as the core identifier for the JELO coin. It represents the unique resource associated with the token.</li><li><strong>drop Ability</strong>:<br>The drop ability allows instances of JELO to be destroyed or discarded without requiring explicit handling, such as transferring or unpacking. This simplifies the logic for managing the resource in certain scenarios. However, in this context, the JELO struct is primarily used as a type marker for the coin and isn&#39;t directly dropped during normal operations.</li><li><strong>Supply Clarification</strong>:<br>While the supply is represented as 1 quintillion <strong>(1_000_000_000_000_000_000)</strong> base units, the human-readable total supply is 1 billion<strong> (1_000_000_000)</strong> JELO due to the 9 decimal places defined for precision. Each JELO is divisible into 1 billion base units, meaning 1 JELO = 1 billion base units. This design follows a common pattern in meme coins, allowing for small transaction values and mimicking fiat currency subdivisions, such as cents.</li></ul><h3>3. Smart Initialization</h3><pre>fun init(otw: JELO, ctx: &amp;mut TxContext) {<br>  let (mut treasury, metadata) = coin::create_currency(<br>    otw, // One-time witness<br>    9,   // Decimals<br>    b&quot;JELO&quot;, // Symbol<br>    b&quot;JELO&quot;, // Name<br>    b&quot;Description...&quot;, // Description<br>    option::some(image_url), // Base64 image<br>    ctx<br>  );</pre><ul><li><strong>coin::create_currency</strong>:<br>This function abstracts the complex process of creating a token by:</li><li>Managing <strong>metadata</strong> (name, symbol, description, and logo).</li><li>Configuring <strong>decimal precision</strong>, allowing transactions in fractional amounts.</li><li>Ensuring the token’s properties (like its name and symbol) are immutable after initialization.</li><li><strong>One-Time Witness (OTW) Pattern</strong>:<br>The otw parameter ensures that the initialization function is executed only once. This prevents unauthorized creation of duplicate currencies.</li><li><strong>Freezing Objects</strong>:<br>Freezing the metadata and treasury ensures that they cannot be altered post-deployment, adding security and trustworthiness to the token.</li></ul><h3>4. Supply Management</h3><pre>mint(&amp;mut treasury, TOTAL_SUPPLY, ctx.sender(), ctx);<br>transfer::public_freeze_object(metadata);<br>transfer::public_freeze_object(treasury);</pre><ul><li><strong>Initial Minting</strong>:<br>The entire token supply is minted at the time of deployment and sent to the creator’s wallet. This is a common pattern for meme coins, allowing the creator to control initial distribution.</li><li><strong>Post-Deployment Immutability</strong>:<br>By freezing the metadata and treasury, the token’s core properties and minting authority cannot be altered, providing assurance to users and investors that the maximum supply can ever be 1 billion coins, ensuring scarcity and value retention over time.</li></ul><h3>5. Mint Function</h3><pre>public fun mint(<br>    treasury_cap: &amp;mut TreasuryCap&lt;JELO&gt;,<br>    amount: u64,<br>    recipient: address,<br>    ctx: &amp;mut TxContext<br>) {<br>    let coin = coin::mint(treasury_cap, amount, ctx);<br>    transfer::public_transfer(coin, recipient);<br>}</pre><ul><li><strong>Controlled Minting</strong>:<br>The mint function requires the TreasuryCap, which acts as the authority for minting and burning. This function is called initially in the init process, and once the treasury is frozen, it cannot be called again, preventing unauthorized inflation by ensuring no additional tokens can be created.</li><li><strong>Native Transfers</strong>:<br>Transfers use Sui’s built-in transfer system, ensuring secure and gas-efficient token movement.</li></ul><h3>Why This Matters for Developers</h3><h4>Battery-Included Design</h4><p>Sui provides robust, built-in modules and standards, making token creation straightforward:</p><ul><li>No need to write custom token standards like ERC-20.</li><li>Automatic metadata handling, so developers don’t have to manage JSON-based metadata manually.</li><li>Built-in support for decimals, making fractional transactions seamless.</li></ul><h4>Object Security Model</h4><ul><li><strong>TreasuryCap</strong>: Controls minting and burning, reducing the risk of unauthorized inflation.</li><li><strong>Frozen Objects</strong>: Prevent changes to critical components like metadata and supply settings.</li><li><strong>Ownership Rules</strong>: Enforced at the protocol level to enhance security and reduce bugs.</li></ul><h4>Gas Efficiency</h4><ul><li>Token initialization requires only a single transaction, reducing deployment costs.</li><li>Transactions can be batched, allowing multiple operations within a single block.</li><li>Sui’s predictable fee structure ensures consistent and low costs.</li></ul><h3>From Code to Production</h3><p>While this shows core token creation, real-world projects need:</p><ol><li>Tokenomics strategies</li><li>Liquidity pool integration</li><li>Frontend with React.js (or other lib)</li><li>Unit testing &amp; security audits</li><li>Mainnet deployment</li></ol><p><strong>Want to master these aspects?</strong> My Udemy course <a href="https://academy.eincode.com/courses/sui-dapps-with-move-react-build-real-projects"><strong>Sui Blockchain with Move &amp; React.js — The Complete Guide</strong></a> covers:</p><p>✅ Full-stack dApp development<br>✅ Advanced tokenomics design<br>✅ Voting systems with shared objects<br>✅ React frontend integration<br>✅ Testnet/Devnet/Local deployment<br>✅ Real-world project</p><pre>// Enroll today and bootstrap your career<br>module education::sui_development;<br><br>public fun launch_career(student: &amp;mut Developer) {<br>    student.skill_level = Level::Professional;<br>}</pre><p>Sui’s combination of Move’s safety and React’s flexibility creates perfect conditions for blockchain developers. Whether you’re building the next viral meme coin or enterprise-grade dApps, these tools provide the foundation you need.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7d1dc1118cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eincode/creating-a-meme-coin-on-sui-blockchain-simplicity-meets-power-f7d1dc1118cd">Creating a Meme Coin on Sui Blockchain: Simplicity Meets Power</a> was originally published in <a href="https://medium.com/eincode">Eincode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>