forem README

项目的 README,来自 github.com/forem/forem。合并为一个 markdown 文件:README.md。

Forem 🌱

For Empowering Community

Build StatusBuild StatusGitHub commit activityGitHub issues ready for dev

Welcome to the Forem codebase, the platform that powers dev.to. We are so excited to have you. With your help, we can build out Forem’s usability, scalability, and stability to better serve our communities.

What is Forem?

Forem is open source software for building communities. Communities for your peers, customers, fanbases, families, friends, and any other time and space where people need to come together to be part of a collective. See our announcement post for a high-level overview of what Forem is.

dev.to (or just DEV) is hosted by Forem. It is a community of software developers who write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place within our community. ❤️

Table of Contents

Contributing

We welcome pull requests on any issue, regardless of its current status, if it provides a fix or improvement. While we cannot guarantee that every PR will be merged, we value legitimate suggestions and contributions.

All pull requests should include appropriate tests. Our current focus is primarily on backend-related regression tests, while frontend changes may require more extensive user review.

We welcome AI-assisted pull requests but will turn away "slop" — all submissions must maintain high standards of code quality and meaningful utility.

🤖 AI Agents: Check out AGENTS.md for more instructions. Forem also synchronizes these rules across .cursorrules, .windsurfrules, and .github/copilot-instructions.md for specific IDEs and environments.

Please also check out the Contributing to Forem guide for more detailed guidelines.

Getting Started

This section provides a high-level quick start guide. If you're looking for a more thorough installation guide (for example with macOS), you'll want to refer to our complete Developer Documentation.

Installation Documentation

Please see our installation guides:

We run on a Rails backend, and we are currently transitioning to a Preact-first frontend.

Prerequisites Note: Forem now utilizes advanced AI embeddings for feed generation. You must ensure your PostgreSQL installation has the pgvector extension (version 0.8.0 or higher) installed to support HNSW indexing. This database extension is a hard requirement to migrate the database and run the app.

To install pgvector:

  • macOS (Homebrew): brew install pgvector
  • Linux (Debian/Ubuntu): sudo apt install postgresql-15-pgvector (adjust 15 to match your installed PostgreSQL version), or compile from source following the pgvector installation guide.

Providing a Gemini API key (GEMINI_API_KEY) to actually generate the embeddings is completely optional; if omitted, the app will continue to function normally without semantic recommendations.

A more complete overview of our stack is available in our docs.

Launching in a Cloud Dev Environment

[!important] Ona (formerly Gitpod) is closed to new signups, so it is no longer a recommended route for new contributors.

Developer Documentation

Check out our dedicated docs page for more technical documentation. Please note that while the documentation is a great place to start, some parts may be out of date as the project evolves.

Deployment with Kamal 2

Forem is preconfigured with Kamal 2 (v2.12+) for zero-downtime deployments to bare-metal servers, DigitalOcean Droplets, Hetzner, AWS, GCP, or multi-node clusters.

For the full end-to-end walkthrough — including destination profiles (managed, cluster, edge, staging), S3/Spaces/R2 object storage, registry/builder options, backups, and cloud gotchas — see the Kamal Deployment Guide.

Prerequisites

  1. SSH access to your target Linux server(s) (Ubuntu 22.04/24.04 or Debian recommended).
  2. Docker + Buildx installed on your local machine (Kamal installs Docker on target servers automatically during setup).
  3. A domain name pointed at your server (or use -d staging for raw-IP HTTP testing).

Quickstart (Single Server / DigitalOcean Droplet)

  1. Copy the environment template and fill in your server IP, domain, and generated secrets:

    cp .env.kamal.example .env.kamal
    # Set KAMAL_HOST, APP_DOMAIN, SECRET_KEY_BASE (`openssl rand -hex 64`), and POSTGRES_PASSWORD
    
  2. Load your environment and verify the configuration:

    set -a && source .env.kamal && set +a
    bundle exec kamal config
    
  3. Run initial setup and deploy (uses Kamal's built-in localhost:5555 registry, pgvector/pgvector:pg16, redis:7-alpine, Let's Encrypt HTTPS, persistent forem_uploads, and automatic DB initialization):

    # Initial server bootstrap, accessories, build, DB setup, and app boot
    bundle exec kamal setup
    
    # Subsequent rolling deploys
    bundle exec kamal deploy
    
  4. Optional hosting profiles via Kamal destinations (-d):

    • bundle exec kamal setup -d managed — Managed PostgreSQL (pgvector) + Managed Redis/Valkey + Object Storage
    • bundle exec kamal setup -d cluster — Multi-node web + job fleet behind a Load Balancer
    • bundle exec kamal setup -d edge — Single node behind Cloudflare Proxy, Fastly, or a Load Balancer
    • bundle exec kamal setup -d staging — Raw-IP / VM preview over HTTP without DNS/TLS

For day-2 operations (bundle exec kamal console, logs, dbc, migrate), provider-specific guides, and troubleshooting, refer to docs/kamal-deployment.md and the Kamal documentation.

Vulnerability Disclosure

Forem is the open source software which powers DEV.

We welcome security research on DEV under the terms of our vulnerability disclosure policy.

Acknowledgements

Thank you to the Twemoji project for the usage of their emojis.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Please see the LICENSE file in our repository for the full text.

Like many open source projects, we require that contributors provide us with a Contributor License Agreement (CLA). By submitting code to the Forem project, you are granting us a right to use that code under the terms of the CLA.

Our version of the CLA was adapted from the Microsoft Contributor License Agreement, which they generously made available to the public domain under Creative Commons CC0 1.0 Universal.

Any questions, please refer to our license FAQ doc or email [email protected].


Sloan, the sloth mascot
Happy Coding ❤️

⬆ Back to Top

forem (forem/forem)

正在搜索数据库…

22.8K ·GitHub
这是什么?Forem 是一款用于搭建社区的开源软件——dev.to 背后的平台就是它。你可以用它搭建自己的空间,让成员发布文章、参与讨论、建立个人主页。
这是像 dev.to 那样注册就能用的网站,还是我自己部署的软件?它是一个完整的 Web 应用,需要你自己部署,不是托管注册的服务。dev.to 只是 Forem 团队运营的旗舰站点;这个仓库就是它背后整套 Rails 代码。
怎么在本地把它跑起来?按照官方的 macOS 或 Linux 安装指南操作(两种方式都不用容器),或者把仓库在 Ona(原 Gitpod)里打开——那个环境会自动配好所有服务和依赖。生产环境部署则用自带的 Kamal 2 方案。
运行之前我需要先装好哪些东西?后端是 Ruby on Rails 加 PostgreSQL,前端以 Preact 为主,用 Node 20.x 和 yarn 1.22.18 的工具链构建。官方提供了 macOS 和 Linux 的安装指南。
安装过程中有什么容易踩的坑吗?有——PostgreSQL 的 pgvector 扩展(0.8.0 或更高版本)是硬性要求:没有它数据库迁移会失败。macOS 上用 brew install pgvector 安装,Debian/Ubuntu 上装 postgresql-15-pgvector。
想部署到真正的服务器上该怎么走?用自带的 Kamal 2 方案(beta):准备好 SSH 访问、两端的 Docker 和一个容器镜像仓库账号之后,编辑 config/deploy.yml,导出 RAILS_MASTER_KEY、DATABASE_URL 之类的变量,就能部署到任意云虚拟机或物理服务器上。
AI 推荐的信息流需要 API 密钥吗?不需要。pgvector 相关的基础设施是必须的,但提供 GEMINI_API_KEY 来生成向量嵌入是可选的——没有密钥应用照样正常运行,只是信息流里没有语义推荐功能。
dev.to 和这个项目有什么关系?dev.to 是项目方自己运营的一个 Forem 社区——开发者在上面写文章、参与讨论、建立职业主页。部署 Forem,你就拥有了一个 DEV 风格的自己的网站。
技术栈是什么样的?后端是 Ruby on Rails,前端正在转向以 Preact 为主。仓库里自带 Storybook、Jest、ESLint 和 Cypress 的配置,还有 CI 流水线——前端工具链是 Node 20.x 搭配 yarn 1.22.18。
不在本地安装任何东西也能试用吗?可以——这个仓库已为 Ona(原 Gitpod)开发环境做了完整配置:在 Ona 里打开项目,所有必要的服务和依赖都会自动配置好。
有哪些类似的项目?diaspora, discourse, mastodon, sure, dawarich, chatwoot, lemmy, misskey
作者
forem
大小
1.8 GB
星标
22.8K
更新
提交Nov 27
时长
10年
提交 · 90 天