@assetsart/nylon-mesh 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.github/workflows/release.yml +98 -0
  2. package/Cargo.lock +2965 -0
  3. package/Cargo.toml +33 -0
  4. package/README.md +104 -0
  5. package/bin/nylon-mesh.js +213 -0
  6. package/bun.lock +360 -0
  7. package/docs/content/docs/caching.mdx +85 -0
  8. package/docs/content/docs/configuration.mdx +115 -0
  9. package/docs/content/docs/index.mdx +58 -0
  10. package/docs/content/docs/load-balancing.mdx +69 -0
  11. package/docs/content/docs/meta.json +9 -0
  12. package/docs/next.config.mjs +11 -0
  13. package/docs/package-lock.json +6099 -0
  14. package/docs/package.json +32 -0
  15. package/docs/postcss.config.mjs +7 -0
  16. package/docs/source.config.ts +23 -0
  17. package/docs/src/app/(home)/layout.tsx +6 -0
  18. package/docs/src/app/(home)/page.tsx +125 -0
  19. package/docs/src/app/api/search/route.ts +9 -0
  20. package/docs/src/app/docs/[[...slug]]/page.tsx +46 -0
  21. package/docs/src/app/docs/layout.tsx +11 -0
  22. package/docs/src/app/global.css +7 -0
  23. package/docs/src/app/layout.tsx +31 -0
  24. package/docs/src/app/llms-full.txt/route.ts +10 -0
  25. package/docs/src/app/llms.txt/route.ts +13 -0
  26. package/docs/src/app/og/docs/[...slug]/route.tsx +27 -0
  27. package/docs/src/components/ai/page-actions.tsx +240 -0
  28. package/docs/src/components/architecture-diagram.tsx +88 -0
  29. package/docs/src/components/benchmark.tsx +129 -0
  30. package/docs/src/components/configuration.tsx +107 -0
  31. package/docs/src/components/copy-button.tsx +29 -0
  32. package/docs/src/components/footer.tsx +37 -0
  33. package/docs/src/components/framework-logos.tsx +35 -0
  34. package/docs/src/lib/cn.ts +1 -0
  35. package/docs/src/lib/layout.shared.tsx +23 -0
  36. package/docs/src/lib/source.ts +27 -0
  37. package/docs/src/mdx-components.tsx +9 -0
  38. package/docs/tsconfig.json +46 -0
  39. package/nylon-mesh.yaml +41 -0
  40. package/package.json +23 -0
  41. package/scripts/publish.mjs +18 -0
  42. package/scripts/release.mjs +52 -0
  43. package/src/config.rs +91 -0
  44. package/src/main.rs +214 -0
  45. package/src/proxy/cache.rs +304 -0
  46. package/src/proxy/handlers.rs +76 -0
  47. package/src/proxy/load_balancer.rs +23 -0
  48. package/src/proxy/mod.rs +232 -0
  49. package/src/tls_accept.rs +119 -0
@@ -0,0 +1,58 @@
1
+ ---
2
+ title: Getting Started
3
+ description: Install and run Nylon Mesh in under 2 minutes.
4
+ ---
5
+
6
+ **Nylon Mesh** is a blazing-fast edge proxy built to solve the headaches of caching for modern SSR frameworks.
7
+
8
+ ## Why Nylon Mesh?
9
+
10
+ Frameworks like **Next.js, Nuxt, React (SSR), Angular, and Vue** are powerful—but server-side rendering is computationally expensive. Running Node.js under heavy traffic without a dedicated caching layer leads to:
11
+
12
+ - High CPU usage and slow TTFB
13
+ - Potential crashes under traffic spikes
14
+ - Complex custom caching logic inside your app
15
+
16
+ **Nylon Mesh sits in front of your app.** It intercepts HTTP requests, caches the expensive SSR-generated HTML in RAM and Redis, and serves subsequent users instantly—dropping your backend load to near zero.
17
+
18
+ ## Installation
19
+
20
+ Nylon Mesh is written in **Rust** for maximum performance. Compile and run directly:
21
+
22
+ ```bash
23
+ cargo build --release
24
+ ```
25
+
26
+ Or install via bun into your project:
27
+
28
+ ```bash
29
+ bun add nylon-mesh
30
+ ```
31
+
32
+ ## Initialization
33
+
34
+ Generate a ready-to-use configuration file:
35
+
36
+ ```bash
37
+ bunx nylon-mesh init
38
+ ```
39
+
40
+ This creates a `nylon-mesh.yaml` in your project folder. **No code changes required.**
41
+
42
+ ## Running the Proxy
43
+
44
+ Start by pointing the proxy at your config:
45
+
46
+ ```bash
47
+ cargo run --release -- nylon-mesh.yaml
48
+ ```
49
+
50
+ Or via the CLI wrapper:
51
+
52
+ ```bash
53
+ bunx nylon-mesh start nylon-mesh.yaml
54
+ ```
55
+
56
+ <Callout title="🎉 You're all set!" type="info">
57
+ Traffic hitting port `3000` (default) is now being cached and routed to your backend efficiently. Check out the [Configuration](/docs/configuration) to fine-tune your mesh.
58
+ </Callout>
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: Load Balancing
3
+ description: Configure upstream routing with round-robin, random, and weighted algorithms.
4
+ ---
5
+
6
+ Nylon Mesh uses [Pingora's](https://github.com/cloudflare/pingora) production-proven load balancing engine to route incoming HTTP requests across your upstream pool.
7
+
8
+ ## Selection Algorithms
9
+
10
+ | Algorithm | Behavior |
11
+ |---|---|
12
+ | `round_robin` **(default)** | Distributes traffic sequentially and equally across upstreams. |
13
+ | `random` | Randomly assigns each request to an available upstream. |
14
+
15
+ ```yaml
16
+ load_balancer_algo: "round_robin"
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Defining Upstreams
22
+
23
+ ### Simple Configuration
24
+
25
+ Just provide the address and port of each backend:
26
+
27
+ ```yaml
28
+ upstreams:
29
+ - "127.0.0.1:3001"
30
+ - "127.0.0.1:3002"
31
+ ```
32
+
33
+ ### Weighted Configuration
34
+
35
+ For backends with different hardware capabilities, assign `weight` to route proportionally more traffic:
36
+
37
+ ```yaml
38
+ upstreams:
39
+ - address: "127.0.0.1:3001"
40
+ weight: 10
41
+ - address: "127.0.0.1:3002"
42
+ weight: 2
43
+ ```
44
+
45
+ <Callout title="Tip" type="info">
46
+ In this example, for every **12** requests the first server handles **10** while the second manages **2**. Use this to route more traffic to machines with stronger CPU/RAM.
47
+ </Callout>
48
+
49
+ ---
50
+
51
+ ## Health Probes
52
+
53
+ Integrated Liveness and Readiness endpoints for orchestration platforms like Kubernetes:
54
+
55
+ ```yaml
56
+ liveness_path: "/_health/live"
57
+ readiness_path: "/_health/ready"
58
+ grace_period_seconds: 0
59
+ graceful_shutdown_timeout_seconds: 0
60
+ ```
61
+
62
+ | Probe | Path | Behavior |
63
+ |---|---|---|
64
+ | **Liveness** | `/_health/live` | Returns `200 OK` while the proxy process is healthy. |
65
+ | **Readiness** | `/_health/ready` | Returns `200 OK` when ready to receive traffic. Returns `503` during graceful shutdown to drain connections. |
66
+
67
+ <Callout title="Warning" type="warn">
68
+ Health probe paths are handled natively by Nylon Mesh and **never** forwarded to your backend. Make sure these paths don't conflict with your application routes.
69
+ </Callout>
@@ -0,0 +1,9 @@
1
+ {
2
+ "title": "Documentation",
3
+ "pages": [
4
+ "index",
5
+ "caching",
6
+ "load-balancing",
7
+ "configuration"
8
+ ]
9
+ }
@@ -0,0 +1,11 @@
1
+ import { createMDX } from 'fumadocs-mdx/next';
2
+
3
+ const withMDX = createMDX();
4
+
5
+ /** @type {import('next').NextConfig} */
6
+ const config = {
7
+ reactStrictMode: true,
8
+ output: 'export',
9
+ };
10
+
11
+ export default withMDX(config);