docs: add Scalar API Reference documentation page (156 pages)

swadhinbiswas committed 3 months ago
9722fa7
1 parent d0f8f5d
commit 9722fa7
2 files changed
+81 -0
▼docs_site/astro.config.mjs
+1-0
165
165
{ label: 'Background Tasks', link: 'tutorials/background-tasks/' },
166
166
{ label: 'Metadata & Docs URLs', link: 'tutorials/metadata/' },
167
167
{ label: 'Static Files', link: 'tutorials/static-files/' },
168
+ { label: 'Scalar API Reference', link: 'tutorials/scalar-ui/' },
168
169
{ label: 'Testing', link: 'tutorials/testing/' },
169
170
{ label: 'Debugging', link: 'tutorials/debugging/' },
170
171
],
171
172
▼docs_site/src/content/docs/tutorials/scalar-ui.md
+80-0
1
+---
2
+title: Scalar API Reference
3
+description: Use Scalar as an alternative API documentation UI in JustAPI — modern, fast, and developer-friendly.
4
+keywords: [JustAPI, Scalar, API reference, documentation, Swagger alternative]
5
+---
6
+
7
+JustAPI includes [Scalar](https://scalar.com/) as a built-in API documentation UI alongside Swagger UI and ReDoc.
8
+
9
+## Accessing Scalar
10
+
11
+Start your app and open:
12
+
13
+```
14
+http://localhost:8000/scalar
15
+```
16
+
17
+Scalar provides a clean, modern interface for exploring and testing your API.
18
+
19
+## All Three Docs UIs
20
+
21
+JustAPI serves three documentation UIs out of the box:
22
+
23
+| URL | UI | Description |
24
+|-----|-----|-------------|
25
+| `/docs` | Swagger UI | Classic interactive docs |
26
+| `/redoc` | ReDoc | Clean, readable reference |
27
+| `/scalar` | Scalar | Modern, fast, developer-friendly |
28
+
29
+## Configure Scalar URL
30
+
31
+```python
32
+from justapi import JustAPIApp
33
+
34
+app = JustAPIApp(
35
+ scalar_url="/scalar", # default
36
+ docs_url="/docs", # Swagger UI
37
+ redoc_url="/redoc", # ReDoc
38
+)
39
+```
40
+
41
+Set any URL to `None` to disable:
42
+
43
+```python
44
+app = JustAPIApp(
45
+ scalar_url=None, # disable Scalar
46
+ docs_url=None, # disable Swagger UI
47
+ redoc_url="/redoc",
48
+)
49
+```
50
+
51
+## Scalar vs Swagger UI vs ReDoc
52
+
53
+| Feature | Scalar | Swagger UI | ReDoc |
54
+|---------|--------|------------|-------|
55
+| Speed | Fast | Medium | Medium |
56
+| Design | Modern, minimal | Classic | Clean, readable |
57
+| Try-it-out | Yes | Yes | No |
58
+| Auth testing | Yes | Yes | No |
59
+| Dark mode | Yes | No | No |
60
+| Schema download | Yes | Yes | Yes |
61
+
62
+## Admin Token Protection
63
+
64
+When `admin_token` is set, `/scalar` is protected:
65
+
66
+```python
67
+app = JustAPIApp(admin_token="my-secret-token")
68
+```
69
+
70
+Include the token in requests:
71
+
72
+```bash
73
+curl -H "Authorization: Bearer my-secret-token" http://localhost:8000/scalar
74
+```
75
+
76
+## See Also
77
+
78
+- [Metadata & Docs URLs](/tutorials/metadata/) — configuring doc endpoints
79
+- [Configure Swagger UI](/how-to/configure-swagger-ui/) — Swagger customization
80
+- [API Reference](/api-reference/) — full API reference
0
81