r/dartlang • u/BaddiesChaser • Oct 14 '26
Package Server Framework package in dart
https://pub.dev/quadrant_serverAs the title follows i made a dart Package for writing APIs and all without any dependencies. It has middlewares, Routes types, Response immutable models.
Why I did this ?
I saw shelf and frog but for they are kind of confusing. And shelf needs shelf router as a separate package. And syntax too some confusing.
So this Quadrant server minimises the understanding and you can write APIs without any hiccups. We can use shared models for both flutter and this backend ( Your choice completely ). It can serve static files too.
About Deployment:
We need to deploy this in vps with docker ( it will be simple ) or you can directly build service file and initialise with systemd in linux server.
Thankyou.
5
u/vik76 Oct 17 '26
Why not contributing to something like Relic or Serverpod instead. A lot of time is going into those frameworks. For lower level stuff, Relic has a really nice interface, and Serverpod is a complete framework with ORM, great real time interface, offline first sync, etc.
1
u/AhmedZNOUDA Oct 15 '26
Nice work, zero dependencies with CORS, rate limiting, SSE, WebSockets and graceful shutdown built in is a lot for one package. The declarative QuadrantServer(routes: [...]) style is very readable too.
Since you mention Docker on a VPS, two things I’d check for that setup:
Behind a reverse proxy (nginx, Traefik, Caddy), every request reaches the app from the proxy’s IP. Do rateLimit() and ipFilter() key on the socket address, or can they read X-Forwarded-For from a trusted proxy? If it’s the socket address, one busy client could rate-limit everyone. An option like trustedProxies: [...] would cover it.
Graceful shutdown under Docker/systemd. docker stop and systemctl stop send SIGTERM, so close() only helps if the app listens for it. A small snippet in the README would save people a lot of dropped requests during deploys:
ProcessSignal.sigterm.watch().listen((_) async {
await app.close();
exit(0);
});
On shared models with Flutter: I’d put them in a separate pure Dart package with no dart:io import, so the Flutter app (web included) can depend on the models without pulling in the server.