spectrum README

The project's README from github.com/withspectrum/spectrum. As one markdown file: README.md.

Spectrum

Simple, powerful online communities.

This is the main monorepo codebase of Spectrum. Every single line of code that's not packaged into a reusable library is in this repository.

What is Spectrum?

Vision

It is difficult to grow, manage and measure the impact of online communities. Community owners need modern, chat-based communities but are running into scaling issues when their community grows beyond a few hundred members. It becomes hard to keep track of who's who, know what conversations are happening, and ensure that the community is staying healthy and productive.

Spectrum aims to be the best platform to build any kind of community online by combining the best of forums and real-time chat apps. With best-in-class moderation tooling, a single platform for all your communities, threaded conversations by default, community health monitoring, and much more to come we think that we will be able to help more people start and grow the best online communities.

"[Spectrum] will take the place that Reddit used to have a long time ago for communities (especially tech) to freely share ideas and interact. Except realtime and trolling-free."

- Guillermo Rauch (@rauchg)

Status

Spectrum has been in full-time development since March 2017 and is part of GitHub since November 2018. See our current priorities and what we are working on in the main project board.

Docs

Contributing

We heartily welcome any and all contributions that match our engineering standards!

That being said, this codebase isn't your typical open source project because it's not a library or package with a limited scope—it's our entire product.

Ground Rules

Contributions and discussion guidelines

All conversations and communities on Spectrum agree to GitHub's Community Guidelines and Acceptable Use Policies. This code of conduct also applies to all conversations that happen within our contributor community here on GitHub. We expect discussions in issues and pull requests to stay positive, productive, and respectful. Remember: there are real people on the other side of that screen!

Reporting a bug or discussing a feature idea

If you found a technical bug on Spectrum or have ideas for features we should implement, the issue tracker is the best place to share your ideas. Make sure to follow the issue template and you should be golden! (click here to open a new issue)

Fixing a bug or implementing a new feature

If you find a bug on Spectrum and open a PR that fixes it we'll review it as soon as possible to ensure it matches our engineering standards.

If you want to implement a new feature, open an issue first to discuss what it'd look like and to ensure it fits in our roadmap and plans for the app (see the main project board for planned and currently ongoing work).

If you want to contribute but are unsure to start, we have a "good first issue" label which is applied to newcomer-friendly issues. Take a look at the full list of good first issues and pick something you like! There is also an "open" channel in the Spectrum community on Spectrum (how meta), if you run into troubles while trying to contribute that is the best place to talk to us.

Want to fix a bug or implement an agreed-upon feature? Great, jump to the local setup instructions!

Codebase

Technologies

With the ground rules out of the way, let's talk about the coarse architecture of this mono repo:

Folder structure

spectrum/
├── api        # API server
├── docs
├── hyperion   # Rendering server
├── public     # Public files used on the frontend
├── shared     # Shared JavaScript code
├── src        # Frontend SPA
Click to learn about the worker naming scheme

Naming Scheme

As you can see we follow a loose naming scheme based on ancient Greek, Roman, and philosophical figures that are somewhat related to what our servers do:

  • Hyperion: (/haɪˈpɪəriən/) is one of the twelve Titan children of Gaia and Uranus.

Code Style

We run Prettier on-commit, which means you can write code in whatever style you want and it will be automatically formatted according to the common style when you run git commit. We also have ESLint set up, although we've disabled all stylistic rules since Prettier takes care of those.

Rules

First time setup

The first step to running Spectrum locally is downloading the code by cloning the repository:

git clone [email protected]:withspectrum/spectrum.git

If you get Permission denied error using ssh refer here or use https link as a fallback.

git clone https://github.com/withspectrum/spectrum.git

Installation

Spectrum has four big installation steps:

  1. Install RethinkDB: See the RethinkDB documentation for instructions on installing it with your OS.
  2. Install Redis: See the Redis documentation for instructions on installing it with your OS.
  3. Install yarn: We use yarn to handle our JavaScript dependencies. (plain npm doesn't work due to our monorepo setup) See the yarn documentation for instructions on installing it.
  4. Install the dependencies: Because it's pretty tedious to install the dependencies for each worker individually we've created a script that goes through and runs yarn install for every worker for you: (this takes a couple minutes, so dive into the technical docs in the meantime)
node shared/install-dependencies.js

You've now finished installing everything! Let's migrate the database and you'll be ready to go :100:

Migrating the database

When you first download the code and want to run it locally you have to migrate the database and seed it with test data. First, start rethinkdb in its own terminal tab:

rethinkdb

Then, in a new tab, run these commands:

yarn run db:migrate
yarn run db:seed
# ⚠️ To empty the database (e.g. if there's faulty data) run yarn run db:drop

There's a shortcut for dropping, migrating and seeding the database too:

yarn run db:reset

The testing database used in end to end tests is managed separately. It is built, migrated, and seeded when you run:

yarn run start:api:test

To drop the testing database, go to http://localhost:8080/#tables while rethinkdb is running, and click Delete Database on the appropriate database.

Getting the secrets

While the app will run without any secrets set up, you won't be able to sign in locally. To get that set up, copy the provided example secrets file to the real location:

cp now-secrets.example.json now-secrets.json

Note: If you're an employee at Spectrum we've got a more complete list of secrets that also lets you upload images etc. in 1Password, search for "now-secrets.json" to find it.

Now you're ready to run the app locally and sign into your local instance!

Running the app locally

Background services

Whenever you want to run Spectrum locally you have to have RethinkDB and Redis running in the background. First start rethinkdb like we did to migrate the database:

rethinkdb

Then (without closing the rethinkdb tab!) open another tab and start Redis:

redis-server

Start the servers

Depending on what you're trying to work on you'll need to start different servers. Generally, all servers run in development mode by doing yarn run dev:<workername>, e.g. yarn run dev:hermes to start the email worker.

No matter what you're trying to do though, you'll want to have the API running, so start that in a background tab:

yarn run dev:api

Develop the web UI

To develop the frontend and web UI run

yarn run dev:web

GitHub

Spectrum is now part of GitHub. For code of conduct, please see GitHub's Community Guidelines and Acceptable Use Policies.

License

BSD 3-Clause, see the LICENSE file.

spectrum (withspectrum/spectrum)

Searching Database…

10.8K ·GitHub
archived
这是什么?Spectrum 是一个社区平台的开源代码库,它把论坛式的话题串讨论与实时聊天结合在一起,旨在让在线社区更容易发展和管理。
这是可复用的库,还是完整的产品?这是完整的生产应用,而不是库。它是一个全栈单体仓库,包含 API、Web 前端和后台工作服务,共同驱动 Spectrum。
我该如何在本地运行它?克隆仓库,安装 RethinkDB、Redis 和 Yarn,然后运行提供的脚本,为单体仓库中的每个工作服务安装依赖;迁移并填充数据库之后,再分别使用 yarn run dev 命令启动 API 和 Web 开发服务器。
我运行前需要安装什么?你需要 RethinkDB 用于数据存储,Redis 用于后台任务和缓存,还需要 Yarn 来管理整个单体仓库的依赖(直接使用 npm 在这套配置下无法工作)。
这个项目还在继续开发吗?不了。该仓库已归档。Spectrum 于 2018 年 11 月被 GitHub 收购并成为其一部分,该项目不再作为独立的开源代码库进行维护。
我能自己部署这个项目吗?可以。它被设计为可自托管的 Web 应用,你需要自行运行 Node.js API、React Web 前端以及后台工作服务(例如 'hermes' 邮件服务),并同时运行 RethinkDB 和 Redis。
为什么 Spectrum 要求新文件使用 Flowtype?Flowtype 是在第一个版本发布之后才加入的。因此团队要求所有新增的 .js 文件都必须在 CI 中加上 Flow 类型标注,以逐步提升类型安全性。不过,如果你在 PR 中说明,也可以先提交普通的 JS 代码,团队会帮你补上类型标注。
像 Hyperion 这样的后台工作服务是怎么命名的?后台工作服务的名字取自希腊和罗马神话或哲学中的人物,这些人物与其工作内容有一定的联系。例如 'Hyperion',即盖亚与乌拉诺斯的提坦子嗣之一。
GraphQL API 和身份验证是由什么技术支撑的?API 基于完整的 Apollo GraphQL 工具链运行,身份验证由 PassportJS 负责。存储使用 RethinkDB,缓存和后台任务则使用 Redis。
Size
52.7 MB
Stars
10.8K
Age
10y
Commits · 90 Days