AI 资讯
Architecting Block: Building a Custom Social Network, Theme Engine, and more
Pre: What is BlockSocial? BlockSocial is the ultimate social network for developers, bringing the energy of short-form video to the world of open source. Think of it as Facebook meets Instagram—a place to showcase your code, find inspiration, and build your developer brand through "Reels" and interactive dashboards. Github link: https://github.com/Hfs2024/BlockSocial 1. User Scenario & Workflow (The Fork System) The Setup User A : Publishes a post saying: "I love drinking Pepsi every day." User B : Is shy, but wants to tell their friend this is an unhealthy habit. User C : Is a malicious user who gossips. The Fork Mechanism User B creates a fork to discuss this post with User C via the POST /api/share endpoint. Data Copying : It copies the entire post contents except comments, likes, reports, and downloads. Chain Prevention : You can fork a forked post, but the system will fork the original source root, not the fork itself. Scope : It shares with only one user at a time to prevent unexpected group creation. Database Payload for Forks The following fields are appended to the document structure: { "share" : true , "shareId" : "post._id" , // The original post ID "sharedBy" : "req.currentUser.username" , // The user who shared or forked "shareTo" : "shareTo" , // The friend receiving the share "shareComment" : "comment || ''" // A quick comment on the post } Moderation & Enforcement Workflow If User C breaks trust and leaks the conversation, User B can report them via the POST /report/user endpoint. Verification : Administrators review interaction history to verify the violation. Account Termination : Bad users receive a permanent lifetime account ban. Data Scrubbing : All associated messages from the malicious user are removed. Blacklisting : The account is fully banned. The Blindspot : Face-to-face interactions remain outside system moderation boundaries 😅 2. Technical Implementation Details Dynamic Comment Identity Logic When a user submits a comment via POST /api/c
AI 资讯
Unit Test AI Guide — Zero Hallucination, Cross-Stack Standard
Focus: Unit Tests ONLY — no integration, no E2E Stacks: Node.js (NestJS/Express) · React.js · Python · Angular · Laravel Goal: AI generates unit tests consistently, deterministically, without hallucination IDE: Cursor (Primary) + Claude (Secondary) Part 1 — Best Single Library Per Stack (Final Decision) Do not mix libraries. Pick one per stack, configure it fully, never deviate. | Stack | Library | Why This One | |---|---|---| | Node.js / NestJS / Express | Jest | Native DI mocking, @nestjs/testing built around it, widest ecosystem | | React.js | Vitest + @testing-library/react | Native Vite/ESM support, Jest-compatible API, 3–10x faster | | Python | pytest | De facto standard, fixture system eliminates boilerplate, best plugin ecosystem | | Angular | Jest (replace Karma) | Karma is deprecated in Angular 17+; Jest is the official migration target | | Laravel | Pest | Modern syntax, built on PHPUnit, higher signal-to-noise ratio | Rule: If someone suggests a second library for the same stack, reject it. One library per stack, configured once, followed always. Part 2 — IDE: Cursor (Only Choice for This Goal) Why Cursor and Not VS Code / WebStorm | Capability | Cursor | VS Code + Copilot | WebStorm | |---|---|---|---| | Project-level AI rules | ✅ .cursor/rules/ | ❌ | ❌ | | Codebase-aware context | ✅ @codebase | Partial | Partial | | Run terminal + read output | ✅ Composer | ❌ | ❌ | | Multi-file generation | ✅ Agent mode | Limited | ❌ | | Custom instructions per filetype | ✅ | ❌ | ❌ | | MCP server integration | ✅ | ❌ | ❌ | Cursor's .cursor/rules/ system is the only IDE-native mechanism that injects persistent, project-scoped instructions into every AI interaction — this is what prevents hallucination at the source. Cursor Setup for This Project project-root/ ├── .cursor/ │ └── rules/ │ ├── unit-test-global.mdc ← applies to all files │ ├── unit-test-nestjs.mdc ← applies to *.service.ts, *.guard.ts │ ├── unit-test-react.mdc ← applies to *.tsx, *.component.tsx │ ├── unit-t
开发者
TSRX: A Framework-Agnostic Alternative to JSX
TSRX is a TypeScript language extension developed by Dominic Gannaway, designed to build declarative user interfaces in a framework-agnostic manner. It compiles single .tsrx files to various runtime targets and supports scoped styles and declarative error handling. TSRX is currently in alpha and is open source under the MIT license. By Daniel Curtis
AI 资讯
Day 45 of Learning MERN Stack
Hello Dev Community! 👋 It is officially Day 45 of my non-stop run toward full-stack engineering! Yesterday, I learned how to serve static HTML pages using Express routing. Today, I took a major step toward building premium, clean, and minimalist UI/UX styles by installing and mastering Tailwind CSS via the Tailwind CLI ! Instead of writing massive, chaotic external CSS stylesheet files, today I shifted to the industry-standard utility-first workflow to speed up my design iterations. 🧠 Key Learnings From Day 45 (Tailwind CSS Architecture) Tailwind doesn't give you pre-built components; it gives you atomic utility classes that let you build completely custom, high-end layouts directly inside your HTML structure. Here is the engineering breakdown: 1. Tailwind CLI Installation & Initialization I learned how to integrate Tailwind from scratch using npm packages instead of lazy CDN links. Installed the tailwindcss compiler core ( npm install -D tailwindcss ). Initialized the configuration hub using npx tailwindcss init . 2. Crafting the Content Map inside tailwind.config.js Understood how Tailwind optimizes final file weights using tree-shaking. I configured the structural template paths so the compiler knows exactly which files to scan for dynamic styling classes: javascript /** @type {import('tailwindcss').Config} */ module.exports = { content: ["./public/**/*.{html,js}"], // Scanning static folders cleanly theme: { extend: {}, }, plugins: [], }
AI 资讯
I open-sourced the financial charting library we use in production
If you've ever tried to build a trading dashboard, a crypto portfolio tracker, or any financial app, you probably ran into the "charting problem" pretty quickly. The standard industry approach goes something like this: Embed a heavy <iframe> from a 3rd party provider. Realize it doesn't quite match your app's UI/theme. Struggle with limited postMessage APIs to push real-time data. Watch the UI lag when you try to render multiple charts on the same page. I got tired of fighting with iframe embeds and DOM-based SVG charts that couldn't handle thousands of real-time ticks. I needed something native, fast, and entirely under my control. So, I built one. And today, I'm fully open-sourcing the core engine. Meet Exeria Charts Exeria Charts is a source-available, high-performance financial charting library designed for self-hosted web applications. Instead of embedding external widgets, Exeria renders directly inside your application using a highly optimized Canvas architecture. Here’s a quick look at what it can do: https://exeria.dev The Tech Constraints (Why build another charting lib?) Building a financial chart isn't just about drawing boxes and lines. It’s about performance under pressure. When designing the architecture, we had a few strict requirements: Zero iframes: It had to be a native JavaScript/React module that lives in the main DOM tree, styled perfectly to match the host application. High-frequency updates: Crypto and forex markets move fast. The library needed to handle sub-millisecond tick updates without dropping frames or blocking the main UI thread. Unified runtime: I didn't want a separate library for line charts, another for candlesticks, and another for volume histograms. We needed one engine that could switch views instantly. How to use it We designed the API to be as straightforward as possible. Here is what a vanilla JS implementation looks like: import { createChart } from " @efixdata/exeria-chart " ; // 1. Grab your container const container = d
AI 资讯
TypeScript Types Demystified: Simple Types, Special Types, and Type Inference
TypeScript Types Demystified: Simple Types, Special Types, and Type Inference In the first post , we covered why TypeScript exists and how to write your first program. Now it's time to get comfortable with the type system itself — the foundation everything else is built on. By the end of this post, you'll know how to type variables, arrays, and function parameters correctly. You'll also understand the "special" types that trip up most beginners: any , unknown , never , and void . The Core Primitive Types TypeScript's basic types map directly to JavaScript's primitives: // string let firstName : string = " Ramesh " ; let greeting : string = `Hello, ${ firstName } ` ; // number (no separate int/float — it's all number) let age : number = 31 ; let price : number = 9.99 ; let hex : number = 0xFF ; // boolean let isLoggedIn : boolean = true ; let hasAccess : boolean = false ; These are the types you'll use most often. Simple, predictable, and exactly what you'd expect. Type Inference: TypeScript Does the Work You don't always have to write the type. TypeScript infers it from the value you assign: let city = " Chennai " ; // TypeScript infers: string let year = 2026 ; // TypeScript infers: number let isActive = true ; // TypeScript infers: boolean Once inferred, that type is locked in: let city = " Chennai " ; city = 42 ; // ❌ Error: Type 'number' is not assignable to type 'string' Rule of thumb: Let TypeScript infer types for local variables. Write explicit annotations for function parameters and return types. // Let inference work for variables const scores = [ 95 , 87 , 72 ]; // inferred as number[] // Be explicit for function signatures function calculateAverage ( scores : number []): number { return scores . reduce (( a , b ) => a + b , 0 ) / scores . length ; } Explicit vs Inferred — When to Choose Each // ✅ Explicit annotation — good for function params & return types function formatName ( first : string , last : string ): string { return ` ${ first } ${ last } ` ;
AI 资讯
TypeScript Explained: Why Every JavaScript Developer Should Care
TypeScript Explained: Why Every JavaScript Developer Should Care You've been writing JavaScript for years. It works. So why bother with TypeScript? That's what I thought too — until I spent two days debugging a production bug that turned out to be a simple typo in a property name. A bug TypeScript would have caught in milliseconds. In this post, I'll explain what TypeScript is, why it exists, and how to write your very first TypeScript program. No fluff — just what you actually need to know. What Is TypeScript? TypeScript is JavaScript with types added on top. That's really it. It was created by Microsoft in 2012 and has since become one of the most popular tools in the JavaScript ecosystem — used by teams at Google, Airbnb, Slack, and countless others. Here's the key thing to understand: TypeScript is not a replacement for JavaScript . It compiles down to plain JavaScript. Every browser, Node.js server, and JavaScript runtime runs the same JS it always has. TypeScript just helps you write better code before that happens. JavaScript vs TypeScript — A Side-by-Side Look Let's say you're writing a function to greet a user: JavaScript: function greetUser ( name ) { return " Hello, " + name . toUpperCase (); } greetUser ( 42 ); // Runtime error: name.toUpperCase is not a function You won't discover this mistake until the code runs — possibly in production, in front of real users. TypeScript: function greetUser ( name : string ): string { return " Hello, " + name . toUpperCase (); } greetUser ( 42 ); // ❌ Error: Argument of type 'number' is not assignable to parameter of type 'string' TypeScript catches this immediately in your editor — before you even run the code. That : string annotation tells TypeScript exactly what type name should be. Why Use TypeScript? The Real Benefits 1. Catch Bugs Early The most obvious benefit. Instead of runtime errors that crash your app, TypeScript surfaces type errors at compile time — while you're still writing code. 2. Better Autocomplet
AI 资讯
Stop copying config files into every new project — I built a CLI for this
You know that feeling when you start a new project and spend the first 20 minutes doing nothing productive? Hunting for the Android keystore. Finding the right .env file. Copying VS Code settings. Again. And again. Every. Single. Project. I got tired of it. So I tried building something to fix it — coffee-installer. How it works Create a collection folder and point coffee-installer to it: mkdir ~/.coffee-collection echo '{ "baseSource": "~/.coffee-collection" }' > ~/.coffee.config.json Add your reusable files to the collection: mkdir -p ~/.coffee-collection/my-app/android/app cp android/app/keystore.jks ~/.coffee-collection/my-app/android/app/ cp android/key.properties ~/.coffee-collection/my-app/android/ Preview before installing: $ coffee diff my-app Diff — my-app ( config ) + add android/key.properties + add android/app/keystore.jks + add frontend/.env.development.local 3 to add, 0 to overwrite, 0 to skip Then install with one command: $ coffee install my-app 📦 Installing my-app... ✅ copied android/key.properties ✅ copied android/app/keystore.jks ✅ copied frontend/.env.development.local ✅ my-app installed. All commands coffee list # see everything in your collection coffee diff my-app # preview before installing coffee install my-app # install into current project coffee pull my-app # sync changes back to collection Why I built this I work across multiple projects — mobile apps, web backends, Flutter apps. Every project needs the same credentials, the same IDE config, the same environment files. The alternative was a folder of files I'd manually copy every time, or worse — storing credentials in a repo (never do this). coffee-installer keeps everything in one local folder that never touches version control. It's not perfect yet, but it already saves me a lot of setup time. Zero dependencies The entire thing runs on Node.js stdlib only — no external packages, nothing to audit, nothing that breaks when a dependency changes. Try it ihdatech / coffee-installer CLI fo
AI 资讯
How to implement field-level AES-256-GCM encryption in Spring Boot (and why we packaged it into one annotation)
If you've ever had to encrypt a nationalId , a creditCardNumber , or a medicalRecord field in a Spring Boot entity, you already know the drill. You write an AttributeConverter , you wire up a Cipher instance, you generate an IV, you figure out where the key lives, you get the GCM tag handling wrong once, you fix it, and three weeks later you finally trust it enough to ship. We've done this enough times — across healthcare and fintech projects — that we stopped doing it manually. This post walks through the full implementation from scratch, the mistakes that are easy to make along the way, and then shows the one-annotation version we eventually packaged into Nucleus , our open-core Java framework. Why GCM, and not just AES-CBC If you search "AES encryption Java" you'll find a lot of CBC-mode examples. Don't use them for new code. CBC gives you confidentiality but no integrity check — an attacker can flip bits in the ciphertext and you won't know it happened until something downstream breaks in a weird way, or worse, doesn't break at all. GCM (Galois/Counter Mode) gives you both confidentiality and authentication in one pass. It produces an authentication tag alongside the ciphertext, and decryption fails loudly if either the ciphertext or the tag has been tampered with. It's also the mode behind TLS 1.3, which is a reasonable signal that it's held up to scrutiny. The relevant specification is NIST SP 800-38D. Building it by hand Here's a minimal, correct implementation. This is the version you'd write before you have a framework to lean on. public class AesGcmEncryptor { private static final String ALGORITHM = "AES/GCM/NoPadding" ; private static final int GCM_TAG_LENGTH_BITS = 128 ; private static final int GCM_IV_LENGTH_BYTES = 12 ; private final SecretKey key ; public AesGcmEncryptor ( SecretKey key ) { this . key = key ; } public String encrypt ( String plaintext ) { try { byte [] iv = new byte [ GCM_IV_LENGTH_BYTES ]; SecureRandom . getInstanceStrong (). nextByt
AI 资讯
AI Observability for Lovable Apps: Monitor, Test, and Improve Prompts with Currai
AI Observability for Lovable Apps: Monitor Prompts, Traces, and Evaluations with Currai Building AI applications has never been easier. Tools like Lovable allow developers and founders to create AI-powered products in minutes. Whether you're building a chatbot, AI assistant, recommendation engine, AI agent, or prediction app, generating the application is often the easy part. The real challenge starts after launch. How do you know what prompts are being sent to the model? How do you debug unexpected AI responses? How do you compare prompt variations and determine which performs better? How do you evaluate output quality over time? How do you track token usage and costs? This is exactly why we built Currai . What is Currai? Currai is an AI observability platform that helps teams understand, test, and improve AI applications in production. It provides: Prompt tracing AI request monitoring Session tracking Prompt versioning A/B testing LLM evaluations Cost and token analytics OpenTelemetry support Instead of guessing why your AI application produced a particular response, Currai lets you inspect the entire execution flow. The Problem With AI Applications Traditional monitoring tools were built for APIs, databases, and backend services. AI applications introduce a completely different set of challenges: Prompt changes can significantly impact output quality Model updates can affect behavior Hallucinations are difficult to track User conversations are hard to debug Prompt experiments are often unmanaged Quality evaluation is usually manual When something goes wrong, application logs alone don't provide enough visibility. You need observability designed specifically for AI systems. Trace Every AI Request Currai captures every prompt, model response, latency metric, token usage, and cost. You can inspect: System prompts User prompts Model outputs Execution traces Tool calls Metadata This makes debugging AI applications dramatically easier. Run Prompt A/B Tests Prompt engin
AI 资讯
Kotlin Compiler Plugin Cuts Android Startup Time by 30% in Expo SDK 56
Expo SDK 56 ships with a custom Kotlin compiler plugin that eliminates reflection from Expo Modules on Android. The result: 70% faster module initialization and a 30% reduction in time to first render. The plugin runs during compilation, so app developers get these performance gains automatically without changing any code. Module authors can unlock even bigger wins with a single annotation. This post walks through how we built it and why this approach succeeded where previous attempts failed. For the Swift side where we now talk to JSI directly, check out our companion post Talking to JSI in Swift . The reflection problem we inherited Before Expo Modules, we had Unimodules. They worked like old React Native bridge modules: you'd sprinkle annotations across methods you wanted to expose, and the runtime would discover everything through reflection. class ClipboardModule ( context : Context ) : ExportedModule ( context ) { override fun getName () = "ExpoClipboard" @ExpoMethod fun getStringAsync ( promise : Promise ) { val clip = clipboardManager . primaryClip ?. getItemAt ( 0 ) promise . resolve ( clip ?. text ?. toString () ?: "" ) } @ExpoMethod fun setStringAsync ( content : String , promise : Promise ) { clipboardManager . setPrimaryClip ( ClipData . newPlainText ( null , content )) promise . resolve ( true ) } } Reflection made sense when we needed metadata about our own code. What methods does this module export? What arguments do they accept? The JVM could answer those questions. But reflection costs time, and on Android that time comes straight out of your startup budget. Every module the runtime introspects adds milliseconds before users see your app. Building the Expo Modules API gave us a chance to fix this. We wanted better ergonomics and less reflection. The Kotlin DSL delivered both in one move, removing most reflection while making modules easier to write. But we couldn't eliminate all of it. Type information for function arguments and Record properties s
AI 资讯
I built a CLI that generates .env files so I never read docs again
# EnvForge BETA v1.1 ⚡ Structured .env scaffolding for modern applications. Generate, validate, and protect environment variables for 14+ services – without ever opening a docs page. Github repo [ https://github.com/Jos3456/envforge ] NPM version (https://img.shields.io/npm/v/envforge-dev) MIT License (https://img.shields.io/badge/License-MIT-yellow.svg) ## Installation bash npm install envforge-dev **Requirements:** Node.js 18 or later. --- **## Quick Start** bash # 1. Generate an .env file and choose your providers envforge init # 2. Fill in your actual credentials envforge fill # 3. Check everything is set correctly envforge validate ## All Commands ### Scaffolding Command What it does envforge init Create a new .env by selecting providers interactively envforge add <provider> Add variables from a specific provider to your existing .env envforge preset Generate a .env from a popular stack preset envforge example Create a safe‑to‑commit .env.example file envforge fill Interactively enter values (secret keys are masked) envforge list Show all built‑in and custom providers ### Guardrails Command What it does envforge validate Check that all required variables are filled in envforge scan Detect secret keys accidentally exposed in frontend code envforge hook install Install a pre‑commit hook that runs validate + scan ### Customisation Command What it does envforge provider add Create a custom provider template envforge registry update Download the latest providers from the community registry ## Built‑in Providers Category Providers Database Supabase, Neon, MongoDB Atlas Auth Clerk, Auth0, Firebase AI OpenAI, Anthropic (Claude) Payments Stripe Email Resend, SendGrid Storage Cloudinary, AWS S3 / Cloudflare R2 Other Vercel Missing a provider? Add your own with envforge provider add or contribute one to the community. ## Framework‑Aware Scanning Use --framework for smarter detection: # Next.js specific rules (app/ vs pages/, "use client") envforge scan --framework next Th
AI 资讯
How to Integrate Apache Kafka with Spring Boot: A Production-Ready Guide
When a Spring Boot service needs to talk to another service without waiting on a synchronous HTTP call, message queues are the usual answer. Apache Kafka has become the default choice for this in most backend teams, but a lot of tutorials stop at a "hello world" producer and consumer that would never survive a real production load. Things like consumer retries, error handling, serialization of real objects, and graceful shutdown get skipped, and those are exactly the parts that page you at 2 a.m. In this tutorial, you will build a Spring Boot application that produces and consumes JSON messages over Kafka. You will configure a producer and a consumer, send a typed object instead of a plain string, handle deserialization errors so one bad message does not block your whole consumer group, and verify the whole thing works end to end. By the end, you will have a small but realistic messaging setup you can build on. Prerequisites To follow along, you will need: Java 17 or later installed. You can check your version by running java -version . A Spring Boot 3.x project. You can generate one at start.spring.io with the Spring for Apache Kafka dependency added. A running Kafka broker. The quickest way to get one locally is Docker, which the first step covers. Basic familiarity with Spring Boot, including how @Component and application.yml work. Step 1 — Running Kafka Locally with Docker Before writing any code, you need a broker to talk to. Running Kafka by hand involves Zookeeper, broker configuration, and a fair amount of setup, so you will use Docker Compose to bring up a single-broker cluster instead. Create a file named docker-compose.yml in your project root: services : kafka : image : apache/kafka:3.7.0 container_name : kafka ports : - " 9092:9092" environment : KAFKA_NODE_ID : 1 KAFKA_PROCESS_ROLES : broker,controller KAFKA_LISTENERS : PLAINTEXT://:9092,CONTROLLER://:9093 KAFKA_ADVERTISED_LISTENERS : PLAINTEXT://localhost:9092 KAFKA_CONTROLLER_LISTENER_NAMES : CONTRO
开源项目
🔥 facebook / stylex - StyleX is the styling system for ambitious user interfaces.
GitHub热门项目 | StyleX is the styling system for ambitious user interfaces. | Stars: 9,351 | 26 stars today | 语言: JavaScript
开源项目
🔥 zed-industries / extensions - Extensions for the Zed editor
GitHub热门项目 | Extensions for the Zed editor | Stars: 1,758 | 3 stars today | 语言: JavaScript
开源项目
🔥 maboloshi / github-chinese - GitHub 汉化插件,GitHub 中文化界面。 (GitHub Translation To Chinese)
GitHub热门项目 | GitHub 汉化插件,GitHub 中文化界面。 (GitHub Translation To Chinese) | Stars: 27,319 | 63 stars today | 语言: JavaScript
开源项目
🔥 decaporg / decap-cms - A Git-based CMS for Static Site Generators
GitHub热门项目 | A Git-based CMS for Static Site Generators | Stars: 19,157 | 5 stars today | 语言: JavaScript
开源项目
🔥 vllm-project / recipes - Common recipes to run vLLM
GitHub热门项目 | Common recipes to run vLLM | Stars: 864 | 9 stars today | 语言: JavaScript
开源项目
🔥 TheOdinProject / curriculum - The open curriculum for learning web development
GitHub热门项目 | The open curriculum for learning web development | Stars: 12,664 | 10 stars today | 语言: JavaScript
开源项目
🔥 zarazhangrui / follow-builders - AI builders digest — monitors top AI builders on X and YouTu
GitHub热门项目 | AI builders digest — monitors top AI builders on X and YouTube podcasts, remixes their content into digestible summaries. Follow builders, not influencers. | Stars: 5,277 | 25 stars today | 语言: JavaScript