You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+262-2Lines changed: 262 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,8 @@ And more — see [feature list](https://duckframework.com/features)
75
75
10.**Complete Reverse Proxy Server** – **Duck** only acts as reverse proxy for Django only. Need to make Duck a full-fledged reverse proxy server with optional sticky sessions.
76
76
11.~~**Component Mutation Observer** – Need to build an optional component mutation observer for keeping track of child changes for fastest re-render (approx. 75x fast on unchanged children).~~
77
77
12.**MCP (Model Context Protocol) Server** – Need to make it easy for creating MCP servers for easy AI communication.
78
-
13.**...and more** – [Request a feature](./feature_request.md)
78
+
13.**JWT (JSON-based Web Token) Authentication ** – Need to add JWT authentication persistent logins.
79
+
14.**...and more** – [Request a feature](./feature_request.md)
79
80
80
81
---
81
82
@@ -145,6 +146,265 @@ This starts the server at **http://localhost:8000**
145
146
146
147
---
147
148
149
+
## Understanding the Project
150
+
151
+
Duck generates a set of files and directories as you build your application. This section walks through the core ones you'll interact with most.
152
+
153
+
---
154
+
155
+
### `web/main.py`
156
+
157
+
The entry point for your Duck application. You can run it directly with `python web/main.py`, or use the `duck runserver` command instead.
158
+
159
+
```py
160
+
#!/usr/bin/env python
161
+
"""
162
+
Main script for creating and running the Duck application.
Defines the URL routes for your application. Each route maps a static or dynamic path to a **view** — a callable that handles incoming requests for that path.
178
+
179
+
By default, `urlpatterns` is an empty list. Add your own routes to wire up the app.
An optional file for organising your view functions. Import it as a module in `urls.py` to keep your routes clean.
219
+
220
+
```py
221
+
# web/urls.py
222
+
from duck.urls import path
223
+
from . import views
224
+
225
+
urlpatterns = [
226
+
path('/', views.home, name="home"),
227
+
]
228
+
```
229
+
230
+
---
231
+
232
+
### `web/ui/`
233
+
234
+
Contains all frontend logic — components, pages, templates, and static files.
235
+
236
+
---
237
+
238
+
#### `web/ui/pages/`
239
+
240
+
Duck recommends building UI with **Pages** — Python classes that represent full HTML pages. Pages unlock the [Lively Component System](https://docs.duckframework.com/main/lively-components), which enables fast navigation and real-time interactivity without JavaScript or full page reloads.
241
+
242
+
**What is an HTML Component?**
243
+
244
+
A component is a Python class that represents an HTML element. You configure it with props and style, then render it to HTML.
Duck ships with many built-in components — `Button`, `Navbar`, `Modal`, `Input`, and more — available under `duck.html.components`.
259
+
260
+
**Creating Pages**
261
+
262
+
Subclass `duck.html.components.page.Page` to create a page. The recommended pattern is a `BasePage` that defines the shared layout, with individual pages overriding only what they need.
263
+
264
+
```py
265
+
# web/ui/pages/base.py
266
+
from duck.html.components.container import FlexContainer
0 commit comments