MyHearty is a one-stop, centralized charity website for people to fundraise, donate, volunteer and apply for aids. The motivation behind this project stems from the idea of integrating fundraising, donation, volunteering and aiding functions into a single platform with API access. This project aims to connect various parties that are involved in charity via a centralized platform and provide open charity data via an API.
- Full-featured search UI (instant search, geosearch) for campaigns, volunteer events and aids
- Fundraising and donations
- Volunteering
- Receiving aids
- Managing organization/charity members
- API access
To get a local copy up and running, read the following subsections.
You need the following requirements to be able to run MyHearty locally.
- Node.js (Version: >=16.x)
- Yarn (recommended)
Note
If you want to enable any of the available integrations, you may want to obtain additional credentials and populate environment variables for the corresponding integration. Refer to the integrations section for more details.
This project is a Next.js monorepo that consists of 2 apps: MyHearty website and MyHearty dashboard. The detailed directory structure is shown below.
.
├── apps
│ ├── dashboard (MyHearty dashboard)
│ └── web (MyHearty website)
├── packages
│ ├── hooks (shared utility and query hooks)
│ ├── lib (API client functions, shared constants and types)
│ ├── ui (shared UI components)
│ └── utils (shared utility functions)
└── static (common assets: favicons, images, locales)
Note
Assets inside thestatic/
directory will be symlinked topublic/
directories of both apps. Hence, you only need to add assets to thestatic/
directory once and they will be available for both apps. During deployment, the symlinks will be removed and the assets will be copied from thestatic/
directory to each app'spublic/
directory. Refer toapps/**/package.json
for more detail.
- Clone the repo.
git clone https://github.com/myhearty-org/myhearty.git
- Install dependencies with Yarn.
yarn install
- To run MyHearty website:
- Create a
.env.local
file inside theapps/web/
directory by copying the environment variables from the.env.example
file. For more information on populating environment variables, refer to the integrations section. - Run
Go to http://localhost:3001 to view the website.
cd apps/web yarn dev
- Create a
- To run MyHearty dashboard:
- Create a
.env.local
file inside theapps/dashboard/
directory by copying the environment variables from the.env.example
file. For more information on populating environment variables, refer to the integrations section. - Run
Go to http://localhost:3002 to view the dashboard.
cd apps/dashboard yarn dev
- Create a
A running local MyHearty API server is required to serve the content for both frontend website and dashboard. To integrate with the frontend apps:
- Refer to the myhearty-api repository to learn how to set up a local API server. The API server should be running on port
3000
. - In the
apps/web/.env.local
andapps/dashboard/.env.local
files, assignhttp://localhost:3000
to theNEXT_PUBLIC_API_URL
variables.
Typesense is an open-source, typo-tolerant search engine that is optimized for instant search. It is an easier-to-use alternative for commercial search API like Algolia, which has high pricing, or open-source search engine like Elasticsearch, which can be complicated to tune. To enable the website's instant search feature:
- Ensure that a Typesense instance has been running on your local API server. Refer to MyHearty Backend API section for more detail.
- Create a search-only API key using your admin key with the following curl command:
Refer to Typesense: Create an API key for more detail.
curl 'http://localhost:8108/keys' \ -X POST \ -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{"description": "Search-only API key.", "actions": ["documents:search"], "collections": ["organizations", "fundraising_campaigns", "volunteer_events", "charitable_aids"]}'
- In the
apps/web/.env.local
file, populate the Typsense's related environment variables:You can replace the defaults with other values for your own changes.NEXT_PUBLIC_TYPESENSE_HOST='localhost' # if the Typesense instance is running on your local API server NEXT_PUBLIC_TYPESENSE_PORT=8108 # default port on which Typesense is running NEXT_PUBLIC_TYPESENSE_PROTOCOL='http' # can be http or https NEXT_PUBLIC_TYPESENSE_API_KEY='' # your search-only API key
Geoapify provides the Address Autocomplete API that is required for the website's geosearch feature. To enable the website's geosearch feature:
- Go to Geoapify MyProjects to create an account and generate an API key for your project.
- In the
apps/web/.env.local
file, populate theNEXT_PUBLIC_GEOAPIFY_API_KEY
variable with your Geoapify API key.
The full documentation for the MyHearty project can be found in the myhearty-documentation repository. The documentation repository contains technical documents and architecture information related to the implementation of this project.
If you want to contribute, please fork the repo and create a pull request by following the steps below:
- Fork the repo.
- Create your feature branch (
git checkout -b your-feature-branch
). - Commit your changes and push to the branch (
git push origin your-feature-branch
). - Open a pull request.
Your changes will be reviewed and merged if appropriate.