Skip to content

formidablefrank/cards_against_humanity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

633 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unofficial Cards Against Humanity, Online

An unofficial online version of the Cards Against Humanity game. Pairs well with friends, booze and video chat.

Click here to play.

Put together by Kevin Bongart so he could play his beloved game with friends during tough times. Not affiliated with the official Cards Against Humanity company, but you should absolutely buy their game because it's a lot more fun in person. Remixed under Creative Commons BY-NC-SA 2.0 license.

The cards were imported from json-against-humanity.

Development setup

This is a Ruby on Rails application that requires Ruby, PostgreSQL and Redis.

  1. Install Ruby, preferrably with rbenv
  2. Install dependencies:
$ gem install bundler
$ bundle install
$ yarn install
  1. Create, migrate and populate the database:
$ bundle exec rails db:create db:migrate db:seed
  1. Start the web server and the background job processor:
$ bundle exec rails server
$ bundle exec sidekiq

Streaming game updates to clients goes through background jobs, so Sidekiq is required (otherwise, players need to refresh the page manually).

Alternatively, you can use an application process manager to start both the web server and background job processor. Foreman is a good Ruby-based option, but there are many alternatives to suit your needs:

$ gem install foreman
$ foreman start web=1,worker=1

Running the test suite

bundle exec rspec
  1. Open a browser to http://localhost:3000

Run on Docker

Make sure you have Docker Engine installed. To configure the containers, you may modify the files Dockerfile and docker-compose.yml.

  1. Build the image:
docker compose build [--no-cache]
  1. Create you own environment variables:
cp .env.example .env
vim .env
  1. Precompile assets then create, migrate, and seed the database:
docker compose [--env-file .env] run --rm web bundle exec rails assets:precompile db:create db:migrate db:seed 
  1. Optional, run the test suite:
docker compose [--env-file .env] run --rm web bundle exec rspec
  1. Start the web and worker services:
docker compose [--env-file .env] up

If successful, you should see something like this:

web-1     | => Booting Puma
web-1     | => Rails 7.0.4.3 application starting in development 
web-1     | => Run `bin/rails server --help` for more startup options
worker-1  | 2026-01-08T14:04:35.732Z pid=1 tid=e0h INFO: Booted Rails 7.0.4.3 application in development environment
worker-1  | 2026-01-08T14:04:35.732Z pid=1 tid=e0h INFO: Running in ruby 3.3.2 (2024-05-30 revision e5a195edf6) [aarch64-linux]
worker-1  | 2026-01-08T14:04:35.732Z pid=1 tid=e0h INFO: See LICENSE and the LGPL-3.0 for licensing details.
worker-1  | 2026-01-08T14:04:35.732Z pid=1 tid=e0h INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org
worker-1  | 2026-01-08T14:04:35.732Z pid=1 tid=e0h INFO: Sidekiq 7.2.2 connecting to Redis with options {:size=>10, :pool_name=>"internal", :url=>"redis://redis:6379/1"}
worker-1  | 2026-01-08T14:04:35.735Z pid=1 tid=e0h INFO: Sidekiq 7.2.2 connecting to Redis with options {:size=>10, :pool_name=>"default", :url=>"redis://redis:6379/1"}
web-1     | Puma starting in single mode...
web-1     | * Puma version: 6.4.2 (ruby 3.3.2-p78) ("The Eagle of Durango")
web-1     | *  Min threads: 5
web-1     | *  Max threads: 5
web-1     | *  Environment: development
web-1     | *          PID: 1
web-1     | * Listening on http://0.0.0.0:3000
web-1     | Use Ctrl-C to stop
db-1      | 2026-01-08 15:08:37.556 CET [26] LOG:  checkpoint starting: time
db-1      | 2026-01-08 15:08:37.668 CET [26] LOG:  checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.106 s, sync=0.002 s, total=0.113 s; sync files=3, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
redis-1   | 1:M 08 Jan 2026 14:08:38.027 * 100 changes in 300 seconds. Saving...
redis-1   | 1:M 08 Jan 2026 14:08:38.028 * Background saving started by pid 22
  1. On your browser, go to http://localhost:3000 to start playing with your friends.

  2. To stop the containers, execute:

docker compose down [-v]

When deploying in production, it is highly advised to serve the application behind nginx with SSL certificates. More instructions here.

About

An unofficial online version of the Cards Against Humanity game.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 70.7%
  • HTML 20.6%
  • JavaScript 5.3%
  • SCSS 2.3%
  • Other 1.1%