Giv Effektivt is a charity organisation enabling people to donate from Denmark to highly effective charities around the world.
- API is written using NextJS framework.
- Data in stored in a PostgreSQL database.
- Frontend is hosted on Framer.
To install, follow https://docs.docker.com/engine/install/ubuntu/.
dbmate is used to apply migrations from db/migrations directory. You can use it to apply migrations to your local database for testing.
dbmate uses DATABASE_URL, most likely you can put exactly this in .envrc:
export DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@$PGHOST:5432/$PGDATABASE?sslmode=disable&search_path=giveffektivt
or, if you are not using direnv, you can specify the url like that:
dbmate -u "postgres://postgres:password@localhost:5432/giveffektivt?sslmode=disable&search_path=giveffektivt" migrate
The -u just after dbmate is used to set a flag for the dbmate not migrate
To install, follow https://github.com/amacneil/dbmate
docker-compose upto get the local database.dbmate migrateto apply the migrations. Rundbmate -u "postgres://postgres:password@localhost:5432/giveffektivt?sslmode=disable&search_path=giveffektivt" migrateif you are not using- Optionally, to fill local DB with a copy of data from DEV:
pg_dump postgres://<dev-connection-string> --data-only --exclude-table schema_migrations --exclude-schema cron | psqlpsqlrequired. Check section database tools docker-compose downto shut it down preserving the local data (add-vto also clear the data).
- Clone the app.
- Run
yarn installto install dependencies. - Spin up the database with
docker-compose upand (if you haven't done that) apply migrations withdbmate migrate(check spinning up the database) - Create a file
.envand copy contents of.env.exampleto it. - Swap value of email username and email password with real values.
- Set
PAYMENT_GATEWAYto a preferred payment gateway (supported values are listed inpayment_gatewayenum in database). - Set values for corresponding payment gateways (leave
QUICKPAY_CALLBACK_URLempty unless you want Quickpay to send you a callback). - and
yarn devto run the app.
There are integration tests validating database logic, which can be executed using yarn test. The tests require database to be present, as per documentation above. The tests will run in a separate database called test, which is fully recreated on every run.
- How to test the payment gateway?
Use Quickpay test cards and these transactions would automatically be treated as test transactions.
