Social Cinema/TV and reviewing, decentralized with ActivityPub
Find a file
2021-03-04 19:27:03 +01:00
.github [lint] Fix indentation in .md files. 2021-03-04 19:05:01 +01:00
bookwyrm [lint] fix indentation in CSS files. 2021-03-04 19:27:03 +01:00
celerywyrm Translations working in templates 2021-02-27 16:18:56 -08:00
locale Adds compiled german language file 2021-03-02 13:51:56 -08:00
nginx Move prod config files to prod branch 2020-10-16 13:02:58 -07:00
.coveragerc [lint] Fix missing new lines. 2021-03-04 18:44:36 +01:00
.dockerignore [lint] Fix missing new lines. 2021-03-04 18:44:36 +01:00
.editorconfig [lint] Ignore newline in svg files within fonts/. 2021-03-04 19:24:11 +01:00
.env.example Use ENV variables in fr-dev 2020-11-19 13:03:04 -08:00
.gitignore [lint] Fix missing new lines. 2021-03-04 18:44:36 +01:00
bw-dev Updates bw-dev makemessages default flags 2021-03-02 11:51:49 -08:00
CODE_OF_CONDUCT.md [lint] Fix indentation in .md files. 2021-03-04 19:05:01 +01:00
docker-compose.yml Add support for pytest 2020-11-08 12:14:57 -08:00
Dockerfile Fixes (hopefully) makemessages command 2021-03-01 09:55:54 -08:00
fr-dev Move fr-dev to bw-dev and alias it as fr-dev 2020-11-19 13:50:59 -08:00
instances.md Update instances.md 2021-02-07 17:12:53 -08:00
LICENSE Updates license version 2020-10-02 15:41:04 -07:00
manage.py
pytest.ini Create example marker to avoid tests that require external domain 2020-11-08 13:07:37 -08:00
README.md [lint] Fix indentation in .md files. 2021-03-04 19:05:01 +01:00
requirements.txt Allow markdown in html fields 2020-12-19 18:54:56 -08:00

BookWyrm

Social reading and reviewing, decentralized with ActivityPub

Contents

Joining BookWyrm

BookWyrm is still a young piece of software, and isn't at the level of stability and feature-richness that you'd find in a production-ready application. But it does what it says on the box! If you'd like to join an instance, you can check out the instances list.

You can request an invite to https://bookwyrm.social by email, Mastodon direct message, or Twitter direct message.

Contributing

There are many ways you can contribute to this project, regardless of your level of technical expertise.

Feedback and feature requests

Please feel encouraged and welcome to point out bugs, suggestions, feature requests, and ideas for how things ought to work using GitHub issues.

Code contributions

Code contributions are gladly welcomed! If you're not sure where to start, take a look at the "Good first issue" tag. Because BookWyrm is a small project, there isn't a lot of formal structure, but there is a huge capacity for one-on-one support, which can look like asking questions as you go, pair programming, video chats, et cetera, so please feel free to reach out.

If you have questions about the project or contributing, you can set up a video call during BookWyrm "office hours".

Translation

Do you speak a language besides English? BookWyrm needs localization! If you're comfortable using git and want to get into the code, there are instructions on how to create and edit localization files. If you feel more comfortable working in a regular text editor and would prefer not to run the application, get in touch directly and we can figure out a system, like emailing a text file, that works best.

Financial Support

BookWyrm is an ad-free passion project with no intentions of seeking out venture funding or corporate financial relationships. If you want to help keep the project going, you can donate to the Patreon, or make a one time gift via PayPal.

About BookWyrm

What it is and isn't

BookWyrm is a platform for social reading! You can use it to track what you're reading, review books, and follow your friends. It isn't primarily meant for cataloguing or as a data-source for books, but it does do both of those things to some degree.

The role of federation

BookWyrm is built on ActivityPub. With ActivityPub, it inter-operates with different instances of BookWyrm, and other ActivityPub compliant services, like Mastodon. This means you can run an instance for your book club, and still follow your friend who posts on a server devoted to 20th century Russian speculative fiction. It also means that your friend on mastodon can read and comment on a book review that you post on your BookWyrm instance.

Federation makes it possible to have small, self-determining communities, in contrast to the monolithic service you find on GoodReads or Twitter. An instance can be focused on a particular interest, be just for a group of friends, or anything else that brings people together. Each community can choose which other instances they want to federate with, and moderate and run their community autonomously. Check out https://runyourown.social/ to get a sense of the philosophy and logistics behind small, high-trust social networks.

Features

Since the project is still in its early stages, the features are growing every day, and there is plenty of room for suggestions and ideas. Open an issue to get the conversation going!

  • Posting about books
    • Compose reviews, with or without ratings, which are aggregated in the book page
    • Compose other kinds of statuses about books, such as:
      • Comments on a book
      • Quotes or excerpts
    • Reply to statuses
    • View aggregate reviews of a book across connected BookWyrm instances
    • Differentiate local and federated reviews and rating in your activity feed
  • Track reading activity
    • Shelve books on default "to-read," "currently reading," and "read" shelves
    • Create custom shelves
    • Store started reading/finished reading dates, as well as progress updates along the way
    • Update followers about reading activity (optionally, and with granular privacy controls)
    • Create lists of books which can be open to submissions from anyone, curated, or only edited by the creator
  • Federation with ActivityPub
    • Broadcast and receive user statuses and activity
    • Share book data between instances to create a networked database of metadata
    • Identify shared books across instances and aggregate related content
    • Follow and interact with users across BookWyrm instances
    • Inter-operate with non-BookWyrm ActivityPub services (currently, Mastodon is supported)
  • Granular privacy controls
    • Private, followers-only, and public privacy levels for posting, shelves, and lists
    • Option for users to manually approve followers
    • Allow blocking and flagging for moderation

The Tech Stack

Web backend

Front end

  • Django templates
  • Bulma.io css framework
  • Vanilla JavaScript, in moderation

Deployment

Setting up the developer environment

Set up the environment file:

cp .env.example .env

For most testing, you'll want to use ngrok. Remember to set the DOMAIN in .env to your ngrok domain.

You'll have to install the Docker and docker-compose. When you're ready, run:

docker-compose build
docker-compose run --rm web python manage.py migrate
docker-compose run --rm web python manage.py initdb
docker-compose up

Once the build is complete, you can access the instance at localhost:1333

Editing static files

If you edit the CSS or JavaScript, you will need to run Django's collectstatic command in order for your changes to have effect. You can do this by running:

./bw-dev collectstatic

Workin with translations and locale files

Text in the html files are wrapped in translation tags ({% trans %} and {% blocktrans %}), and Django generates locale files for all the strings in which you can add translations for the text. You can find existing translations in the locale/ directory.

The application's language is set by a request header sent by your browser to the application, so to change the language of the application, you can change the default language requested by your browser.

Adding a locale

To start translation into a language which is currently supported, run the django-admin makemessages command with the language code for the language you want to add (like de for German, or en-gb for British English):

./bw-dev makemessages -l <language code>

Editing a locale

When you have a locale file, open the django.po in the directory for the language (for example, if you were adding German, locale/de/LC_MESSAGES/django.po. All the the text in the application will be shown in paired strings, with msgid as the original text, and msgstr as the translation (by default, this is set to an empty string, and will display the original text).

Add you translations to the msgstr strings, and when you're ready, compile the locale by running:

./bw-dev compilemessages

You can add the -l <language code> to only compile one language. When you refresh the application, you should see your translations at work.

Installing in Production

This project is still young and isn't, at the moment, very stable, so please proceed with caution when running in production.

Server setup

  • Get a domain name and set up DNS for your server
  • Set your server up with appropriate firewalls for running a web application (this instruction set is tested against Ubuntu 20.04)
  • Set up an email service (such as mailgun) and the appropriate SMTP/DNS settings
  • Install Docker and docker-compose

Install and configure BookWyrm

The production branch of BookWyrm contains a number of tools not on the main branch that are suited for running in production, such as docker-compose changes to update the default commands or configuration of containers, and individual changes to container config to enable things like SSL or regular backups.

Instructions for running BookWyrm in production:

  • Get the application code: git clone git@github.com:mouse-reeve/bookwyrm.git
  • Switch to the production branch git checkout production
  • Create your environment variables file cp .env.example .env
    • Add your domain, email address, SMTP credentials
    • Set a secure redis password and secret key
    • Set a secure database password for postgres
  • Update your nginx configuration in nginx/default.conf
    • Replace your-domain.com with your domain name
  • Run the application (this should also set up a Certbot ssl cert for your domain) with docker-compose up --build, and make sure all the images build successfully
  • When docker has built successfully, stop the process with CTRL-C
  • Comment out the command: certonly... line in docker-compose.yml
  • Run docker-compose in the background with: docker-compose up -d
  • Initialize the database with: ./bw-dev initdb
  • Set up schedule backups with cron that runs that docker-compose exec db pg_dump -U <databasename> and saves the backup to a safe location

Congrats! You did it, go to your domain and enjoy the fruits of your labors.

Configure your instance

  • Register a user account in the application UI
  • Make your account a superuser (warning: do not use django's createsuperuser command)
    • On your server, open the django shell ./bw-dev shell
    • Load your user and make it a superuser
    from bookwyrm import models
    user = models.User.objects.get(id=1)
    user.is_staff = True
    user.is_superuser = True
    user.save()
    
    • Go to the site settings (/settings/site-settings on your domain) and configure your instance name, description, code of conduct, and toggle whether registration is open on your instance

Book data

The application is set up to share book and author data between instances, and get book data from arbitrary outside sources. Right now, the only connector is to OpenLibrary, but other connectors could be written.

There are three concepts in the book data model:

  • Book, an abstract, high-level concept that could mean either a Work or an Edition. No data is saved as a Book, it serves as shared model for Work and Edition
  • Work, the theoretical umbrella concept of a book that encompasses every edition of the book, and
  • Edition, a concrete, actually published version of a book

Whenever a user interacts with a book, they are interacting with a specific edition. Every work has a default edition, but the user can select other editions. Reviews aggregated for all editions of a work when you view an edition's page.