On this page
- HTTP and APIs: the contract you publish
- Data modeling and relational databases
- Transactions, race conditions, and idempotency
- Authentication and authorization
- Laravel and Node.js: two routes, real trade-offs
- Error handling: loud inside, polite outside
- Background jobs, queues, and scheduled work
- Caching: a trade, not a free speed-up
- Redis, brokers, and microservices: when they earn their cost
- Security you cannot skip
- Testing against the real thing
- Deployment and observability
- Common mistakes
- A staged roadmap with projects
- Official resources worth your time
- Next steps
You can follow a tutorial and have a working CRUD API by the evening. The hard part arrives later: two requests land in the same millisecond and both sell the last item in stock, a user changes an ID in the URL and reads someone else's invoice, a migration locks a busy table, or a mobile app retries a timed-out request and charges a card twice. Roadmaps that list fifty technologies do not prepare you for any of that. This one is organized around those problems instead.
Backend development is where an application keeps its promises. The interface can be rebuilt in a weekend; the data underneath it usually cannot. Corrupt it, leak it, or lose it, and no amount of frontend polish matters. That is why backend work is dominated by concerns that sound unglamorous — correctness, permissions, integrity, recovery — and why those concerns transfer between languages almost perfectly. Below you will find them in the order you will need them, an honest comparison of Laravel and Node.js, and a staged plan of projects. If you have not chosen a track yet, read how to choose your programming track first.
HTTP and APIs: the contract you publish
Everything starts here. A client sends a request with a method, a path, headers, and often a body. Your application routes it, authenticates the caller, validates the input, checks permission, does the work, and returns a response with a status code, headers, and a body. Every framework dresses this up differently; underneath it is always the same sequence.
Methods, safety, and idempotency
GET and HEAD are safe: they must not change state, which is why a link crawler or a browser prefetch can follow them freely — never delete or update anything on a GET. PUT and DELETE are idempotent: sending the same request twice has the same intended effect as sending it once. POST and PATCH carry no such guarantee. This matters because networks fail, and clients, proxies, and your own retry code resend requests after a timeout. A repeated GET is harmless; a repeated POST /payments is a second charge. That gap is what idempotency keys close, covered in the transactions section below.
Status codes are part of the contract
Status codes are not decoration. Returning 200 with an error message inside the body is a common beginner habit that breaks every client, monitoring tool, and retry policy that trusts the protocol. A small, consistent set covers almost every API:
| Code | Meaning | Use it when |
|---|---|---|
200 OK | Success with a body | A read or update succeeded |
201 Created | A new resource exists | A POST created something; add a Location header |
204 No Content | Success, nothing to return | A DELETE succeeded |
400 Bad Request | The request itself is malformed | Unparseable JSON, wrong content type |
401 Unauthorized | Despite the name: not authenticated | Missing, expired, or invalid credentials |
403 Forbidden | Identity known, permission denied | A logged-in user touches someone else's data |
404 Not Found | No such resource | Also to hide that a private resource exists |
409 Conflict | Clashes with current state | Duplicate booking, stale version on update |
422 Unprocessable Content | Well-formed but invalid | Validation failed (Laravel's default) |
429 Too Many Requests | Rate limit reached | Add Retry-After so clients back off |
500 Internal Server Error | Your code failed | Never for a client mistake |
503 Service Unavailable | Temporarily unable to serve | Maintenance, overload, a failing dependency |
Headers worth knowing early
Content-TypeandAccept— what the body is and what the client wants back. Laravel decides between a redirect and a JSON error partly onAccept: application/json.Authorization— carries a bearer token. Cookies carry sessions. Know which one your API uses and why.Cache-ControlandETag— let clients and CDNs reuse responses; a matchingIf-None-Matchearns a cheap304 Not Modified.Locationon201,Retry-Afteron429and503— small touches that make clients behave well.
REST, practically
REST shapes those exchanges around resources: nouns in the URL, verbs in the method. GET /orders lists, POST /orders creates, GET /orders/42 reads one, PATCH /orders/42 changes part of it. Statelessness means each request carries everything needed to process it — credentials, identifiers — so any instance of your app can handle it. That is what later lets you put a second server behind a load balancer. It does not forbid sessions: a session cookie pointing at shared server-side storage is fine.
Consistency matters more than purity. An API where every endpoint paginates, filters, names fields, and reports errors the same way is easy to use even if a purist would quibble. Pick one error shape and keep it everywhere — RFC 9457 Problem Details is a standard format worth borrowing. Version deliberately so you can change things without breaking existing clients. GraphQL and gRPC solve specific problems well, but they sit on the same HTTP foundations, so learn those first.
Data modeling and relational databases
This is the highest-leverage skill in backend work, and the one most often skipped in favor of learning an ORM. A good schema keeps features easy for years; a bad one turns every feature into a negotiation with your own past decisions.
Model the data before the endpoints
Start from the domain: which things exist, how they relate, and which facts must never be contradicted — an order belongs to exactly one customer, an email is unique, stock never goes negative. Write those rules into the schema as constraints. The database is the only component that sees every write: from every request, every queue worker, every one-off script, and every service you have not built yet.
- Types: store money as integer minor units (cents, piasters) or
NUMERIC/DECIMAL, never as a floating-point number. Store timestamps with a time zone, or consistently in UTC. - Keys: a primary key on every table, foreign keys for every relationship, so the database refuses an order that points at a customer who does not exist.
- Constraints:
NOT NULL,UNIQUE, andCHECKare free correctness. Application validation gives friendly messages; constraints are the guarantee. - Relationships: one-to-many through a foreign key, many-to-many through a join table that can carry its own columns (a
quantityonorder_items, aroleonteam_user).
SQL first, ORM second
Eloquent, Prisma, Drizzle, and the rest are productivity tools on top of SQL, not replacements for it. Learn SELECT with JOIN, GROUP BY, subqueries, and window functions, and learn to read a query plan. When the ORM produces a slow query — and it will — you need to read the SQL it generated.
The N+1 query problem deserves naming because it is the most common performance bug in web applications. You load a list of orders, then loop over them asking for each order's customer — one query becomes a hundred and one. Every mature ORM can load those relationships up front (with('customer') in Eloquent, include in Prisma). Laravel can even throw in development when a relationship is lazy-loaded: call Model::preventLazyLoading(! app()->isProduction()) in a service provider and the bug surfaces before your users find it.
Indexes
An index speeds up reads that filter, join, or sort by its columns, and it costs you on every insert and update plus disk space. Index the columns you actually query by, remember that column order matters in a composite index, and confirm with EXPLAIN (EXPLAIN ANALYZE in PostgreSQL) instead of guessing. One trap worth knowing: PostgreSQL does not automatically index the referencing side of a foreign key, while MySQL's InnoDB does. On PostgreSQL, add those indexes yourself.
Normalization versus pragmatism
Normalize by default: keep each fact in one place, so updating it cannot leave contradictory copies behind. Denormalize deliberately, when a measured read problem justifies it, and accept that you now own keeping the copies in sync. Also learn to tell a copy from a snapshot. Storing the price on an order line is not denormalization at all — it is a historical fact, because the product's price will change and the order must not.
Migrations
Schema changes belong in versioned migration files, committed with the code and run in the same order everywhere. In production a migration runs against live data while old code is still serving traffic, so a rename or a dropped column can break running requests, and building a large index can block writes (PostgreSQL's CREATE INDEX CONCURRENTLY exists for that reason). The safe pattern is expand and contract: add the new column, deploy code that writes both, backfill, switch reads, and only then remove the old one. Never edit a migration that has already run somewhere else; write a new one.
NoSQL databases such as MongoDB suit particular shapes of problem — flexible or rapidly evolving documents, certain scaling patterns. They are not an automatic upgrade over SQL, and choosing one to avoid learning relational modeling tends to relocate the difficulty rather than remove it: the constraints you skipped reappear as bugs in application code.
Transactions, race conditions, and idempotency
A transaction groups statements so they succeed or fail together. ACID names its guarantees: atomicity (all or nothing), consistency (constraints hold before and after), isolation (concurrent transactions do not see each other's half-finished work, to a degree set by the isolation level), and durability (once committed, it survives a crash). The defaults differ: PostgreSQL uses Read Committed, MySQL's InnoDB uses Repeatable Read. Neither default prevents every race on its own, which is the part most tutorials leave out.
A concrete race condition
One item is left in stock. Two customers press Buy at the same moment. Each request reads stock = 1, each passes the if (stock > 0) check in application code, each writes stock = 0, and each creates an order. You sold one item twice. Wrapping the code in a transaction at the default isolation level does not fix it, because both reads happened before either write. The fix is to make the check and the write a single atomic step:
-- Broken: read, decide in app code, then write.
SELECT stock FROM products WHERE id = 42; -- both requests see 1
UPDATE products SET stock = 0 WHERE id = 42; -- both succeed
-- Fix 1: one atomic statement. 0 rows updated means sold out.
UPDATE products
SET stock = stock - 1
WHERE id = 42 AND stock >= 1;
-- Fix 2: lock the row until the transaction ends.
BEGIN;
SELECT stock FROM products WHERE id = 42 FOR UPDATE;
-- check stock, insert the order, decrement...
COMMIT;
-- Last line of defense, whatever the code does:
ALTER TABLE products ADD CONSTRAINT stock_not_negative CHECK (stock >= 0);lockForUpdate() inside DB::transaction(). Keep locked transactions short.The same thinking applies elsewhere: a UNIQUE constraint stops two signups with one email far more reliably than checking first and inserting second. Stricter isolation levels (Repeatable Read, Serializable) can catch conflicts for you, but then the database aborts one transaction and your code must retry it — the PostgreSQL docs are explicit that applications at those levels must be prepared to retry.
Idempotency keys
Networks fail after the server commits but before the client hears back. The client retries, and without protection you create a second payment. The fix: the client generates a unique key per logical operation and sends it with the request, usually in an Idempotency-Key header. The server stores the key with the result under a unique constraint. A repeat with the same key returns the stored result instead of acting again; the same key with a different payload is rejected. The header is still an IETF Internet-Draft, not a finished standard, but the pattern is widely used by payment APIs and works with any framework.
CREATE TABLE payments (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
user_id bigint NOT NULL REFERENCES users (id),
idempotency_key text NOT NULL,
amount_cents bigint NOT NULL CHECK (amount_cents > 0),
status text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
UNIQUE (user_id, idempotency_key)
);
-- On a unique violation, load and return the existing row.Queue workers retry too, so the same rule applies to background jobs: a job that runs twice must not send two invoices or charge twice. Design every job to be safe to repeat.
Authentication and authorization
These two words get used interchangeably and mean different things. Authentication establishes who someone is. Authorization decides what that person may do. Conflating them produces the classic vulnerability where any logged-in user can read another user's records by changing an ID in the URL. It is common enough that Broken Access Control sits at number one in the OWASP Top 10:2025.
Sessions versus tokens
| Server-side session (cookie) | Bearer token (opaque or JWT) | |
|---|---|---|
| Where state lives | In a session store; the cookie holds only an ID | Opaque: a database row. JWT: inside the token, verified by signature |
| Revoking access | Delete the session | Opaque: delete the row. JWT: hard before expiry without a denylist |
| Main browser risk | Needs CSRF protection; an HttpOnly cookie is unreadable by scripts | Stored in localStorage, any XSS can steal it |
| Fits best | Your own web app on the same site | Mobile apps, CLIs, third-party API clients |
Laravel Sanctum shows the split well: cookie-based session authentication for your own SPA, and API tokens — stored as SHA-256 hashes — for mobile apps and third parties. Note that Sanctum tokens never expire by default; set an expiration. Do not reach for JWTs just because a tutorial did. A JWT's payload is signed, not encrypted, so anyone holding the token can read it.
Passwords
Never store passwords in plain text, and never encrypt them — encryption is reversible. Hash them with a slow, salted algorithm built for the job. The OWASP Password Storage Cheat Sheet recommends Argon2id first, then scrypt, with bcrypt for legacy systems (mind its 72-byte input limit). Use what the platform gives you: Laravel's Hash facade or PHP's password_hash() and password_verify(); in Node, the built-in crypto.scrypt or a maintained Argon2 package. Then rate-limit login attempts, return the same message for unknown user and wrong password, and offer multi-factor authentication.
Authorization and least privilege
Check permissions on the server for every request, regardless of what the interface shows, and verify ownership of the resource rather than merely that someone is logged in. Hiding a button is a user-experience decision, never a security control. Keep the rules in one place — Laravel policies, or a single authorization module in Node — instead of scattered if statements, and deny by default. Apply least privilege beyond users too: the application's database account should not own the schema or be a superuser, API tokens should carry only the abilities they need, and admin functions deserve their own routes and checks.
Laravel and Node.js: two routes, real trade-offs
Neither is universally better. Choose based on your background, the team you want to join, and what you are building — then notice how much of this article applies to both sides unchanged.
| Laravel (PHP) | Node.js (JavaScript/TypeScript) | |
|---|---|---|
| Philosophy | Batteries included: routing, ORM, validation, auth, queues, cache, mail, testing, one set of conventions | Assemble your own: a framework plus chosen libraries for validation, ORM, auth, jobs |
| Request model | Classic PHP-FPM: each request boots the app in a worker and discards its state afterwards | One long-running process; JavaScript runs on a single event-loop thread with non-blocking I/O |
| Where it bites | Concurrency is bounded by worker count; WebSockets need a separate server (Reverb) | CPU-heavy work stalls every request in the process; module-level state leaks across requests |
| Decisions you make | Fewer; the defaults are good and well documented | More; flexibility you pay for with integration and upkeep |
| Strong fit | Business apps, dashboards, e-commerce, small teams that want to ship fast | Real-time features, many concurrent connections, teams already deep in TypeScript |
How a request actually runs
In the classic PHP setup, each request gets a fresh application: shared-nothing. A memory leak or a stray global dies with the request, and a slow request ties up only its own worker. The cost is bootstrapping on every request and a concurrency ceiling set by how many workers you run. Laravel Octane keeps the application in memory between requests for speed — and with it you inherit Node-style care about state leaking between requests.
Node runs one long-lived process. Your JavaScript executes on a single event-loop thread while I/O — sockets, database calls, most file operations — is handled asynchronously by libuv, so thousands of mostly-waiting connections are cheap. The price is that any synchronous CPU-heavy work (parsing a huge JSON body, synchronous crypto, a catastrophic regular expression) stalls every request in that process. The official guide, Don't Block the Event Loop, is required reading. Move heavy work to worker threads or a queue, and treat module-level variables as shared between all users.
PHP and Laravel
Start with modern PHP itself — types, classes and interfaces, enums, namespaces, exceptions, and Composer for dependencies. Laravel 13, released in March 2026, requires PHP 8.3 or newer. Then learn Laravel roughly in this order: routing and controllers, middleware, Form Request validation, Eloquent and relationships, authentication and policies, API resources for shaping responses, then queues, events, notifications, caching, and testing.
// routes/api.php: authenticate, then authorize via OrderPolicy::create
Route::post('/orders', [OrderController::class, 'store'])
->middleware('auth:sanctum')
->can('create', Order::class);
// app/Http/Requests/StoreOrderRequest.php
public function rules(): array
{
return [
'product_id' => ['required', 'integer', 'exists:products,id'],
'quantity' => ['required', 'integer', 'min:1', 'max:100'],
];
}
// app/Http/Controllers/OrderController.php
public function store(StoreOrderRequest $request): OrderResource
{
// Only validated fields; user_id comes from the session, not the body.
$order = $request->user()->orders()->create($request->validated());
return new OrderResource($order); // a new model is returned as 201
}JavaScript, TypeScript, and Node.js
If you are coming from the frontend roadmap, Node keeps you in one language across the stack. Learn the runtime's model first — the event loop, promises and async/await, streams — then a framework. Run an LTS line in production: as of November 2026 that means Node.js 26 or 24 (22 is still in maintenance), and from Node.js 27 onward every major release becomes LTS on a yearly cadence. Recent Node versions run erasable TypeScript directly by stripping types, without type-checking it, so keep tsc in your build or CI.
Express 5 is minimal and teaches you the mechanics because you assemble everything yourself; Fastify is a similar choice with schema validation built in; NestJS is structured and opinionated, closer in spirit to Laravel's conventions. Around the framework you will choose an ORM or query builder (Prisma, Drizzle, Knex), a validation library, an auth approach, and a job runner. Note that popular Node job queues such as BullMQ require Redis, which changes the infrastructure discussion later in this article.
import express from "express";
const app = express();
app.use(express.json({ limit: "100kb" })); // bound the body size
app.post("/orders", requireUser, async (req, res) => {
const input = parseOrder(req.body); // your validation: throws 422
await assertCan(req.user, "create", "order"); // your policy: throws 403
const order = await orders.create({ ...input, userId: req.user.id });
res.status(201).location(`/orders/${order.id}`).json(order);
});
// Express 5 forwards rejected promises here; declare all four arguments.
app.use((err, req, res, next) => {
const status = err.status ?? 500;
if (status >= 500) logger.error({ err, path: req.path });
res.status(status).json({ message: status < 500 ? err.message : "Internal error" });
});Error handling: loud inside, polite outside
Separate two kinds of failure. Expected errors — invalid input, missing resource, conflict, forbidden — get a specific 4xx status and a message the client can act on. Unexpected errors — bugs, a database that is down, a third-party timeout — get a generic 500 or 503 for the client and full detail in your logs, tied together by a request ID. The OWASP Top 10:2025 added a category for exactly this, Mishandling of Exceptional Conditions.
- Never leak stack traces, SQL, or file paths in production responses. In Laravel that means
APP_DEBUG=false; in Node, an error handler that returns a generic body for 5xx. - Handle errors centrally — one exception handler or error middleware — so every endpoint fails in the same shape.
- Do not swallow exceptions with an empty
catch. If you catch, either handle it fully or rethrow with context. - Fail closed: if a permission check throws, deny. Put timeouts on every outbound call, and retry with backoff only operations that are safe to repeat.
- In Node, an unhandled promise rejection terminates the process by default. Run under a supervisor that restarts it, and find out why it happened.
Background jobs, queues, and scheduled work
Once you can read and write data reliably, the next layer is behavior over time. Anything slow or unreliable — sending email, generating exports, resizing images, calling a third-party API — should leave the request: respond quickly, do the work in a background job, retry on failure. You do not need new infrastructure to start. In a new Laravel application the default queue connection is the database, run by php artisan queue:work under a process supervisor; Node has database-backed options too, such as pg-boss on PostgreSQL.
- Make jobs idempotent. Workers retry after crashes and timeouts, so a job may run more than once.
- Dispatch after commit. A job queued inside a transaction can run before the commit and find no data. Laravel's
afterCommit()(or the connection'safter_commitoption) waits for the commit and discards the job on rollback. - Pass identifiers, not snapshots. Load fresh data when the job runs; Laravel already serializes Eloquent models by ID for this reason.
- Bound every job: maximum attempts, a timeout, backoff between retries, and a failed-jobs table someone actually watches.
- Scheduled tasks need answers to two questions: what happens if a run overlaps the previous one (Laravel's scheduler has
withoutOverlapping()), and what happens if it fails silently.
Caching: a trade, not a free speed-up
A cache is a copy, and every copy can be stale. Before caching, measure and fix the cause: a missing index or an N+1 loop is better removed than hidden. Cache what is expensive to compute, read often, changed rarely, and tolerant of being slightly out of date — a public product listing, a dashboard aggregate, a rendered settings payload. Do not cache values that must be exact at the moment of use, such as balances or stock, and never cache per-user data under a shared key.
- HTTP caching first:
Cache-ControlandETaglet browsers and CDNs avoid the request entirely. It is the cheapest cache you will ever run. - Application cache second: in Laravel,
Cache::remember()on the default database or file store is enough for a single server. - Invalidation is the real cost. A time-to-live is simple and tolerates staleness; explicit invalidation is fresher but every write path must remember to do it. When a hot key expires, many requests may recompute it at once — a stampede — which locks or early refresh prevent.
$stats = Cache::remember(
"team:{$team->id}:dashboard-stats", // scoped key: never shared across teams
now()->addMinutes(10), // staleness you have decided to accept
fn () => $team->computeDashboardStats(),
);Redis, brokers, and microservices: when they earn their cost
Every piece of infrastructure is another thing to deploy, secure, monitor, back up, and reason about when it fails at 3 a.m. Add it when a specific requirement appears, not because a diagram on social media had it. A useful rule: write down the requirement and the metric that proves it before you install anything.
- Redis (or a similar in-memory store) becomes justified when several app instances must share fast state — cache, rate-limit counters, locks, sessions — or when the database-backed cache or queue shows up as measurable load. In the Node ecosystem it often arrives earlier because the popular job queues depend on it. The cost: another service to size, secure, and keep available, and a decision about what happens when it is down.
- A message broker (RabbitMQ, Kafka, and similar) is justified when several independent consumers need the same events, when you need durable fan-out or replay, or when throughput outgrows a database-backed queue. The cost: at-least-once delivery means duplicates and idempotent consumers, ordering guarantees to understand, message schemas to version, and a cluster to operate.
- Microservices are justified when independent teams need to deploy independently, or when parts of the system have genuinely different scaling or reliability needs. They are an organizational tool, not a way to tidy code. The cost: network calls that fail, no transactions across services, distributed tracing, versioned contracts, and many more deployments. A modular monolith — clear module boundaries inside one deployable application — delivers most of the structure at a fraction of the price.
Security you cannot skip
Most breaches are not exotic. They come from a short list of well-understood mistakes: trusting user input, exposing more data than intended, and getting access control wrong. The current edition of the OWASP Top 10 is the 2025 list: Broken Access Control, Security Misconfiguration, Software Supply Chain Failures, Cryptographic Failures, Injection, Insecure Design, Authentication Failures, Software or Data Integrity Failures, Security Logging and Alerting Failures, and Mishandling of Exceptional Conditions. Read it once end to end; then build these habits.
- Validate every input on the server against an allowlist of types, ranges, and sizes. Client-side validation is a convenience, never a defense.
- Use parameterized queries. String-concatenated SQL is how injection happens. Query builders parameterize for you; raw SQL needs bound parameters (
DB::select('... where email = ?', [$email])), never interpolation. See the SQL Injection Prevention Cheat Sheet. - Block mass assignment. Never pass the whole request body to a model:
$request->all()in Laravel or{ ...req.body }into an ORM in Node lets a client setis_adminoruser_id. Fill only validated fields, and allowlist fillable attributes on the model (#[Fillable([...])]in Laravel 13). See the Mass Assignment Cheat Sheet. - Escape output. Blade's
{{ }}and React's JSX escape by default;{!! !!}anddangerouslySetInnerHTMLdo not. Return only the fields a client needs — API resources and serializers exist partly for this. - Keep secrets out of the repository.
.envstays out of git; production secrets live in your host's secret store; each environment gets its own keys; a leaked key is rotated, not just deleted from history. - Own your supply chain. Commit lockfiles, run
composer auditandnpm auditin CI, keep dependencies few and updated, and know what your application actually pulls in. - Treat uploads as hostile. Check type by content, cap the size, store outside the web root under generated names, and never trust the original filename.
- Rate-limit login, password reset, and expensive endpoints, and log security events — failed logins, permission denials — without ever logging passwords or tokens.
Testing against the real thing
Unit tests cover pure logic: a price calculation, a discount rule. Integration tests cover code that touches the database or another system. Feature tests send real HTTP requests through routing, middleware, validation, authorization, and the database, then assert on the status code and the resulting rows. For backend work, feature tests usually buy the most confidence per line, because most backend bugs live in the seams between those layers.
Run them against the same database engine you use in production — PostgreSQL or MySQL in Docker or as a CI service. In-memory SQLite is fast, but its types, constraints, and locking differ, so a suite can pass while a migration fails on the real engine. Laravel's RefreshDatabase trait wraps each test in a transaction so it stays fast. In Node, the built-in node:test runner has been stable since Node.js 20; pair it (or Vitest) with an HTTP testing helper and a disposable database. Mock only what you do not own — the payment provider, the mail service — at the boundary.
use App\Models\Order;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Sanctum\Sanctum;
pest()->use(RefreshDatabase::class);
test("a user cannot read someone else's order", function () {
$order = Order::factory()->create(); // owned by another user
Sanctum::actingAs(User::factory()->create());
$this->getJson("/api/orders/{$order->id}")->assertForbidden();
});- Authorization: another user's resource returns 403 (or 404 if you hide existence).
- Validation: bad input returns 422 and writes nothing.
- Happy path: 201 and exactly the expected rows in the database.
- Idempotency: the same key sent twice creates one record.
- Migrations: the full set runs on an empty database in CI.
Deployment and observability
Code that only runs on your machine is not finished. The operational layer is what turns working code into a running service. You do not need all of it on day one, but avoiding it indefinitely puts a hard ceiling on what you can take responsibility for.
A boring, repeatable deploy
- CI runs the test suite on every push; nothing reaches production without passing it.
- Configuration comes from the environment, never from code edited on the server.
- Migrations run as an explicit deploy step and stay backward-compatible with the code still running.
- Queue workers and Node processes run under a supervisor (systemd, Supervisor, or your platform's equivalent) and restart on deploy.
- Runtimes stay on supported versions — an LTS line of Node, a PHP branch that still receives security fixes — and you know how to roll back.
Seeing what production does
- Logs: structured (JSON), with a request ID and user ID on every line, and never passwords, tokens, or full card numbers.
- Metrics: request rate, error rate, latency percentiles, queue depth and job age, database connections. Averages hide the slow requests your users feel.
- Error tracking: a service that groups exceptions, shows the stack trace and request context, and alerts you before a user writes in.
- Health checks: a cheap liveness endpoint (the process is up) and a readiness check (it can reach the database), without exposing internals.
Backups you have actually restored
An untested backup is a hope. Automate database backups, store them off the server and encrypted, use point-in-time recovery where your database supports it, and schedule a restore drill into a fresh environment. Answer two questions in plain words before an incident forces you to: how much data can we afford to lose, and how long can we be down?
Architecture patterns — SOLID, clean architecture, service layers, repositories — belong at the end of this list on purpose. They are answers to problems of scale and change. Applied to a small application before those problems exist, they add indirection and cost without buying anything. Build something real first; the patterns will make sense when you feel the pain they address.
Common mistakes
- Checking that a user is logged in, but not that the record belongs to them.
- Read-then-write logic in application code where an atomic update or a constraint belongs.
- Returning
200for errors, or500for a client's bad input. - Passing the entire request body into a model.
- Learning the ORM without learning SQL, then being unable to diagnose a slow page.
- Adding Redis, a broker, or microservices before measuring a problem they solve.
- Doing slow work inside the request, or blocking Node's event loop with synchronous CPU work.
- Testing only against SQLite or mocks, then meeting the real database for the first time in production.
- Having backups but never restoring one.
A staged roadmap with projects
Each stage ends with something you can show. Move on when the project works and you can explain every decision in it, not when a course ends. If the basics of one language, Git, and the terminal are still shaky, start with programming fundamentals and the beginner roadmap.
Stage 1 — HTTP and SQL, with little magic
Learn HTTP from MDN, write SQL by hand against PostgreSQL or MySQL, design a small schema with constraints. Build: a notes or bookmarks JSON API with correct methods and status codes, pagination, and a consistent error shape. Test it with an HTTP client, not a browser.
Stage 2 — A framework, auth, and ownership
Pick Laravel or Node and learn its routing, validation, ORM, and authentication. Build: a multi-user task or booking app where users can only see and change their own data, with policies, Form Requests or a validation library, eager loading, and feature tests for 401, 403, and 422.
Stage 3 — Data integrity under concurrency
Study transactions, isolation, and locking. Build: a small shop or event-ticketing API with limited stock, an idempotent checkout endpoint, and a test that fires concurrent purchases at the last item and proves only one succeeds. Add a migration that renames a column using expand and contract.
Stage 4 — Background work and caching
Add queues and scheduling on the database driver. Build: CSV export and email notifications as jobs dispatched after commit, a nightly cleanup task protected against overlap, and one cached report — with a before-and-after measurement that justifies the cache.
Stage 5 — Ship and operate it
Deploy one of your projects to a Linux server or a managed platform with HTTPS, CI that runs the tests, migrations as a deploy step, supervised workers, structured logs, error tracking, a health check, and automated backups. Then restore a backup into a fresh database and write down how long it took.
Stage 6 — Scale only what you have measured
Load-test the Stage 3 or 5 project, find the first real bottleneck, and fix it with the cheapest change — usually a query or an index. Only when a requirement from the infrastructure section appears, add Redis, a second instance, or a broker, and document what it cost you.
Official resources worth your time
- HTTP: MDN HTTP guide and the specification itself, RFC 9110.
- Databases: PostgreSQL documentation, especially Transaction Isolation, and the MySQL documentation.
- PHP and Laravel: the PHP manual, supported PHP versions, and the Laravel 13 documentation, starting with Authorization and Queues.
- Node.js: the API documentation, the release schedule, and the Express guide.
- Security: the OWASP Top 10:2025 and the OWASP Cheat Sheet Series, particularly Authorization, Password Storage, and Input Validation.
Next steps
- This week: design a schema for a small domain on paper, with keys and constraints, and create it in PostgreSQL or MySQL by hand.
- Pick Laravel or Node using the trade-offs above, and commit to it until Stage 3 is done.
- Write the cross-user authorization test before you write the endpoint it protects.
- Deploy something small early, even if it is ugly. Operating it teaches what tutorials cannot.
Backend skill is not measured by how many tools you have installed. It is measured by whether your data stays correct when requests collide, whether only the right people can touch it, and whether you notice and recover when something breaks. Learn those through one framework, ship real projects, and the next framework will take weeks rather than months.




