All Projects → liberapay → Liberapay.com

liberapay / Liberapay.com

Source code of the recurrent donations platform Liberapay

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Liberapay.com

Dinero.js
Create, calculate, and format money in JavaScript and TypeScript.
Stars: ✭ 5,286 (+415.71%)
Mutual labels:  money
Cryptocoins
Cryptocoins is the most complete vector/webfont icon pack of your favourite cryptocurrencies
Stars: ✭ 810 (-20.98%)
Mutual labels:  money
Money
A money and currency library for PHP
Stars: ✭ 855 (-16.59%)
Mutual labels:  money
Joda Money
Java library to represent monetary amounts.
Stars: ✭ 542 (-47.12%)
Mutual labels:  money
Yoda
Wise and powerful personal assistant, available in your nearest terminal
Stars: ✭ 674 (-34.24%)
Mutual labels:  money
Money
A precise, type-safe representation of a monetary amount in a given currency
Stars: ✭ 817 (-20.29%)
Mutual labels:  money
Laravel Paystack
💳 📦 💰 Laravel 6, 7 and 8 Package for Paystack
Stars: ✭ 398 (-61.17%)
Mutual labels:  money
Tic Tac
Client not paid ? This is the solution of your problem
Stars: ✭ 29 (-97.17%)
Mutual labels:  money
Lemonade Stand
A handy guide to financial support for open source
Stars: ✭ 6,513 (+535.41%)
Mutual labels:  money
Mintable
🍃 Automate your personal finances – for free, with no ads, and no data collection.
Stars: ✭ 849 (-17.17%)
Mutual labels:  money
Crypto Trader
💰 Cryptocurrency trading bot library with a simple example strategy (trading via Gemini).
Stars: ✭ 554 (-45.95%)
Mutual labels:  money
Budget
Get a grip on your finances.
Stars: ✭ 609 (-40.59%)
Mutual labels:  money
Go Money
Go implementation of Fowler's Money pattern
Stars: ✭ 887 (-13.46%)
Mutual labels:  money
Transity
Keep track of your 💵, 🕘, 🐖, 🐄, 🍻 on your command line
Stars: ✭ 528 (-48.49%)
Mutual labels:  money
Goodies
Useful stuff missing from .NET for example duck typing, CSP channels, caching, money, typed ids...
Stars: ✭ 11 (-98.93%)
Mutual labels:  money
Akaunting
Free and Online Accounting Software
Stars: ✭ 4,599 (+348.68%)
Mutual labels:  money
Rulerview
卷尺系列控件,包含:普通卷尺(如:体重)、金额尺、时间尺
Stars: ✭ 816 (-20.39%)
Mutual labels:  money
Toolkit For Ynab
A general purpose YNAB enhancing browser extension for Chrome and Firefox. Have it your way!
Stars: ✭ 1,006 (-1.85%)
Mutual labels:  money
Augmint Web
Augmint Web Frontend
Stars: ✭ 15 (-98.54%)
Mutual labels:  money
Moneymanagerex
Money Manager Ex is an easy to use, money management application built with wxWidgets
Stars: ✭ 836 (-18.44%)
Mutual labels:  money

Liberapay

Build Status Weblate Open Source Helpers Gitter Income Donate

Liberapay is a recurrent donations platform. We help you fund the creators and projects you appreciate.

Note: This webapp is not self-hostable.

Table of Contents

Contact

Want to chat? Join us on Gitter. (If you use IRC, Gitter has a gateway, and we're also in the #liberapay channel on Freenode.)

Alternatively you can post a message in our GitHub salon.

Contributing to the translations

You can help translate Liberapay via Weblate. Current status:

global translation status

translation status by language

If you have questions about translating Liberapay, you can ask them in the salon.

Contributing to the code

Introduction

Liberapay was originally forked from Gratipay and inherited its web micro-framework Pando ( Aspen), which is based on filesystem routing and simplates. Don't worry, it's quite simple. For example to make Liberapay return a Hello $user, your id is $userid message for requests to the URL /$user/hello, you only need to create the file www/%username/hello.spt with this inside:

from liberapay.utils import get_participant
[---]
participant = get_participant(state)
[---] text/html
{{ _("Hello {0}, your id is {1}", request.path['username'], participant.id) }}

As illustrated by the last line our default template engine is Jinja.

The _ function attempts to translate the message into the user's language and escapes the variables properly (it knows that it's generating a message for an HTML page).

The python code inside simplates is only for request-specific logic, common backend code is in the liberapay/ directory.

Installation

Make sure you have the following dependencies installed first:

  • python ≥ 3.6
    • including the C headers of python and libffi, which are packaged separately in many Linux distributions
  • postgresql 9.6 (see the official download & install docs)
  • make

Then run:

make env

Now you need to give yourself superuser postgres powers (if it hasn't been done already), and create two databases:

su postgres -c "createuser --superuser $(whoami)"

createdb liberapay
createdb liberapay_tests

If you need a deeper understanding take a look at the Database Roles and Managing Databases sections of PostgreSQL's documentation.

Then you can set up the DB:

make schema

Configuration

Environment variables are used for configuration, the default values are in defaults.env and tests/test.env. You can override them in local.env and tests/local.env respectively.

Running

Once you've installed everything and set up the database, you can run the app:

make run

It should now be accessible at http://localhost:8339/.

There are no users provided by default. You can create accounts as you would on the real website, and if you want you can also create a bunch of fake users (but they're not great):

make data

To grant admin permissions to an account, modify the database like so:

psql liberapay -c "update participants set privileges = 1 where username = 'account-username'"

Payday

To run a local payday open http://localhost:8339/admin/payday and click the "Run payday" button. You can add OVERRIDE_PAYDAY_CHECKS=yes in the local.env file to disable the safety checks that prevent running payday at the wrong time.

SQL

The python code interacts with the database by sending raw SQL queries through the postgres.py library.

The official PostgreSQL documentation is your friend when dealing with SQL, especially the sections "The SQL Language" and "SQL Commands".

The DB schema is in sql/schema.sql, but don't modify that file directly, instead put the changes in sql/branch.sql. During deployment that script will be run on the production DB and the changes will be merged into sql/schema.sql. That process is semi-automated by release.sh.

CSS and JavaScript

For our styles we use SASS and Bootstrap 3. Stylesheets are in the style/ directory and our JavaScript code is in js/. Our policy for both is to include as little as possible of them: the website should be almost entirely usable without JS, and our CSS should leverage Bootstrap as much as possible instead of containing lots of custom rules that would become a burden to maintain.

We compile Bootstrap ourselves from the SASS source in the style/bootstrap/ directory. We do that to be able to easily customize it by changing values in style/variables.scss. Modifying the files in style/bootstrap/ is probably not a good idea.

Testing

The easiest way to run the test suite is:

make test

This recreates the test DB's schema and runs all the tests. To speed things up you can also use the following commands:

  • make pytest only runs the python tests without recreating the test DB
  • make pytest-re only runs the tests that failed previously

Updating test fixtures

Some of our tests include interactions with external services. In order to speed up those tests we record the requests and responses automatically using vcr. The records are in the tests/py/fixtures directory, one per test class.

If you add or modify interactions with external services, then the tests will fail, because VCR will not find the new or modified request in the records, and will refuse to record the new request by default (see Record Modes for more information). When that happens you can either switch the record mode from once to new_episodes (in liberapay/testing/vcr.py) or delete the obsolete fixture files.

If the new interactions are with MangoPay you have to delete the file tests/py/fixtures/MangopayOAuth.yml, otherwise you'll be using an expired authentication token and the requests will be rejected.

Speeding up the tests

PostgreSQL is designed to prevent data loss, so it does a lot of synchronous disk writes by default. To reduce the number of those blocking writes, our recreate-schema.sh script automatically switches the synchronous_commit option to off for the test database, however this doesn't completely disable syncing. If your PostgreSQL instance only contains data that you can afford to lose, then you can speed things up further by setting fsync to off in the server's configuration file (postgresql.conf).

Tinkering with payments

Liberapay was built on top of MangoPay for payments, however they kicked us out so we've shifted to integrating with multiple payment processors. We currently support Stripe and PayPal. However, support for Mangopay hasn't been completely removed yet.

Testing Stripe webhooks

You can forward Stripe's callbacks to your local Liberapay instance by running make stripe-bridge. The stripe-cli program has to be installed for this to work.

Modifying python dependencies

All new dependencies need to be audited to check that they don't contain malicious code or security vulnerabilities.

We use pip's Hash-Checking Mode to protect ourselves from dependency tampering. Thus, when adding or upgrading a dependency the new hashes need to be computed and put in the requirements file. For that you can use hashin:

pip install hashin
hashin package==x.y -r requirements_base.txt -p 3.6 -p 3.7
# note: we have several requirements files, use the right one

If for some reason you need to rehash all requirements, run make rehash-requirements.

To upgrade all the dependencies in a requirements file, run hashin -u -r requirements_XXX.txt -p 3.6 -p 3.7. You may have to run extra hashin commands if new subdependencies are missing.

Processing personal data

When writing code that handles personal information, keep in mind the principles enshrined in the GDPR.

Deploying the app

Note: Liberapay cannot be self-hosted, this section is only meant to document how we deploy new versions.

Liberapay is currently hosted on AWS (Ireland).

To deploy the app simply run release.sh, it'll guide you through it. Of course you need to be given access first.

License

CC0 Public Domain Dedication (See this discussion for details.)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].