Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlarky/strike
Let's GO and create React Server Components
https://github.com/jlarky/strike
Last synced: 5 days ago
JSON representation
Let's GO and create React Server Components
- Host: GitHub
- URL: https://github.com/jlarky/strike
- Owner: JLarky
- Created: 2023-08-26T17:16:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-29T06:45:22.000Z (5 months ago)
- Last Synced: 2024-12-14T16:08:14.323Z (12 days ago)
- Language: Go
- Homepage: https://strike-go.zeabur.app
- Size: 142 KB
- Stars: 181
- Watchers: 6
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ~~Strike~~
Did you know that `"hello".strike()` is a valid JavaScript expression? This project will blow your mind with this and other ~~useless~~ usefull facts.
# Why
> We do what we must because we can.
-- GLaDOS
This is a proof of concept that it's actually possible to generate React Server Components with backends other than Node.js. In this case, Go.
By using Go and simplified implementation of RSC, hopefully we give you a nice playground that will help you understand the principles behind RSC better.
The name `strike` doesn't have any special meaning, but it had two things going for it:
- name wasn't taken
- both html tag `` and JavaScript method `String.prototype.strike` are deprecated# Project goals
- educate people about React Server Components (outside of Next.js/Node/Vercel ecosystem)
- not to use `react-server-dom-webpack` at all, opting for a simpler (to understand) implementation instead
- get 10x performance improvement over Next.js for some synthetic use cases# Pre-requisites
Install [air](https://github.com/cosmtrek/air) for development.
# Run
air
# or
go run app.go# Test
air --build.bin "go test ./..." --build.exclude_regex "" --build.cmd "true"
# or
go test ./...# Caution
I don't understand how HTML escaping works in Go, so I assure you there's prenty of XSS vulnerabilities in this code.
# More
This was built in public, you can watch it in the [YT Playlist](https://youtube.com/playlist?list=PLuPYpWKKQ-H12ajPoPdUO5jAhfjTeprhI&si=3ioo0SA3sP7mWuQa).
As seen on TV: https://youtu.be/7Co0qXGcE5I?si=FMfj45GB8A-lWy1P
# Profiling
Click to expand
-
pprof README
-
pprof package
-
profiling
-
For load testing:
-
sudo ulimit -n 6049
-
sudo sysctl -w kern.ipc.somaxconn=1024
-
source
```bash
brew install graphviz
# or
apt-get install graphviz gv
go get -u github.com/google/pprof
```
```bash
air --build.bin "go test -cpuprofile cpu.prof -memprofile mem.prof -bench=^Benchmark github.com/JLarky/strike/pkg/strike" --build.exclude_regex "" --build.cmd "true"
pprof -http=:3000 cpu.prof
pprof -http=:3000 -no_browser mem.prof
```