AI Didn’t Build My Backend for Me. I Used It as My Copilot.

AI Didn’t Build My Backend for Me. I Used It as My Copilot.

AI 并没有帮我写好后端,我把它当作了我的副驾驶

When we were given our project, CourierIQ, I knew I wanted to use it as an opportunity to learn something outside what I was already comfortable with. I was already more familiar with frontend development, so when backend development came into the picture, I was actually excited. I thought, okay, this is going to be interesting. I don’t want to be someone who only knows one side of development. If I have the opportunity to learn something new, why not? 当我们接到 CourierIQ 这个项目时,我就知道这是一个跳出舒适区、学习新知识的好机会。我之前对前端开发比较熟悉,所以当后端开发任务出现时,我其实感到很兴奋。我想,这会很有趣。我不想只做一个只会单方面开发的人。如果有机会学习新东西,为什么不呢?

But when the backend sessions actually started, I quickly realized I had a lot to learn. We were talking about requests, APIs, endpoints, controllers, services, middleware and all these things that sounded very familiar to everyone else but were honestly confusing to me. I was hearing all these terms, but I didn’t really understand how they connected. It wasn’t until I started doing the hands-on work that things slowly started making sense. 但当后端课程真正开始时,我很快意识到自己要学的东西太多了。我们讨论着请求、API、端点、控制器、服务、中间件等等,这些术语对其他人来说似乎很熟悉,但对我而言却令人困惑。我听到了所有这些术语,却并不真正理解它们是如何关联的。直到我开始动手实践,事情才慢慢变得清晰起来。

I Didn’t Want to Spend Weeks Watching Tutorials

我不想花几周时间看教程

At that point, I had a problem. I could go through several backend tutorials and slowly learn everything before building CourierIQ. But the project had a deadline. And knowing myself, I also knew that I could easily spend weeks watching tutorials, taking notes, starting another tutorial, and still be waiting for that perfect moment when I felt “ready” to build. So I started thinking about another way I could learn while actually building. That’s when I decided to use AI. Not because I wanted AI to build my backend for me. I saw AI as a way to speed up the learning process while working on the actual project. And this is where my approach became very important. 那时我遇到了一个问题。我可以先看完几个后端教程,在构建 CourierIQ 之前慢慢学完所有东西。但项目是有截止日期的。而且我了解自己,我知道我很容易花上几周时间看教程、做笔记、开始另一个教程,却始终在等待那个感觉自己“准备好”去构建的完美时刻。所以我开始思考另一种边做边学的方法。就在那时,我决定使用 AI。不是因为我想让 AI 帮我写后端,而是我将 AI 视为在实际项目中加速学习过程的一种方式。这就是我的方法变得至关重要的地方。

I Didn’t Ask AI to Build Everything

我没有让 AI 完成所有工作

When I started working with AI on the backend, I gave it a specific role. I basically told it: I’m new to backend development. Act like a senior developer mentoring me through this project. Give me the steps I need to follow, explain why I’m doing them, and don’t just write the code for me. I was using Antigravity, and I really enjoyed the support I got from it throughout the process. 当我开始与 AI 合作开发后端时,我给它设定了一个特定的角色。我基本上是这样告诉它的:我是后端开发的新手。请扮演一位资深开发者的角色,指导我完成这个项目。告诉我需要遵循的步骤,解释我为什么要这样做,不要直接把代码写给我。我当时使用的是 Antigravity,在整个过程中,我非常享受它提供的支持。

One of the first things I wanted to understand was the structure of the backend itself. Where should my files go? Why do I need a config folder? Why are there routes, controllers, services and models? What is supposed to happen in each one? For me, this was important because I didn’t just want the project to work. I wanted the codebase to actually make sense. So instead of asking AI: “Build my backend.” I would ask it something more like: “What should I do first?” And it would give me the steps. Create this folder. Create this file. This file is responsible for this. Then move to this part. Then connect this. Then test it. And I would write the code myself. 我首先想了解的事情之一是后端本身的结构。我的文件应该放在哪里?为什么需要一个 config 文件夹?为什么会有路由、控制器、服务和模型?每个部分应该负责什么?对我来说,这很重要,因为我不仅希望项目能运行,还希望代码库本身是有逻辑的。所以,我没有问 AI:“帮我构建后端。”而是问它:“我应该先做什么?”它会给我步骤:创建这个文件夹,创建这个文件,这个文件负责这个功能。然后进行下一部分,连接这个,然后测试它。而代码则由我自己编写。

Why I Wanted the Steps Instead of the Code

为什么我想要步骤而不是代码

This was probably one of the most important decisions I made during the process. It would have been much easier to tell AI: “Build the authentication system for me.” And then copy whatever it gave me. But I knew that if I did that, I could end up with a working backend that I didn’t actually understand. And I didn’t want that. I wanted to struggle a little. I wanted to make mistakes. I wanted to look at an error and try to figure out what was wrong. So most of the time, AI gave me the steps and direction, and I handled the implementation. Sometimes I would write something incorrectly and AI would point out the problem. Sometimes I would see a piece of code I didn’t understand and ask: “Why are we doing this?” Or: “What does this actually do?” Or even: “Explain this to me like I’m completely new to it.” And that became part of my learning process. 这可能是我在整个过程中做出的最重要的决定之一。告诉 AI “帮我构建身份验证系统”然后直接复制它给我的代码会容易得多。但我知道,如果我那样做,最终可能会得到一个能运行但我不理解的后端。我不想要那样。我想经历一些挣扎,我想犯错,我想面对错误并尝试找出问题所在。所以大多数时候,AI 给我步骤和方向,而我负责实现。有时我写错了,AI 会指出问题;有时我看到一段不理解的代码,我会问:“我们为什么要这样做?”或者“这到底有什么用?”甚至“请像对待完全的新手一样向我解释这段代码。”这成为了我学习过程的一部分。

The Small Things Started Clicking

小细节开始变得清晰

One of the first moments where I felt like my approach was actually working was when I started setting up the Express application and getting my server running. Then I moved on to initializing the database. These might sound like very small things, but for someone who was completely new to backend development, they were actually important moments. I started understanding that the things I was writing weren’t just random lines of code. There was a reason for the server. There was a reason for the database connection. There was a reason for the different folders. There was a flow. And slowly, the backend stopped looking like a huge confusing block of code. It started becoming something I could actually navigate. 当我开始设置 Express 应用程序并让服务器运行起来时,我第一次感觉到我的方法奏效了。接着我开始初始化数据库。这些听起来可能很小,但对于一个完全的后端新手来说,这些都是重要的时刻。我开始明白,我写的不仅仅是随机的代码行。服务器的存在是有原因的,数据库连接是有原因的,不同的文件夹也是有原因的。它们之间存在一种逻辑流。慢慢地,后端不再看起来是一堆令人困惑的代码块,它开始变成我真正能够驾驭的东西。

Then JWT Confused Me 😂

然后 JWT 把我搞糊涂了 😂

Of course, it wasn’t all smooth. JWT was one of those things that made me stop and ask a lot of questions. I understood that users needed to log in, but then I started seeing tokens, secrets, user IDs and verification. And I was like… Wait. Why are we doing all this? So instead of just copying the JWT code, I started asking questions. What exactly is inside the token? Why is the user ID there? What is the JWT secret? Why does the backend need it? How does the backend know whether the token is valid? That process helped me understand that the token wasn’t just some random string the backend generated. It could represent an authenticated user’s session, and the backend could verify it before allowing access to protected resources. That was one of those moments where asking AI to explain something was more valuable to me than simply getting the code. 当然,过程并非一帆风顺。JWT 是那种让我停下来问很多问题的东西。我明白用户需要登录,但随后我开始看到令牌(token)、密钥(secret)、用户 ID 和验证。我当时想……等等,我们为什么要搞这些?所以,我没有直接复制 JWT 代码,而是开始提问。令牌里到底有什么?为什么要有用户 ID?什么是 JWT 密钥?后端为什么需要它?后端如何知道令牌是否有效?这个过程帮助我理解了令牌不仅仅是后端生成的随机字符串。它代表了已认证用户的会话,后端可以在允许访问受保护资源之前对其进行验证。那一刻,我意识到向 AI 寻求解释比单纯获取代码更有价值。

AI Became My “Senior Developer”

AI 成为了我的“资深开发者”

The easiest way I can describe my experience is that AI felt like having a senior developer beside me. Not someone who sits down and writes the entire project for me. More like someone who says: “Okay, this is what you need to do next.” Then I try it. If I get something wrong: “This part isn’t right. Here’s why. Try it again.” If I don’t understand something: “Let’s break this down.” And then I continue. That’s how I wanted to use AI. It wasn’t about removing the thinking from the process. It was about having somewhere to turn when I got stuck. 我能描述这种体验的最简单方式是:AI 就像我身边的一位资深开发者。它不是那种坐下来帮我写完整个项目的人,更像是那种会说:“好了,接下来你需要做这个”的人。然后我尝试去做。如果我做错了,它会说:“这部分不对,原因如下,再试一次。”如果我不理解某件事,它会说:“让我们把它拆解开来看。”然后我继续。这就是我想要使用 AI 的方式。它不是为了省去思考的过程,而是为了在我卡住时有一个可以求助的对象。

I Still Used AI for the Frontend Too

我在前端开发中也使用了 AI

Interestingly, I used AI differently depending on what I was building. With frontend development, there were things I already knew… 有趣的是,根据构建内容的不同,我使用 AI 的方式也不同。在前端开发中,有些东西我已经很熟悉了……