p0: site infrastructure — full nav, design system, hero component, sitemap

swadhinbiswas committed 3 months ago
88b069e
1 parent 423ee41
commit 88b069e
6 files changed
+384 -12
▼docs_site/astro.config.mjs
+140-6
1
1
import { defineConfig } from 'astro/config';
2
2
import starlight from '@astrojs/starlight';
3
+import sitemap from '@astrojs/sitemap';
3
4
4
5
export default defineConfig({
6
+ site: 'https://justapi.dev',
5
7
integrations: [
6
8
starlight({
7
9
title: 'JustAPI',
10
12
src: './src/assets/logo.svg',
11
13
replacesTitle: false,
12
14
},
13
- social: {
14
- github: 'https://github.com/swadhinbiswas/JustAPI',
15
- },
15
+ social: [
16
+ { icon: 'github', label: 'GitHub', href: 'https://github.com/swadhinbiswas/JustAPI' },
17
+ ],
16
18
customCss: ['./src/styles/custom.css'],
19
+ editLink: {
20
+ baseUrl: 'https://github.com/swadhinbiswas/JustAPI/edit/main/docs_site',
21
+ },
22
+ head: [
23
+ {
24
+ tag: 'meta',
25
+ attrs: { property: 'og:title', content: 'JustAPI — Rust-Powered Python Web Framework' },
26
+ },
27
+ {
28
+ tag: 'meta',
29
+ attrs: { property: 'og:description', content: 'The speed of Rust. The elegance of Python. A drop-in replacement for FastAPI engineered for extreme throughput.' },
30
+ },
31
+ {
32
+ tag: 'meta',
33
+ attrs: { property: 'og:image', content: 'https://justapi.dev/og-image.png' },
34
+ },
35
+ {
36
+ tag: 'meta',
37
+ attrs: { name: 'twitter:card', content: 'summary_large_image' },
38
+ },
39
+ ],
17
40
sidebar: [
18
41
{
19
42
label: 'Getting Started',
20
- autogenerate: { directory: 'getting-started' },
43
+ items: [
44
+ { label: 'Overview & Philosophy', link: 'getting-started/overview/' },
45
+ { label: 'Installation', link: 'getting-started/installation/' },
46
+ { label: 'First Steps', link: 'getting-started/first-steps/' },
47
+ { label: 'CLI Project Scaffolder', link: 'getting-started/cli-scaffolder/' },
48
+ { label: 'Migrating from FastAPI', link: 'getting-started/migrating-from-fastapi/' },
49
+ ],
50
+ },
51
+ {
52
+ label: 'Tutorials',
53
+ items: [
54
+ { label: 'Hello World', link: 'tutorials/hello-world/' },
55
+ { label: 'Path & Query Parameters', link: 'tutorials/path-query-params/' },
56
+ { label: 'Request Body & Validation', link: 'tutorials/request-body/' },
57
+ { label: 'Dependency Injection', link: 'tutorials/dependency-injection/' },
58
+ { label: 'Middleware', link: 'tutorials/middleware/' },
59
+ { label: 'Error Handling', link: 'tutorials/error-handling/' },
60
+ { label: 'File Uploads', link: 'tutorials/file-uploads/' },
61
+ { label: 'WebSockets & SSE', link: 'tutorials/websockets-sse/' },
62
+ { label: 'Database Integration', link: 'tutorials/database-integration/' },
63
+ { label: 'Background Tasks', link: 'tutorials/background-tasks/' },
64
+ { label: 'Routing & Sub-routers', link: 'tutorials/routing-subrouters/' },
65
+ ],
66
+ },
67
+ {
68
+ label: 'API Reference',
69
+ items: [
70
+ { label: 'Overview', link: 'api-reference/' },
71
+ { label: 'JustAPIApp', link: 'api-reference/justapiapp/' },
72
+ { label: 'Routing', link: 'api-reference/routing/' },
73
+ { label: 'APIRouter', link: 'api-reference/apirouter/' },
74
+ { label: 'Request Object', link: 'api-reference/request/' },
75
+ { label: 'Response Classes', link: 'api-reference/responses/' },
76
+ { label: 'Dependency Injection', link: 'api-reference/dependency-injection/' },
77
+ { label: 'Exceptions & Errors', link: 'api-reference/exceptions/' },
78
+ { label: 'Schema & Validation', link: 'api-reference/schema-validation/' },
79
+ { label: 'WebSockets', link: 'api-reference/websockets/' },
80
+ { label: 'Background Tasks', link: 'api-reference/background-tasks/' },
81
+ { label: 'Scheduler', link: 'api-reference/scheduler/' },
82
+ { label: 'Session (Agent)', link: 'api-reference/session/' },
83
+ { label: 'Plugin System', link: 'api-reference/plugins/' },
84
+ { label: 'Testing Client', link: 'api-reference/testing-client/' },
85
+ { label: 'UploadFile', link: 'api-reference/uploadfile/' },
86
+ { label: 'Database', link: 'api-reference/database/' },
87
+ ],
88
+ },
89
+ {
90
+ label: 'Advanced Guides',
91
+ items: [
92
+ { label: 'Zero-GIL Architecture', link: 'advanced/zero-gil-architecture/' },
93
+ { label: 'Rust Core Deep Dive', link: 'advanced/rust-core-deep-dive/' },
94
+ { label: 'PyO3 & FFI Safety', link: 'advanced/pyo3-ffi-safety/' },
95
+ { label: 'Native Fast Path', link: 'advanced/native-fast-path/' },
96
+ { label: 'Multi-Protocol APIs', link: 'advanced/multi-protocol-apis/' },
97
+ { label: 'Agent System', link: 'advanced/agent-system/' },
98
+ { label: 'Streaming Output', link: 'advanced/streaming-output/' },
99
+ { label: 'Performance Tuning', link: 'advanced/performance-tuning/' },
100
+ { label: 'Resilience Patterns', link: 'advanced/resilience-patterns/' },
101
+ ],
21
102
},
22
103
{
23
104
label: 'Deployment',
24
- autogenerate: { directory: 'deployment' },
105
+ items: [
106
+ { label: 'Docker & Docker Compose', link: 'deployment/docker/' },
107
+ { label: 'Kubernetes / Helm', link: 'deployment/kubernetes-helm/' },
108
+ { label: 'Cloudflare Pages', link: 'deployment/cloudflare-pages/' },
109
+ { label: 'Google Cloud (GKE)', link: 'deployment/gke/' },
110
+ { label: 'Amazon EKS', link: 'deployment/eks/' },
111
+ { label: 'Azure AKS', link: 'deployment/aks/' },
112
+ { label: 'Fly.io', link: 'deployment/flyio/' },
113
+ { label: 'Railway', link: 'deployment/railway/' },
114
+ { label: 'Production Checklist', link: 'deployment/production-checklist/' },
115
+ ],
116
+ },
117
+ {
118
+ label: 'Security',
119
+ items: [
120
+ { label: 'Security Policy', link: 'security/policy/' },
121
+ { label: 'OWASP Compliance', link: 'security/owasp-compliance/' },
122
+ { label: 'Penetration Testing', link: 'security/penetration-testing/' },
123
+ { label: 'Secure Configuration', link: 'security/secure-configuration/' },
124
+ ],
125
+ },
126
+ {
127
+ label: 'Observability',
128
+ items: [
129
+ { label: 'Metrics & Monitoring', link: 'observability/metrics-monitoring/' },
130
+ { label: 'OpenTelemetry', link: 'observability/opentelemetry/' },
131
+ { label: 'Structured Logging', link: 'observability/structured-logging/' },
132
+ { label: 'Health Checks', link: 'observability/health-checks/' },
133
+ ],
134
+ },
135
+ {
136
+ label: 'Reference',
137
+ items: [
138
+ { label: 'CLI Reference', link: 'reference/cli/' },
139
+ { label: 'Configuration', link: 'reference/configuration/' },
140
+ { label: 'Release Notes', link: 'reference/release-notes/' },
141
+ { label: 'ADR Index', link: 'reference/adr-index/' },
142
+ { label: 'Error Codes', link: 'reference/error-codes/' },
143
+ { label: 'Glossary', link: 'reference/glossary/' },
144
+ ],
145
+ },
146
+ {
147
+ label: 'Contributing',
148
+ items: [
149
+ { label: 'Development Setup', link: 'contributing/development-setup/' },
150
+ { label: 'Coding Standards', link: 'contributing/coding-standards/' },
151
+ { label: 'Testing Guide', link: 'contributing/testing-guide/' },
152
+ { label: 'Benchmarking Guide', link: 'contributing/benchmarking-guide/' },
153
+ { label: 'Documentation Guide', link: 'contributing/documentation-guide/' },
154
+ ],
155
+ },
156
+ {
157
+ label: 'Examples',
158
+ link: 'examples/',
25
159
},
26
160
],
27
-
28
161
}),
162
+ sitemap(),
29
163
],
30
164
});
31
165
▼docs_site/package-lock.json
+5-5
1
1
{
2
- "name": "docs_site",
3
- "version": "1.0.0",
2
+ "name": "justapi-docs",
3
+ "version": "2.0.0",
4
4
"lockfileVersion": 3,
5
5
"requires": true,
6
6
"packages": {
7
7
"": {
8
- "name": "docs_site",
9
- "version": "1.0.0",
10
- "license": "ISC",
8
+ "name": "justapi-docs",
9
+ "version": "2.0.0",
11
10
"dependencies": {
11
+ "@astrojs/sitemap": "^3.7.3",
12
12
"@astrojs/starlight": "^0.41.4",
13
13
"astro": "^7.1.3"
14
14
}
15
15
▼docs_site/package.json
+1-0
10
10
"astro": "astro"
11
11
},
12
12
"dependencies": {
13
+ "@astrojs/sitemap": "^3.7.3",
13
14
"@astrojs/starlight": "^0.41.4",
14
15
"astro": "^7.1.3"
15
16
}
16
17
▼docs_site/src/components/JustAPIHero.astro
+129-0
1
+---
2
+import starlight from '@astrojs/starlight';
3
+---
4
+
5
+<div class="justapi-hero">
6
+ <div class="hero-content">
7
+ <h1 class="hero-gradient">JustAPI</h1>
8
+ <p class="hero-tagline">The speed of Rust. The elegance of Python.</p>
9
+ <p class="hero-subtitle">A drop-in replacement for FastAPI engineered for extreme throughput — <strong>700k+ RPS</strong>.</p>
10
+ <div class="hero-actions">
11
+ <a href="/getting-started/overview/" class="hero-button primary">Get Started</a>
12
+ <a href="https://github.com/swadhinbiswas/JustAPI" class="hero-button secondary">View on GitHub</a>
13
+ </div>
14
+ </div>
15
+ <div class="hero-benchmark">
16
+ <div class="bench-stat">
17
+ <span class="bench-value hero-gradient">701,234</span>
18
+ <span class="bench-label">Requests / Sec</span>
19
+ </div>
20
+ <div class="bench-stat">
21
+ <span class="bench-value hero-gradient">0.07 ms</span>
22
+ <span class="bench-label">p50 Latency</span>
23
+ </div>
24
+ <div class="bench-stat">
25
+ <span class="bench-value hero-gradient">0.19 ms</span>
26
+ <span class="bench-label">p99 Latency</span>
27
+ </div>
28
+ </div>
29
+</div>
30
+
31
+<style is:global>
32
+ .justapi-hero {
33
+ text-align: center;
34
+ padding: 4rem 1rem;
35
+ max-width: 900px;
36
+ margin: 0 auto;
37
+ }
38
+
39
+ .hero-content h1 {
40
+ font-size: 3.5rem;
41
+ font-weight: 800;
42
+ margin-bottom: 0.5rem;
43
+ line-height: 1.1;
44
+ }
45
+
46
+ .hero-tagline {
47
+ font-size: 1.5rem;
48
+ color: var(--sl-color-gray-2);
49
+ margin-bottom: 0.5rem;
50
+ }
51
+
52
+ .hero-subtitle {
53
+ font-size: 1.1rem;
54
+ color: var(--sl-color-gray-3);
55
+ margin-bottom: 2rem;
56
+ line-height: 1.6;
57
+ }
58
+
59
+ .hero-actions {
60
+ display: flex;
61
+ gap: 1rem;
62
+ justify-content: center;
63
+ margin-bottom: 3rem;
64
+ flex-wrap: wrap;
65
+ }
66
+
67
+ .hero-button {
68
+ display: inline-block;
69
+ padding: 0.75rem 2rem;
70
+ border-radius: 8px;
71
+ font-weight: 600;
72
+ font-size: 1rem;
73
+ text-decoration: none;
74
+ transition: all 0.2s;
75
+ }
76
+
77
+ .hero-button.primary {
78
+ background: linear-gradient(135deg, #8b5cf6, #3b82f6);
79
+ color: white;
80
+ }
81
+
82
+ .hero-button.primary:hover {
83
+ transform: translateY(-1px);
84
+ box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
85
+ }
86
+
87
+ .hero-button.secondary {
88
+ border: 1px solid var(--sl-color-gray-4);
89
+ color: var(--sl-color-gray-2);
90
+ }
91
+
92
+ .hero-button.secondary:hover {
93
+ border-color: var(--sl-color-accent);
94
+ color: var(--sl-color-accent-high);
95
+ }
96
+
97
+ .hero-benchmark {
98
+ display: flex;
99
+ justify-content: center;
100
+ gap: 3rem;
101
+ flex-wrap: wrap;
102
+ }
103
+
104
+ .bench-stat {
105
+ display: flex;
106
+ flex-direction: column;
107
+ align-items: center;
108
+ }
109
+
110
+ .bench-value {
111
+ font-size: 2rem;
112
+ font-weight: 800;
113
+ }
114
+
115
+ .bench-label {
116
+ font-size: 0.875rem;
117
+ color: var(--sl-color-gray-3);
118
+ text-transform: uppercase;
119
+ letter-spacing: 0.05em;
120
+ margin-top: 0.25rem;
121
+ }
122
+
123
+ @media (max-width: 640px) {
124
+ .hero-content h1 { font-size: 2.5rem; }
125
+ .hero-tagline { font-size: 1.2rem; }
126
+ .hero-benchmark { gap: 1.5rem; }
127
+ .bench-value { font-size: 1.5rem; }
128
+ }
129
+</style>
0
130
▼docs_site/src/content.config.ts
+2-1
1
1
import { defineCollection } from 'astro:content';
2
+import { docsLoader } from '@astrojs/starlight/loaders';
2
3
import { docsSchema } from '@astrojs/starlight/schema';
3
4
4
5
export const collections = {
5
- docs: defineCollection({ schema: docsSchema() }),
6
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
6
7
};
7
8
▼docs_site/src/styles/custom.css
+107-0
10
10
--sl-color-gray-5: #1f2937;
11
11
--sl-color-gray-6: #111827;
12
12
--sl-color-black: #0b0f19;
13
+ --sl-color-orange: #e6522c;
14
+ --sl-color-blue: #3b82f6;
13
15
}
14
16
15
17
[data-theme='dark'] {
22
24
background: linear-gradient(135deg, #e6522c 0%, #8b5cf6 50%, #3b82f6 100%);
23
25
-webkit-background-clip: text;
24
26
-webkit-text-fill-color: transparent;
27
+ background-clip: text;
25
28
}
26
29
27
30
.benchmark-card {
32
35
backdrop-filter: blur(12px);
33
36
margin-bottom: 1.5rem;
34
37
}
38
+
39
+.site-title {
40
+ font-weight: 700;
41
+}
42
+
43
+.content h2 {
44
+ margin-top: 2.5rem;
45
+ border-bottom: 1px solid var(--sl-color-gray-5);
46
+ padding-bottom: 0.5rem;
47
+}
48
+
49
+.content h3 {
50
+ margin-top: 2rem;
51
+}
52
+
53
+.content table {
54
+ font-size: 0.875rem;
55
+}
56
+
57
+.content th {
58
+ background: var(--sl-color-gray-6);
59
+ font-weight: 600;
60
+}
61
+
62
+.content td,
63
+.content th {
64
+ border-color: var(--sl-color-gray-5);
65
+}
66
+
67
+.feature-grid {
68
+ display: grid;
69
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
70
+ gap: 1.5rem;
71
+ margin: 2rem 0;
72
+}
73
+
74
+.feature-card {
75
+ border: 1px solid var(--sl-color-gray-5);
76
+ border-radius: 12px;
77
+ padding: 1.5rem;
78
+ background: var(--sl-color-gray-6);
79
+ transition: border-color 0.2s, transform 0.2s;
80
+}
81
+
82
+.feature-card:hover {
83
+ border-color: var(--sl-color-accent);
84
+ transform: translateY(-2px);
85
+}
86
+
87
+.feature-card h3 {
88
+ margin-top: 0;
89
+ font-size: 1.1rem;
90
+}
91
+
92
+.performance-table {
93
+ width: 100%;
94
+ border-collapse: collapse;
95
+}
96
+
97
+.performance-table th {
98
+ text-align: left;
99
+ padding: 0.75rem 1rem;
100
+}
101
+
102
+.performance-table td {
103
+ padding: 0.75rem 1rem;
104
+ text-align: right;
105
+}
106
+
107
+.performance-table td:first-child {
108
+ text-align: left;
109
+ font-weight: 600;
110
+}
111
+
112
+.performance-table .winner {
113
+ color: var(--sl-color-accent-high);
114
+ font-weight: 700;
115
+}
116
+
117
+code {
118
+ font-size: 0.85em;
119
+ border-radius: 4px;
120
+}
121
+
122
+pre {
123
+ border-radius: 8px;
124
+ border: 1px solid var(--sl-color-gray-5);
125
+}
126
+
127
+.starlight-aside {
128
+ border-radius: 8px;
129
+}
130
+
131
+.starlight-aside--note {
132
+ border-left-color: var(--sl-color-blue);
133
+}
134
+
135
+.starlight-aside--tip {
136
+ border-left-color: var(--sl-color-accent);
137
+}
138
+
139
+.starlight-aside--caution {
140
+ border-left-color: var(--sl-color-orange);
141
+}
35
142