Repository navigation
Dars Framework v1.7.8
Release Notes v1.7.8
Full-Stack SSR DX: backendEntry Defaults, Validation & CLI Backend Runner
Installation
pip install --upgrade dars-frameworkWhat's New
Automatic backendEntry for SSR Projects
When you scaffold a new SSR project with:
dars init my-app --type ssrDars now creates a dars.config.json that includes a default backend entry:
"backendEntry": "backend.api:app"This matches the generated backend/api.py file and makes it trivial to start the FastAPI SSR backend.
Smarter Config Validation for SSR
The dars config validate command has been extended to understand when your project is using SSR:
- Introspects the
entrymodule and inspects:- SPA routes (
app._spa_routes) forRouteType.SSR. - Multipage routes (
app._pages) whose root metadata hasroute_type = RouteType.SSR.
- SPA routes (
- If dynamic detection fails, a fallback static scan looks for
RouteType.SSRin the entry source file. - When any SSR route is detected and
backendEntryis missing indars.config.json, validation now reports:
This app is not going to work because you don't have configured the backendEntry in dars.config.json with your backend entry file.
This prevents half-configured SSR apps where routes are marked as RouteType.SSR but no backend has been wired.
New CLI Command: dars dev --backend
To simplify the SSR development workflow, a new flag was added to the dars dev command:
# Frontend dev (preview + hot reload)
dars dev
# Backend-only dev (SSR/API)
dars dev --backendBehavior:
-
dars dev(no flags):- Resolves
entryfromdars.config.json(defaultmain.py). - Runs the file directly (
python main.py), which is expected to callapp.rTimeCompile(). - Starts the Dars preview server on
http://localhost:8000with hot reload.
- Resolves
-
dars dev --backend:-
Reads
backendEntryfromdars.config.json(e.g."backend.api:app"). -
Starts the FastAPI SSR backend via uvicorn:
python -m uvicorn backend.api:app --reload --host 127.0.0.1 --port 3000
-
If
backendEntryis missing, uses the same validation message asdars config validateto explain that SSR will not work.
-
Result: you can now run a full-stack SSR dev setup with two explicit terminals:
# Terminal 1 - Frontend
dars dev
# Terminal 2 - Backend
dars dev --backendThis keeps logs cleanly separated while still leveraging the built-in hot reload from app.rTimeCompile() and uvicorn's reload system.