Total Pageviews

Sunday, 15 March 2026

Why Coding is Sooooo Good?

 

Coding, also known as programming, is a highly valued skill in today's digital world. Here are several reasons why coding is considered to be so good:

1. Creativity and Problem Solving:

Coding allows you to unleash your creativity and express your ideas in the form of software or applications. It empowers you to build something from scratch and solve real-world problems. Through coding, you can bring innovative solutions to various challenges and make a positive impact.

2. Career Opportunities:

The demand for skilled programmers continues to grow rapidly. Learning to code opens up a wide range of career opportunities in industries such as technology, finance, healthcare, gaming, and many others. Whether you choose to work for a company or pursue entrepreneurship, coding skills provide a solid foundation for a successful and fulfilling career.

3. Flexibility and Adaptability:

Coding equips you with the ability to adapt to ever-changing technologies and environments. With coding knowledge, you can easily learn new programming languages, frameworks, and tools as needed. This flexibility allows you to stay relevant in the fast-paced world of technology and opens doors to exciting projects and advancements.

4. Empowerment and Independence:

Coding empowers you to turn your ideas into reality without relying on others. You gain the independence to create your own projects, websites, apps, or even start your own business. By acquiring coding skills, you become self-sufficient and capable of bringing your visions to life.



5. Continuous Learning and Growth:

Coding is a field that constantly evolves. It requires continuous learning and staying updated with the latest developments. This aspect of coding ensures that you are always challenged and encourages personal growth. With each new project or problem you tackle, you expand your knowledge and skills, making coding an intellectually stimulating pursuit.


In summary, coding offers numerous benefits, including the opportunity for creativity, a wide range of career prospects, adaptability to changing technologies, empowerment, and continuous personal growth. Embracing coding can open doors to a world of possibilities and enable you to make a meaningful impact in the digital landscape.

Solving cold starts with Cloudflare Workers

 

Did this post load fast? 🚀 This is in no small part because the content was delivered to your browser using Cloudflare's Workers. Workers provides a high performance global network with a 0ms cold-start time.

Serverless today

Cloud providers can allocate machine resources on demand, scaling automatically to the requirements of your business. Two fundamental technologies make this possible today: virtualization, and containerization.

Virtualization is the process of running a virtual instance of a computer system in a layer abstracted from the actual hardware. Most commonly, it refers to running > multiple operating systems on a computer system simultaneously.

opensource.com - https://opensource.com/resources/virtualization

Containerization is the packaging of software code with just the operating system libraries and dependencies required to run the code to create a single lightweight executable.

IBM - https://www.ibm.com/cloud/learn/containerization

Whether it’s Amazon’s ECS or Lambda, Google’s Cloud Run or Cloud Functions, or any of the other modern offerings – services are built on these two fundamental concepts.

Code deployed as containers to these cloud services becomes a small independent workload that can be passed around and run on different hardware. For all intents and purposes this works really well, but providers make a trade-off between keeping your workload ‘hot’ (ready to accept requests) and the cost of occupying infrastructure.

Typically you can take over the trade-off with controls given to you from the provider, but you will need to decide: low cost with longer initial start times, or hot and ready with a higher cost. Businesses generally accept the cost associated with always having a workload running to eliminate the 'cold start', especially when the workload has to load a user experience like a web application.

Lambda cold starts

My team at ASICS Apps struggled with this very problem last year when experimenting with Next.js and AWS Lambda. We were attracted to the atomic nature, and billing per execution time. Using the custom server feature of Next.js, our demo projects looked very promising, and didn’t require a large time investment from our infrastructure team. Unfortunately we couldn't find a reliable solution to bring down cold requests consistently under three seconds, unacceptable for business requirements and set standards. This is especially the case when a lambda is delivering a visual interactive experience. I'm unsure I would recommend Lambda to serve a modern application experience like with Next.js, but can definitely see value for background tasks, or service to service cron workloads.

In the end, we chose AWS Elastic Container Service configured to guarantee a hot workload (never shutting off). Meaning we have accepted the cost of running a container every minute of every day to guarantee an instance response to user requests. Can we do better?

Cloudflare Workers

Faced with recent problems with Lambda at work, and not wanting to pay monthly to run this simple blog, Cloudflare Workers was the perfect solution.

You can think of Workers as a giant web browser running in the cloud. When a request is handled by Workers it’s akin to opening another tab. This comparison works well as a mental model because the Workers runtime uses the V8 engine — the same engine used by Chromium and Node.js. Instead of needing to package code in a container, you only need to adapt the worker syntax for application entry points. Unlike your web browser, the code is executed inside the server environment allowing your application access to privileged secrets, rendering content server-side, or completing costly calculations.

This blog is built with the latest version of Nuxt, an opinionated hybrid Vue framework that delivers high quality web experiences. With Cloudflare Workers I no longer worry about choosing between cold starts or paying a premium in addition to containerizing my application. This blog is now instantly available anywhere in the world, with very low latency and no cold starts.

Comparison: AWS Lambda vs ECS vs Cloudflare Workers

FeatureAWS LambdaCloudflare Workers
Cold StartYes (can be several sec)No (0ms, always ready)
Pricing ModelPer execution timePer request, generous free
DeploymentPackage as zip/containerJavaScript/Worker script
ScalabilityAutomatic, event-drivenAutomatic, edge network
LatencyVariable, cold start riskVery low, global edge
LimitationsCold starts, memory/timeRuntime limits, JS only

This table highlights the main differences between AWS Lambda and Cloudflare Workers. Cloudflare Workers stands out for its instant availability and global reach, making it ideal for web applications and APIs that require low latency and no cold starts.

Conclusion

In summary, Cloudflare Workers offer a compelling solution for developers seeking instant, global availability and minimal latency for their web applications. By eliminating cold starts and simplifying deployment, Workers empower teams to deliver fast, reliable experiences to users worldwide. If you’re building modern web apps or APIs, it’s worth considering Cloudflare Workers for your next project.

from  https://jamesvan.ca/post/cf-workers-coldstarts

Saturday, 14 March 2026

电影南海风云 唐国强处女作

官方永不说的真相:毛泽东一生6个“无法公开”的秘密

一簾幽夢

 

适合小团队/个人使用的各种serverless和开源服务

 

我运用到的服务一般有两个类别:一类是便捷的serverless服务,另一类是可以自己部署的开源云服务(他们也会提供云服务,其实和前面说的serverless是一种,一般为了安全考虑会自己部署,当然功能会被阉割)。这两者结合起来,极大地提升了开发效率。

先说部署方面。我的后端还是传统架构,但部署方式完全不同了。我没有采用传统服务器搭建CI/CD部署,而是使用railway、zeabur这种部署平台(虽然它们底层也是跑在aws上,哈哈)。因为都是单体应用,不需要考虑扩容问题,这类部署平台极大地节约了部署时间,配置起来也很方便。

另外一句部署的题外话,大部分知名的框架你只需要绑定github仓库就会自动识别部署,但如果你的文件结构变了,或者做一些调整,你就需要写dockerfile来自定义部署。

至于其他功能,我基本都外包给了我上面所说的serverless的第三方云服务。比如云数据库、队列、workflow这些,直接用现成的服务就好。oss更是不用说了,现在还有很多更方便的选择,像vercel的blob、supabase的storage,它们都是在s3之上做了封装和抽象,让开发者用起来更加简单。

不过serverless本体,edge functions我也会使用,一般会用在测试webhook,或者edge functions作为webhook的中转站。

因为部署非常快,直接在部署网站写好就发布了,测试也方便。

有点偏题了,回到正题来。

接下来正式介绍各种服务,开源的我会在后面标记开源。

一般开源服务都有免费额度,所以如果你是想做demo和mvp,不需要花一分钱。

写在开头的最后,Cloudflare, Vercel和Netlify我就不做介绍了,他们已经是最出名的serverless部署服务了。

云数据库

PlanetScale

https://planetscale.com/

MySQL兼容的serverless数据库平台,提供数据库分支、无锁schema变更等特性。非常适合需要快速迭代的项目,支持横向扩展和自动备份。

 

Supabase DB(开源)

https://supabase.com/

开源的Firebase替代品,基于PostgreSQL构建,提供认证、数据库、存储和实时订阅功能。支持自部署,完全掌控你的数据。

 

Neon

https://neon.tech/

 serverless Postgres数据库,支持即时配置、自动扩缩容和数据库分支功能。按使用量计费,闲置时自动缩减到零,非常省钱。

 

 

部署服务

Railway

https://railway.com/

 零配置的部署平台,自动检测框架并部署,支持CI/CD集成。从GitHub推送代码后自动构建部署,非常适合快速上线项目。

 

Coolify(开源)

https://coolify.io/

开源的自托管部署平台,可以在自己的服务器上部署应用。支持Docker容器、静态网站、数据库等多种服务类型,提供简洁的Web界面管理。支持链接自己服务器部署

Dokploy(开源)

https://dokploy.com/

开源的自托管PaaS平台,让你在自己的服务器上实现类似Heroku的部署体验。支持多种应用类型、数据库服务和自动SSL证书配置。支持链接自己服务器部署

Cloudflare Workers

https://workers.cloudflare.com/

边缘计算平台,在全球数据中心运行serverless函数。毫秒级冷启动、无限扩展,特别适合API中间层、webhooks和边缘渲染场景。

 

Cloudflare Pages

https://pages.cloudflare.com/

静态网站和全栈应用部署平台,与GitHub/GitLab深度集成。支持前端框架、serverless函数,通过全球CDN提供极速访问体验。

 

 

异步队列或workflow

Trigger.dev(开源)

https://trigger.dev/

 开源的后台任务平台,用于构建可靠的工作流,支持自动重试且无超时限制。非常适合处理长时间运行的任务和AI工作流。


Temporal
https://temporal.io/
持久化执行平台,用于编排复杂的工作流并提供容错能力。支持状态管理、自动重试,特别适合微服务编排和复杂业务流程。


Upstash
https://upstash.com/
serverless数据平台,提供Redis、Kafka和QStash(消息队列)服务,按请求计费。特别适合serverless环境,支持自动扩展。


鉴权服务:
Logto(开源)
https://logto.io/
开源的身份验证和用户管理平台,提供现代化的登录体验和完整的用户管理功能。


Supabase Auth(开源)
https://supabase.com/
开源的Firebase替代方案,提供完整的后端服务,包括身份验证、数据库、存储和实时订阅功能。


Clerk
https://clerk.com/
现代化的用户认证和管理平台,提供开箱即用的登录组件、多因素认证和用户管理界面。


Better Auth(开源)
https://better-auth.com/
Node.js生态中目前开发体验最好的鉴权框架,提供类型安全的API和灵活的配置选项。支持多种认证策略和数据库,完全开源可自托管。官方云服务正在开发中。


邮件发送服务
https://resend.com/
现代化的邮件API服务,专为开发者设计,提供简洁的API和优秀的送达率。支持React Email模板、Webhook事件追踪,轻松实现交易邮件和营销邮件发送。


文件存储服务:
MinIO(开源)
https://min.io/
开源的高性能对象存储系统,兼容Amazon S3 API。可以部署在任何基础设施上,提供企业级的数据保护和可扩展性,完全掌控你的存储数据。


Vercel Blob
https://vercel.com/storage/blob
Vercel提供的serverless文件存储服务,基于S3构建但使用更简单。与Vercel平台深度集成,支持边缘网络加速,按使用量计费。


Supabase Storage
https://supabase.com/storage
Supabase的对象存储服务,基于S3构建,提供简单的API和强大的访问控制。支持图片转换、自动备份,与Supabase其他服务无缝集成。


Cloudflare R2
https://www.cloudflare.com/products/r2/ ,
S3兼容的对象存储服务,最大特点是零出站费用。与Cloudflare全球网络深度集成,提供快速访问和自动缓存,按存储容量计费。


CMS服务:
Payload(开源)
https://payloadcms.com/
开源的无头CMS和应用框架,使用TypeScript构建。提供强大的管理界面、灵活的内容建模和完整的API,支持自托管,完全掌控你的内容数据。
    完全nextjs native的应用,可以单独部署cms服务,也可以直接放在nextjs项目里面

Strapi(开源)
https://strapi.io/
开源的无头CMS,提供可定制的管理面板和RESTful/GraphQL API。支持插件系统、多种数据库,可以快速构建API驱动的应用。
    最老牌的cms项目
    插件多,如果给客户用,放心使用


https://sanity.io/
实时协作的无头CMS平台,提供结构化内容管理和强大的查询语言GROQ。支持自定义编辑器、实时预览,特别适合内容驱动的网站和应用。

基于nodejs的相册程序Afilmory


A modern, high-performance photo gallery platform for photographers

Official SaaSDocumentationLive ExamplesSelf-Hosting


Afilmory (/əˈfɪlməri/, "uh-FIL-muh-ree") is a comprehensive photo gallery solution that combines Auto Focus (AF), Aperture (light control), Film (vintage medium), and Memory (captured moments). Built with React + TypeScript, it offers automatic photo synchronization from multiple storage sources, high-performance WebGL rendering, and professional EXIF metadata display.

🚀 Quick Start

Option 1: Official SaaS (Recommended)

👉 Get Started at afilmory.art - Zero setup, live in minutes!

The easiest way to create your photo gallery. No deployment, no servers, no maintenance required.

Why Choose SaaS?

  • Zero Configuration - Sign up and go live immediately
  • Live CMS - Edit photos, titles, and metadata in real-time
  • Custom Domains - Bind your own domain with DNS verification
  • Auto Updates - Always running the latest features
  • Managed Infrastructure - We handle scaling, backups, and maintenance

Start Your Gallery Now →

Option 2: Self-Hosting

For developers who need full control over their deployment:

Docker (Recommended)

# See our Docker deployment guide
https://github.com/Afilmory/docker

Manual Installation

# 1. Clone and install
git clone https://github.com/Afilmory/Afilmory.git
cd Afilmory
pnpm install

# 2. Configure
cp config.example.json config.json
cp builder.config.default.ts builder.config.ts
# Edit both files with your settings

# 3. Build manifest and thumbnails
pnpm run build:manifest

# 4. Start the application
pnpm dev

For detailed self-hosting instructions, see DEVELOPMENT.md and Documentation.

📸 Live Galleries

See Afilmory in action:

✨ Features

Core Capabilities

  • 🖼️ High-Performance WebGL Renderer - Custom WebGL image viewer with smooth zoom, pan, and gesture support
  • 📱 Responsive Masonry Layout - Powered by Masonic, adapts seamlessly to any screen size
  • 🎨 Modern UI/UX - Built with Tailwind CSS and Radix UI for accessibility and aesthetics
  • Incremental Sync - Smart change detection processes only new or modified photos
  • 🌐 Internationalization - Multi-language support with i18next
  • 🔗 Social Sharing - OpenGraph metadata for rich social media previews

Image Processing

  • 🔄 Format Support - Automatic conversion of HEIC/HEIF and TIFF formats
  • 🖼️ Smart Thumbnails - Multi-size thumbnail generation for optimized loading
  • 📊 Complete EXIF Display - Camera model, focal length, aperture, ISO, and more
  • 🌈 Blurhash Placeholders - Elegant progressive loading experience
  • 📱 Live Photos - Detection and display of iPhone Live Photos
  • ☀️ HDR Images - Full HDR image support
  • 🎛️ Fujifilm Recipes - Display Fujifilm film simulation settings

Advanced Features

  • 🗂️ Multi-Storage Support - S3-compatible storage, GitHub, Eagle, and local file system
  • 🏷️ File System Tags - Auto-generated tags based on directory structure
  • Concurrent Processing - Multi-process/multi-thread support for fast builds
  • 🗺️ Interactive Map - Geographic visualization with GPS coordinates using MapLibre
  • 🔍 Fullscreen Viewer - Immersive image viewing with gesture controls
  • 📷 Share & Embed - Share images to social media or embed in your website

🏗️ Architecture

Monorepo Structure

afilmory/
├── apps/
│   ├── web/              # React SPA (Vite + React Router 7)
│   ├── ssr/              # Next.js SSR wrapper for SEO/OG
│   ├── docs/             # Documentation site (VitePress)
├── be/                   # Backend services (Hono-based)
│   ├── apps/
│   │   ├── core/         # Core API server
│   │   ├── dashboard/    # Admin dashboard backend
│   │   └── oauth-gateway/# OAuth authentication gateway
│   └── packages/
│       ├── framework/    # Hono enterprise framework
│       ├── db/           # Database schemas (Drizzle ORM)
│       ├── redis/        # Redis client
│       └── websocket/    # WebSocket gateway
├── packages/
│   ├── builder/          # Photo processing pipeline
│   ├── webgl-viewer/     # WebGL image viewer component
│   ├── ui/               # Shared UI components
│   ├── hooks/            # React hooks library
│   ├── sdk/              # API client SDK
│   ├── utils/            # Utility functions
│   └── data/             # Shared data types
└── plugins/              # Builder plugins

Frontend Stack

  • React 19 - Latest React with Compiler
  • TypeScript - Full type safety
  • Vite - Lightning-fast build tool
  • React Router 7 - Modern routing
  • Tailwind CSS - Utility-first CSS framework
  • Radix UI - Accessible component primitives
  • Jotai - Atomic state management
  • TanStack Query - Data fetching and caching
  • i18next - Internationalization

Backend Stack

  • Hono - Ultra-fast web framework
  • Drizzle ORM - Type-safe database toolkit
  • PostgreSQL - Primary database
  • Redis - Caching and pub/sub
  • WebSocket - Real-time communication

Build Pipeline

  • Node.js - Server-side runtime
  • Sharp - High-performance image processing
  • AWS SDK - S3 storage operations
  • Worker Threads/Cluster - Parallel processing
  • EXIF-Reader - Metadata extraction

Storage Adapters

Designed with adapter pattern for flexibility:

  • S3-Compatible - AWS S3, MinIO, Backblaze B2, Alibaba Cloud OSS
  • GitHub - Use GitHub repository as storage
  • Eagle - Import from Eagle app library
  • Local File System - For development and testing

🛠️ Development

Prerequisites

  • Node.js 18+
  • pnpm 10+
  • TypeScript 5.9+

Project Setup

# Install dependencies
pnpm install

# Copy configuration files
cp config.example.json config.json
cp builder.config.default.ts builder.config.ts

# Set up environment variables
cp .env.template .env
# Edit .env with your credentials

Common Commands

# Development
pnpm dev                    # Start web + SSR
pnpm dev:be                 # Start backend services
pnpm --filter web dev       # Web app only
pnpm --filter @afilmory/ssr dev  # SSR only

# Build
pnpm build                  # Build production web app
pnpm build:manifest         # Generate photo manifest (incremental)
pnpm build:manifest -- --force  # Full rebuild

# Documentation
pnpm docs:dev               # Start docs dev server
pnpm docs:build             # Build documentation

# Code Quality
pnpm lint                   # Lint and fix
pnpm format                 # Format code
pnpm type-check             # Type checking

Configuration Files

config.json - Site presentation config:

{
  "name": "My Gallery",
  "title": "My Photography",
  "description": "Capturing beautiful moments",
  "url": "https://gallery.example.com",
  "accentColor": "#007bff",
  "author": {
    "name": "Your Name",
    "url": "https://example.com",
    "avatar": "https://example.com/avatar.jpg"
  },
  "social": {
    "github": "username",
    "twitter": "username"
  },
  "map": ["maplibre"],
  "mapStyle": "builtin",
  "mapProjection": "mercator"
}

builder.config.ts - Photo processing config:

import { defineBuilderConfig } from '@afilmory/builder'

export default defineBuilderConfig(() => ({
  storage: {
    provider: 's3',
    bucket: 'my-photos',
    region: 'us-east-1',
    // ... other S3 settings
  },
  system: {
    processing: {
      defaultConcurrency: 10,
      enableLivePhotoDetection: true,
    },
    observability: {
      showProgress: true,
      showDetailedStats: true,
    },
  },
}))

🔌 Extending Afilmory

Custom Storage Provider

Implement the StorageProvider interface:

import { StorageProvider } from '@afilmory/builder'

class MyStorageProvider implements StorageProvider {
  async getFile(key: string): Promise<Buffer | null> {
    // Your implementation
  }

  async listImages(): Promise<StorageObject[]> {
    // Your implementation
  }

  // ... other required methods
}

Custom Builder Plugin

Create a plugin for the build pipeline:

import { BuilderPlugin } from '@afilmory/builder'

export const myPlugin = (): BuilderPlugin => ({
  name: 'my-plugin',
  async onBeforeBuild(context) {
    // Pre-build hook
  },
  async onAfterBuild(context) {
    // Post-build hook
  },
})

📚 Documentation

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting (pnpm test && pnpm lint)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

📄 License

Attribution Network License (ANL) v1.0 © 2025 Afilmory Team

See LICENSE for more details.

🔗 Links

from  https://github.com/Afilmory/afilmory