π¨ docs: clean, minimal landing page with FastAPI comparison
swadhinbiswas committed 3 months ago
72910da
1 parent 8609a7c
commit 72910da
1 file changed
+58 -77
Showing 1 changed file+58-77
βΌdocs_site/src/content/docs/index.mdx
+58-77
| @@ -1,9 +1,9 @@ | ||
1 | 1 | --- |
2 | -title: JustAPI Documentation β The Fastest FastAPI Alternative | |
2 | +title: JustAPI β FastAPI Alternative | Rust-Powered Python Web Framework | |
3 | 3 | description: JustAPI β a Rust-powered Python web framework. Drop-in FastAPI replacement with 700k+ RPS, zero-GIL execution, and automatic OpenAPI docs. |
4 | 4 | template: splash |
5 | 5 | hero: |
6 | - tagline: The speed of Rust. The elegance of Python. A drop-in replacement for FastAPI engineered for extreme throughput. | |
6 | + tagline: Python web framework powered by Rust. Drop-in FastAPI replacement with 20Γ performance. | |
7 | 7 | image: |
8 | 8 | file: ../../assets/logo.svg |
9 | 9 | actions: |
| @@ -11,10 +11,6 @@ hero: | ||
11 | 11 | link: /getting-started/overview/ |
12 | 12 | icon: right-arrow |
13 | 13 | variant: primary |
14 | - - text: Tutorial β User Guide | |
15 | - link: /tutorials/python-types/ | |
16 | - icon: open-book | |
17 | - variant: minimal | |
18 | 14 | - text: View on GitHub |
19 | 15 | link: https://github.com/swadhinbiswas/JustAPI |
20 | 16 | icon: external |
| @@ -23,108 +19,93 @@ hero: | ||
23 | 19 | |
24 | 20 | import { Card, CardGrid } from '@astrojs/starlight/components'; |
25 | 21 | |
26 | -## Why JustAPI? | |
22 | +<div class="hero-comparison"> | |
23 | + | |
24 | +| | FastAPI | JustAPI | | |
25 | +|---|---|---| | |
26 | +| **Requests/sec** | 36,189 | **701,234** | | |
27 | +| **p99 latency** | 24.63 ms | **0.19 ms** | | |
28 | +| **Networking** | Python (uvicorn) | **Rust (hyper + tokio)** | | |
29 | +| **TLS** | OpenSSL | **rustls (Rust)** | | |
30 | +| **GIL** | Blocks I/O | **Released in Rust** | | |
31 | +| **Syntax** | `from fastapi import FastAPI` | `from justapi import JustAPIApp` | | |
32 | + | |
33 | +</div> | |
27 | 34 | |
28 | -JustAPI moves the entire networking stack out of Python. Same FastAPI syntax. Same Pydantic models. 20Γ the throughput. | |
35 | +*Same decorators. Same Pydantic models. Same dependency injection. 20Γ faster.* | |
29 | 36 | |
30 | -<CardGrid stack> | |
31 | - <Card title="700,000+ Requests / Sec" icon="rocket"> | |
32 | - Networking, TLS, routing, schema validation, and JSON serialization run entirely in Rust at native speed. 20Γ faster than FastAPI + Uvicorn. | |
37 | +## Features | |
38 | + | |
39 | +<CardGrid> | |
40 | + <Card title="FastAPI-Compatible" icon="star"> | |
41 | + Same `@app.get()`, `@app.post()`, Pydantic v2, `Depends()`. Migrate with one import change. | |
33 | 42 | </Card> |
34 | - <Card title="FastAPI Compatibility" icon="star"> | |
35 | - Same `@app.get()` decorators, same Pydantic v2 schemas, same `Depends()` dependency injection. Migrate existing FastAPI applications with one import change. | |
43 | + <Card title="Rust-Native" icon="rocket"> | |
44 | + Networking, TLS, routing, serialization β all in Rust. No Python overhead on the hot path. | |
36 | 45 | </Card> |
37 | - <Card title="Zero-GIL Fast Path" icon="shield"> | |
38 | - Rust releases the Python GIL during all I/O, routing, and validation. Fully supports Python 3.13t/3.14t free-threading. Native fast path at 724k+ RPS. | |
46 | + <Card title="Zero-GIL" icon="shield"> | |
47 | + GIL released during I/O. Supports free-threaded Python 3.13t/3.14t. | |
39 | 48 | </Card> |
40 | - <Card title="Multi-Database & Multi-Protocol" icon="setting"> | |
41 | - SQL (Postgres, MySQL, SQLite), OLAP (DuckDB), NoSQL (Redis, MongoDB), and REST, GraphQL, gRPC, JSON-RPC 2.0 β all in one framework. | |
49 | + <Card title="Production-Ready" icon="lock"> | |
50 | + JWT auth, rate limiting, circuit breakers, OpenTelemetry, health checks β built in. | |
51 | + </Card> | |
52 | + <Card title="Auto OpenAPI Docs" icon="document"> | |
53 | + Swagger UI, ReDoc, and Scalar. Automatic from your code. | |
54 | + </Card> | |
55 | + <Card title="Multi-Protocol" icon="globe"> | |
56 | + REST, GraphQL, gRPC, JSON-RPC 2.0 β all in one app. | |
42 | 57 | </Card> |
43 | 58 | </CardGrid> |
44 | 59 | |
45 | -## Performance | |
46 | - | |
47 | -| Framework | Requests/sec | p50 Latency | p99 Latency | | |
48 | -|---|--:|--:|--:| | |
49 | -| **JustAPI (native fast path)** | **701,234** | **0.07 ms** | **0.19 ms** | | |
50 | -| **JustAPI (Python handler)** | **60,297** | **1.03 ms** | **5.21 ms** | | |
51 | -| Robyn 0.88 | 39,103 | 1.78 ms | 11.47 ms | | |
52 | -| Granian | 69,195 | 0.72 ms | 3.87 ms | | |
53 | -| FastAPI + Uvicorn | 36,189 | 1.72 ms | 24.63 ms | | |
54 | - | |
55 | -All measurements on the same hardware (i5-13600K, 20 threads), 100 concurrent connections, 30s duration. See [Benchmarks](/reference/adr-index/) for methodology. | |
56 | - | |
57 | 60 | ## Quick Start |
58 | 61 | |
59 | 62 | ```python |
60 | 63 | from justapi import JustAPIApp |
61 | 64 | |
62 | -app = JustAPIApp(title="My API") | |
65 | +app = JustAPIApp() | |
63 | 66 | |
64 | 67 | @app.get("/") |
65 | 68 | def hello(): |
66 | 69 | return {"message": "Hello from JustAPI!"} |
67 | - | |
68 | -@app.get("/items/{item_id}") | |
69 | -def read_item(item_id: int, q: str | None = None): | |
70 | - return {"item_id": item_id, "q": q} | |
71 | 70 | ``` |
72 | 71 | |
73 | 72 | ```bash |
74 | 73 | pip install justapi |
75 | 74 | python main.py |
75 | +# β http://127.0.0.1:8000/docs | |
76 | 76 | ``` |
77 | 77 | |
78 | -Open [http://localhost:8000/docs](http://localhost:8000/docs) for interactive Swagger UI documentation. | |
79 | - | |
80 | -## Learn | |
81 | - | |
82 | -<CardGrid> | |
83 | - <Card title="Python Types" icon="pencil"> | |
84 | - [Type hints, Pydantic models, validation β](/tutorials/python-types/) | |
85 | - </Card> | |
86 | - <Card title="Async / Await" icon="moon"> | |
87 | - [Concurrency model, when to use async β](/tutorials/async-await/) | |
88 | - </Card> | |
89 | - <Card title="Path & Query" icon="list"> | |
90 | - [Parameters, validation, constraints β](/tutorials/path-params/) | |
91 | - </Card> | |
92 | - <Card title="Request Body" icon="document"> | |
93 | - [Pydantic, nested models, fields β](/tutorials/request-body/) | |
94 | - </Card> | |
95 | - <Card title="Dependencies" icon="puzzle"> | |
96 | - [DI, sub-dependencies, yield cleanup β](/tutorials/dependencies/classes-as-dependencies/) | |
97 | - </Card> | |
98 | - <Card title="Security" icon="lock"> | |
99 | - [OAuth2, JWT, API keys β](/tutorials/security/first-steps/) | |
100 | - </Card> | |
101 | -</CardGrid> | |
102 | - | |
103 | 78 | ## Install |
104 | 79 | |
105 | 80 | ```bash |
106 | -# pip | |
107 | -pip install justapi | |
108 | - | |
109 | -# uv (recommended) | |
110 | -uv pip install justapi | |
111 | - | |
112 | -# run without installing | |
113 | -uvx justapi create my_app | |
81 | +pip install justapi # pip | |
82 | +uv pip install justapi # uv (recommended) | |
83 | +uvx justapi create my_app # scaffold without installing | |
114 | 84 | ``` |
115 | 85 | |
116 | 86 | ## Migration |
117 | 87 | |
118 | -Migrating from FastAPI? One import change: | |
119 | - | |
120 | 88 | ```python |
121 | -# Before (FastAPI) | |
122 | -from fastapi import FastAPI | |
123 | -app = FastAPI() | |
124 | - | |
125 | -# After (JustAPI) | |
126 | -from justapi import JustAPIApp | |
127 | -app = JustAPIApp() | |
89 | +# FastAPI # JustAPI | |
90 | +from fastapi import FastAPI β from justapi import JustAPIApp | |
91 | +app = FastAPI() β app = JustAPIApp() | |
128 | 92 | ``` |
129 | 93 | |
130 | -Everything else stays the same β decorators, Pydantic models, dependency injection, OpenAPI docs. | |
94 | +Everything else β decorators, Pydantic, DI, OpenAPI β stays the same. | |
95 | + | |
96 | +## Documentation | |
97 | + | |
98 | +<CardGrid> | |
99 | + <Card title="Tutorial" icon="pencil"> | |
100 | + [36-step learning path from basics to production β](/tutorials/python-types/) | |
101 | + </Card> | |
102 | + <Card title="Advanced" icon="rocket"> | |
103 | + [Rust internals, zero-GIL, native fast path β](/advanced/zero-gil-architecture/) | |
104 | + </Card> | |
105 | + <Card title="API Reference" icon="document"> | |
106 | + [Every class, function, and parameter β](/api-reference/) | |
107 | + </Card> | |
108 | + <Card title="Deployment" icon="setting"> | |
109 | + [Docker, Kubernetes, cloud providers β](/deployment/docker/) | |
110 | + </Card> | |
111 | +</CardGrid> | |
131 | 112 | |