r/Backend • • 8h ago

Need Guidance

4 Upvotes

Context:

I'm building a backend-only "chat app" as a portfolio project in nodejs. Up until now i have been building apps in Nextjs. Front-end is not my strong suit and i have enjoyed backend mostly, though i am still average in it.

I haven't figured out the complete roadmap yet. I started by looking into authentication and immediately got confused by the trade-offs. I narrowed it down to four options:

  • Cookies for web, Bearer tokens for mobile
  • Access JWT + refresh tokens (with rotation and reuse detection)
  • Better Auth's OAuth provider plugin for proper token rotation
  • A single opaque session token sent as Authorization: Bearer (using Better Auth's bearer plugin) with server-side sessions for both web and mobile.

discussed these with gemini and claude and they both recommended the last one.

Does the single opaque Bearer token approach make sense for a backend-only chat app (including authenticating WebSockets), or would you recommend one of the other options?

What should the complete roadmap look like for a portfolio-worthy backend chat app? (Architecture, database schema, real-time layer, testing, scaling, API docs, etc.)

I'm open to any critique or harsh advice, just looking for real guidance.


r/Backend • • 3h ago

My experience with laravel (go) so far.

Thumbnail
reddit.com
1 Upvotes

r/Backend • • 23h ago

Scheduling tasks in production

12 Upvotes

I have a FastAPI with Postgres db app in production running on several instances behind a load balancer. Users can schedule some API external call to get some data to run at a specific date and time. These are one-off jobs, not recurring ones.

What I need:
• ⁠A job never runs before its scheduled time. A few seconds late is fine.
• ⁠A job runs once, not once per instance.
• ⁠Jobs survive restarts and deploys.
• ⁠Users can update or cancel a job, and that takes effect no matter which instance handles the request.

What I've considered:

  1. ⁠APScheduler inside the app. This breaks with multiple instances. Each instance keeps its own jobs in memory, so on startup every instance reloads the pending jobs and they all fire. An update that lands on instance B can't change the job held by instance A. As far as I can tell, APScheduler 3.x also doesn't support several schedulers sharing one job store.
  2. ⁠Celery with eta/countdown. I've read that jobs scheduled for a future time sit in the worker's memory, and that with Redis they can be delivered again after the timeout (1 hour by default). That sounds risky for jobs scheduled hours or days ahead. Cancelling also means keeping the database and the queue in sync.
  3. ⁠Postgres as the queue. Store jobs as rows, and have a separate worker poll every second or so with UPDATE … WHERE id IN (SELECT … WHERE status='pending' AND run_at <= now() FOR UPDATE SKIP LOCKED) RETURNING …. Updating or cancelling a job is then just a row update. This is my current favourite, but I'm not sure whether to write it myself or use something like Procrastinate.
  4. ⁠A managed scheduler (AWS EventBridge Scheduler, Google Cloud Tasks). I'd have nothing to run myself, but I'd have to keep my database and the scheduler in sync whenever a job is updated or cancelled.

Questions:
• ⁠What do you use for this in production, and how has it held up?
• ⁠If you went with Postgres as the queue: did you write the worker yourself or use a library? How do you handle a worker crashing mid-job and leaving it stuck as "running"?
• ⁠Is there a clean way to keep the scheduler inside the FastAPI process, or is a separate worker the standard answer?
• ⁠How can I cache the data if the job can never run before its scheduled time?

Thanks!


r/Backend • • 1d ago

At first I was reading books /watch tutorials about programming

5 Upvotes

Now I am reading directly randomly apps code base to learn coding and new concepts . Do you still read books ?


r/Backend • • 1d ago

js/ts dev adding devops, should i learn go or rust in the ai era?

Thumbnail reddit.com
2 Upvotes

r/Backend • • 1d ago

Building a backend-as-a-service on TiDB instead of Postgres (like Supabase): does the case hold up?

6 Upvotes

I work on a backend-as-a-service and we're weighing TiDB as the core database instead of Postgres, which Supabase is built on. I'd like to hear from people who've run TiDB in production.

Why TiDB appeals to us:
Writes scale horizontally without hand-sharding
TiFlash runs analytics on live data, so no separate warehouse
MySQL compatibility, so existing drivers and ORMs work
Resource control for isolating noisy tenants

Where I'm unsure:
Supabase leans on Postgres features like row-level security, LISTEN/NOTIFY for realtime, and extensions like PostGIS. As far as I can tell TiDB has no RLS, so auth rules would live in our API layer.
Latency on small transactions versus a single Postgres node
Cost and overhead for lots of small tenants

Has anyone built multi-tenant SaaS on TiDB? Where did it beat Postgres, and where did it hurt?


r/Backend • • 2d ago

Rate Limiting Explained: Token Bucket vs Leaky Bucket vs Sliding Window

Thumbnail
javarevisited.substack.com
32 Upvotes

r/Backend • • 2d ago

How do you properly handle exceptions in a layered backend architecture?

20 Upvotes

I'm learning backend development using FastAPI, PyMySQL, and MySQL. I'm struggling to understand where to catch, raise, and propagate exceptions across my database, repository, service, and router layers.

For example, how should I handle unexpected database connection loss or server shutdown? Which layer should handle it, and which exceptions should each layer be responsible for?

I've been using ChatGPT to learn, but whenever I ask about standards and best practices, it keeps changing its recommended implementation. It's become difficult to distinguish established practices from architectural preferences.

I'd appreciate insights from experienced backend developers on how you handle exceptions in production, the reasoning behind your decisions, and reliable learning resources.

I want to understand the engineering principles rather than simply copy working code.


r/Backend • • 2d ago

What took 190 µs out of this Django-Bolt request?

2 Upvotes

I measured CPU per request on one endpoint returning 10 PostgreSQL rows as JSON. With Django-Bolt 0.13.0 it took 416 µs. Recording the SQL at startup brought that down to 226 µs. The endpoint still hit PostgreSQL on every request. Same response bytes, one process, one laptop in Docker.

I maintain quickset, the add-on I measured. Both paths are in make bench-released. Has anyone profiled query construction separately from database time on a similarly small endpoint? I used AI to help build quickset and edit this post. https://github.com/YasserShkeir/quickset


r/Backend • • 2d ago

I benchmarked the 4 Laravel Octane servers (PAM, FrankenPHP, Swoole, RoadRunner) on the same app, here's what the numbers actually show

2 Upvotes

context first: I maintain PAM, a PHP app server, and I'm proposing it as a driver for Laravel Octane. Before opening that conversation I wanted evidence that I could reproduce, not just "trust me it's fast". So I built a benchmark repo where all four Octane servers serve the exact same Laravel app.

First thing was correctness, not speed. I ran Octane's own test suite with the PAM integration: 238 tests, 195 pass, 0 fail, 43 skipped (they're Swoole-only and there's no swoole extension on PAM's PHP). Then I swapped Octane's FakeClient for one that pushes every request/response through the PAM client too and compares status, body and cookies with what Laravel produced. 112 exchanges, 0 mismatches. Octane's own CI on that commit is green too (21 test jobs, PHP 8.2 to 8.5, Laravel 12 and 13).

Throughput: I used wrk on 4 endpoints (hello, json, db, view) and took the median of 5 rounds, rotating the server order each round. PAM had the highest median rps on every endpoint, 7.2% (db) to 13.9% (hello) above FrankenPHP, 26 to 36% above Swoole and 70 to 77% above RoadRunner. On hello, for example, it was 11,191 vs 9,826 vs 8,310 vs 6,323.

but ngl the latency part is less clean, and I think is more interesting. FrankenPHP is steadier, its p99 stays within ~1.6 ms across rounds on every endpoint. PAM's p99 jumps around more between rounds (7.46 to 13.94 ms on hello). On db, FrankenPHP's median p99 (12.77 ms) beats PAM's (14.48 ms), and Swoole has the lowest db p99 of all (10.27 ms). PAM's median p99 is the lowest on hello, json and view. So "fastest" kinda depends of what you're measuring.

What went wrong: the machine was noisy. It never stayed idle for 5 minutes within 3 hours, so the run started at a load of 4 and during the run the load sat at 12 to 17 instead of 10 to 12 like the previous run. All servers ran under the same conditions, but tbh I'd treat the numbers as relative only, on that machine. The load log is in the repo.

The part I'm happiest with is the post-boot zygote. Instead of booting Laravel in every worker, PAM can boot the app once and fork workers from it, so they share that memory copy-on-write. On Octane's PAM worker with 8 workers, spawn to ready goes from 226 ms (pre-boot) to 2 ms, and SIGHUP reload from 285 ms to 222 ms. Memory (sum of PSS, 8 workers): 200 MiB post-boot vs 233 pre-boot, FrankenPHP 316, Swoole 307, RoadRunner 594. Cold start is about the same in both modes, since the zygote still boots the app once and then forks.

There's also zero-loss reload/recycling under load, the 504 request timeout and upload memory in there. Every number links to the raw output, and please run it on your own hardware, I'm curious if the p99 variance shows up for you too.

https://github.com/push-in/octane-benchmarks


r/Backend • • 2d ago

If I want to increase my skills, how much of the code should I be writing myself during this process?

13 Upvotes

I differentiate finishing my work tasks, which is simply more convenient to do using llms, and learning in my spare time to grow my skills. I want to reach the level of senior backend engineers, and want to understand how to go about this process.

Does mastering the basics go so much better when writing code myself? Or have the times and workflows changed so much that is better to learn "natively" with AI assistance from the get go?

Also, any tips for improving your skills in general are welcome.


r/Backend • • 2d ago

New Freelancer Struggling to Gain Clients' Trust – Need Advice!

8 Upvotes

I'm a web developer, and I've made around 150 cold calls so far, out of which I've managed to book only 5 client meetings.

One of the most common objections I receive is:

"You don't have enough experience. You're new to this field."

I'm getting this feedback from multiple potential clients, and I'm not sure how to handle it.

What should I do to overcome this objection and build trust with potential clients?

I'd really appreciate advice from experienced freelancers, web developers, or business owners who have faced a similar situation.

Any tips or suggestions would be helpful!


r/Backend • • 2d ago

MERN vs Python Full Stack in 2027 – Which is better for a fresher in India?

0 Upvotes

Hey everyone!

I'm a third-year CSE student primarily interested in Backend engineering and confused about choosing between MERN Full Stack and Python Full Stack for a free 3-month training programme that also provides placement assistance.

My current skills:

\- Strong fundamentals in Python and JavaScript.

\- Familiar with React.js.

\- Basic knowledge of MERN, but not in-depth.

\- 1-month internship experience, mainly with PHP and JavaScript.

\- 15+ open-source PRs merged/closed. (Worked with typescript)

My primary goal is to become a Backend Developer / Software Engineer.

Initially, I was leaning towards MERN because of my JavaScript and React experience. However, Python is also one of my stronger languages, and I'm wondering which stack currently offers better opportunities for freshers in India.

I'd love to hear from experienced developers:

  1. Which has better fresher hiring opportunities: MERN or Python Full Stack?
  2. Is Python (Django/FastAPI) a better choice for backend-focused roles?
  3. Considering my existing skills, which would you recommend for getting my first developer job in the next 3–6 months?

Looking for practical advice based on actual industry and hiring experience, not just language preferences.

Thanks!


r/Backend • • 3d ago

Test Local Apps on a Real Phone Over Cellular Data

Thumbnail instawormhole.com
1 Upvotes

r/Backend • • 3d ago

Standardising AI coding across my team.... we now auto merge 90% of changes while code quality and compliance holds.

Thumbnail
reddit.com
0 Upvotes

r/Backend • • 3d ago

Need guidance switching from Automation QA to Developer

Thumbnail reddit.com
1 Upvotes

r/Backend • • 4d ago

Need help, I don't like adding ai for my projects

8 Upvotes

So, I am really fascinated with backend. But I just hate adding ai features everywhere. First it demands money (api pricing). Second I don't see any advantages of adding ai to my projects.

so far, I have built my own music store where i sell sample/packs with TS ecosystem, EDA and redis. And I have been building a project that takes up my android phone and puts it as a mountable disk on finder (macOS) thru WebDAV tech wirelessly in pure golang, Kotlin for bypassing mobile restrictions.
Here is the second project stripped down prototype in TS
https://github.com/KhushOS-hub/fileM-Proto
I ran into the bottleneck of TS ecosystem, that made me transition to golang, currently building it in golang.

can you give me some more ideas to build and practice and dive more deep into backend?


r/Backend • • 4d ago

What does it mean to be a good backend developer?

20 Upvotes

A thought crossed my mind. What makes a backend developer "good"? Is it the language of choice? The amount of technologies he/she knows?

Please share your thoughts on thks


r/Backend • • 3d ago

struggling?...we are here for you

0 Upvotes

Hi! I'm currently offering affordable digital services for students and small businesses.

I can help with:

  • Excel and CSV data cleaning
  • Removing duplicate records and organizing spreadsheets
  • PowerPoint presentation formatting
  • PDF to Excel/Word conversion
  • Basic Python tutoring

If you or someone you know needs help with any of these, feel free to message me. I'll be happy to discuss the requirements and provide a reasonable price.


r/Backend • • 4d ago

Comparing Laravel Go and Arkoren

Thumbnail
arkoren.dev
2 Upvotes

r/Backend • • 4d ago

my js is mid and i wanna learn backend. stay on node or go python??

4 Upvotes

ok so i'm a cse student and i can do some frontend with js, but let's be honest, my js fundamentals are NOT it. i can build stuff but i don't fully get what's happening under the hood 😭

now i wanna get into backend and i'm stuck between two paths. either i keep going with js and learn node, express, mongo, the whole mern thing, or i start fresh with python and go for fastapi or django. my brain keeps flipping every day. if i pick node, will my weak js hold me back, or will building backend stuff actually fix my js? and if i go python, am i just throwing away the js i already learned? i'm also really into ai/ml so python feels like the smart move long term, but idk if i'm just overthinking it.


r/Backend • • 4d ago

Things to look for in backend programming

Thumbnail reddit.com
1 Upvotes

Well I am currently in 200lvl and i am studying computer science so this semester we are about to learn backend and i am asking what are the things I should look forward to and some sites I should visit


r/Backend • • 5d ago

View Markdown in the terminal like you’re on GitHub

Post image
54 Upvotes

I look at Markdown files a lot for work and prefer to just stay inside the terminal, so this has been a game changer for my flow.

mddog basically works by drawing Markdown as the way GitHub (or Obsidian) shows it, then sends that page to the terminal as image strips. It’s fully interactive, too, so you can select text, click on buttons, etc.

I'm learning a lot about the terminal, Rust, and the kitty graphics protocol throughout this process and having a lot of fun. If you give it a try, let me know how you like it!

Docs: https://mddog.pages.dev (for the full feature set and other installation methods)

Repo: https://github.com/qu8n/mddog