🚀Just built something cool
A file-based routing system for Express.js, inspired by Next.js App Router
✅ Route by folder/file structure
✅ REST handlers via GET, POST, etc.
✅ Middleware support
✅ Dynamic routes like /user/[id]
npm: https://t.co/ASLnXI1CE7
@mannupaaji
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
float hash21(vec2 p) {
p = fract(p * vec2(123.34, 456.21));
p += dot(p, p + 45.32);
return fract(p.x * p.y);
}
vec2 hash22(vec2 p) {
float n = hash21(p);
return vec2(n, hash21(p + n));
}
// One lattice of stars. Every cell holds a candidate; only those above the
// cut light up, and the survivors take their place, brightness and behaviour
// from the same hash. Neighbouring cells are checked too, so a star sits
// anywhere in its cell and can spill across the edge. Confining them to the
// middle of a cell is cheaper, and at these densities you can see the grid.
float layer(vec2 uv, float density, float glow, float cut, float seed) {
vec2 g = uv * density;
vec2 cell = floor(g);
vec2 f = fract(g) - 0.5;
float acc = 0.0;
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
vec2 o = vec2(float(x), float(y));
vec2 id = cell + o + seed;
float mag = hash21(id + 3.7);
if (mag < cut) continue; // most of the sky is empty
vec2 at = hash22(id) - 0.5;
float bright = (mag - cut) / (1.0 - cut);
// Scintillation is the air, not the star. Most hold steady; a few
// shimmer hard and a few more waver. Two detuned sines multiplied give
// an irregular flicker rather than a clean pulse.
float roll = hash21(id + 11.3);
float amount = roll > 0.86 ? 0.55 : (roll > 0.62 ? 0.20 : 0.0);
float s1 = sin(u_time * (1.7 + mag * 5.0) + mag * 43.0);
float s2 = sin(u_time * (2.9 + roll * 4.0) + roll * 17.0);
float flicker = 1.0 - amount * (0.5 - 0.5 * s1 * s2);
float d = length(f - o - at);
acc += bright * flicker * glow / (d * d + glow * 0.42);
}
}
return acc;
}
// soft noise, for the band of stars too distant to resolve
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),
mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x), u.y);
}
float fbm(vec2 p) {
float v = 0.0, a = 0.5;
for (int i = 0; i < 4; i++) { v += a * noise(p); p *= 2.02; a *= 0.5; }
return v;
}
// one meteor, every seventh second, from wherever it likes
float meteor(vec2 uv) {
float period = 7.0;
float k = floor(u_time / period);
float age = fract(u_time / period) * period;
vec2 from = (hash22(vec2(k, 3.1)) - vec2(0.5, 0.15)) * vec2(2.4, 1.3);
vec2 dir = normalize(vec2(-0.85, -0.38));
vec2 d = uv - (from + dir * age * 0.85);
float along = dot(d, -dir);
float across = length(d + dir * along);
float streak = exp(-across * 300.0) * exp(-max(along, 0.0) * 11.0);
float life = smoothstep(0.0, 0.12, age) * smoothstep(1.7, 0.7, age);
return streak * life * step(0.0, along);
}
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * u_resolution)
/ min(u_resolution.x, u_resolution.y);
float h = gl_FragCoord.y / u_resolution.y;
// night: deep blue overhead, a little warmth left near the ground
vec3 sky = mix(vec3(0.020, 0.026, 0.055), vec3(0.003, 0.005, 0.014), h);
sky += vec3(0.070, 0.042, 0.030) * pow(1.0 - h, 7.0);
// the unresolved band, drifting very slowly
float band = exp(-pow((uv.y - uv.x * 0.42 + 0.06) * 2.7, 2.0));
float haze = fbm(uv * 3.4 + vec2(u_time * 0.01, 0.0));
sky += vec3(0.090, 0.096, 0.135) * band * (0.25 + 0.75 * haze);
// A real sky is not spread evenly, and past a certain distance the eye stops
// resolving points at all. So only three lattices are drawn, and the faintest
// is gated hard: it appears where the sky is genuinely rich and nowhere else.
// Everything beyond that is carried by the glow above, not by more dots.
float crowd = clamp(band * (0.30 + 0.70 * haze)
+ 0.35 * fbm(uv * 2.3 + 9.0) - 0.16, 0.0, 1.0);
crowd *= crowd;
float s = layer(uv, 11.0, 0.00060, 0.70, 0.0);
s += layer(uv, 27.0, 0.00040, 0.70, 19.0) * 0.80;
s += layer(uv, 62.0, 0.00110, 0.56, 57.0) * crowd * 0.55;
// stars are not all the same colour
vec3 tint = mix(vec3(0.72, 0.82, 1.00), vec3(1.00, 0.90, 0.76),
0.5 + 0.5 * sin(uv.x * 6.3 + uv.y * 4.1));
vec3 col = sky + tint * s + vec3(0.9, 0.95, 1.0) * meteor(uv);
gl_FragColor = vec4(col, 1.0);
}
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
float hash21(vec2 p) {
p = fract(p * vec2(123.34, 456.21));
p += dot(p, p + 45.32);
return fract(p.x * p.y);
}
vec2 hash22(vec2 p) {
float n = hash21(p);
return vec2(n, hash21(p + n));
}
// One lattice of stars. Every cell holds a candidate; only those above the
// cut light up, and the survivors take their place, brightness and behaviour
// from the same hash. Neighbouring cells are checked too, so a star sits
// anywhere in its cell and can spill across the edge. Confining them to the
// middle of a cell is cheaper, and at these densities you can see the grid.
float layer(vec2 uv, float density, float glow, float cut, float seed) {
vec2 g = uv * density;
vec2 cell = floor(g);
vec2 f = fract(g) - 0.5;
float acc = 0.0;
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
vec2 o = vec2(float(x), float(y));
vec2 id = cell + o + seed;
float mag = hash21(id + 3.7);
if (mag < cut) continue; // most of the sky is empty
vec2 at = hash22(id) - 0.5;
float bright = (mag - cut) / (1.0 - cut);
// Scintillation is the air, not the star. Most hold steady; a few
// shimmer hard and a few more waver. Two detuned sines multiplied give
// an irregular flicker rather than a clean pulse.
float roll = hash21(id + 11.3);
float amount = roll > 0.86 ? 0.55 : (roll > 0.62 ? 0.20 : 0.0);
float s1 = sin(u_time * (1.7 + mag * 5.0) + mag * 43.0);
float s2 = sin(u_time * (2.9 + roll * 4.0) + roll * 17.0);
float flicker = 1.0 - amount * (0.5 - 0.5 * s1 * s2);
float d = length(f - o - at);
acc += bright * flicker * glow / (d * d + glow * 0.42);
}
}
return acc;
}
// soft noise, for the band of stars too distant to resolve
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),
mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x), u.y);
}
float fbm(vec2 p) {
float v = 0.0, a = 0.5;
for (int i = 0; i < 4; i++) { v += a * noise(p); p *= 2.02; a *= 0.5; }
return v;
}
// one meteor, every seventh second, from wherever it likes
float meteor(vec2 uv) {
float period = 7.0;
float k = floor(u_time / period);
float age = fract(u_time / period) * period;
vec2 from = (hash22(vec2(k, 3.1)) - vec2(0.5, 0.15)) * vec2(2.4, 1.3);
vec2 dir = normalize(vec2(-0.85, -0.38));
vec2 d = uv - (from + dir * age * 0.85);
float along = dot(d, -dir);
float across = length(d + dir * along);
float streak = exp(-across * 300.0) * exp(-max(along, 0.0) * 11.0);
float life = smoothstep(0.0, 0.12, age) * smoothstep(1.7, 0.7, age);
return streak * life * step(0.0, along);
}
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * u_resolution)
/ min(u_resolution.x, u_resolution.y);
float h = gl_FragCoord.y / u_resolution.y;
// night: deep blue overhead, a little warmth left near the ground
vec3 sky = mix(vec3(0.020, 0.026, 0.055), vec3(0.003, 0.005, 0.014), h);
sky += vec3(0.070, 0.042, 0.030) * pow(1.0 - h, 7.0);
// the unresolved band, drifting very slowly
float band = exp(-pow((uv.y - uv.x * 0.42 + 0.06) * 2.7, 2.0));
float haze = fbm(uv * 3.4 + vec2(u_time * 0.01, 0.0));
sky += vec3(0.090, 0.096, 0.135) * band * (0.25 + 0.75 * haze);
// A real sky is not spread evenly, and past a certain distance the eye stops
// resolving points at all. So only three lattices are drawn, and the faintest
// is gated hard: it appears where the sky is genuinely rich and nowhere else.
// Everything beyond that is carried by the glow above, not by more dots.
float crowd = clamp(band * (0.30 + 0.70 * haze)
+ 0.35 * fbm(uv * 2.3 + 9.0) - 0.16, 0.0, 1.0);
crowd *= crowd;
float s = layer(uv, 11.0, 0.00060, 0.70, 0.0);
s += layer(uv, 27.0, 0.00040, 0.70, 19.0) * 0.80;
s += layer(uv, 62.0, 0.00110, 0.56, 57.0) * crowd * 0.55;
// stars are not all the same colour
vec3 tint = mix(vec3(0.72, 0.82, 1.00), vec3(1.00, 0.90, 0.76),
0.5 + 0.5 * sin(uv.x * 6.3 + uv.y * 4.1));
vec3 col = sky + tint * s + vec3(0.9, 0.95, 1.0) * meteor(uv);
gl_FragColor = vec4(col, 1.0);
}
The material never changes. The ownership does.
That's the whole reason a recommended read feels like a chore and a self-found rabbit hole feels like fun.
New post on reactance and the curiosity gap
https://t.co/2JSm3SUhah
@Manixh02 Bro I came here ready to comment “you should give a reference if you’re using someone’s work” and then saw the reference was already there in the comment 😭💀