Fund Purifier: Invest in halal versions of popular US funds

Fund Purifier
Invest in halal versions of popular US funds.Built-in Shariah-compliance monitoring, smart rebalancing and more..
Website · GitHub · 𝕏 (Twitter)

Introduction

Investing in the stock market as a Muslim is hard, because it’s not always obvious what’s halal and what isn’t. It gets even trickier when it comes to investing in funds, because there’s no way to exclude non-halal stocks from a fund with hundreds of stocks.

Until now.

Why

We built the Fund Purifier to automatically filter any US-listed mutual fund or ETF for you.

Just choose a fund, and we automatically filter it for compliant stocks.

On top of that, we also support:

🔍 Tracking fund changes so your filtered fund reflects additions/removals in the original fund

🗑️ Automatic removal when a stock turns haram (and re-added if it turns halal)

⚖️ Smart rebalancing so any funds invested/withdrawn help you come closer to the target weights

… and more!

It’s also 100% Free! You can use it today by signing up at https://fundpurifier.com.

Oh, and one more thing. It’s completely open-source 💥

Important Just looking to use the Fund Purifier? Use the hosted version at app.fundpurifier.com

Development

Install dependencies

git clone https://github.com/fundpurifier/app.git
npm install

Register for 3rd Party Services

The Fund Purifier relies on some 3rd party services. You’ll need to sign up for these in order to run the app locally:

  1. Alpaca Developer App for executing trades (powers the “Sign in with Alpaca” functionality)
  2. Clerk for authentication
  3. Resend for email notifications

You’ll need to sign up to these services and populate your local .env file with the following keys:

ALPACA_CLIENT_ID=
ALPACA_CLIENT_SECRET=
CLERK_SECRET_KEY=
RESEND_KEY=

Production

To run the Fund Purifier in production, you’ll need to register for additional 3rd party services:

Once done, populate your local .env file with the following keys:

ALPACA_CLIENT_ID=
ALPACA_CLIENT_SECRET=
FINNHUB_FREE_KEY=
FINNHUB_API_KEY=
MUSAFFA_CLIENT_ID=
MUSAFFA_SECRET_KEY=
EOD_HISTORICAL_DATA_API_KEY=
FINANCIAL_MODELING_PREP_KEY=

Note: These are paid services. The total cost is around $20k/year.

IMPORTANT: You do not need to sign up to these services to run the Fund Purifier locally. We provide mocked responses in development instead.

Tech Stack

The Fund Purifier is built using the latest tech. Here’s a run-down of what our stack looks like:

  • NextJS 14, with app directory
  • React (Frontend / Server Components)
  • SQLite
  • Typescript
  • BullMQ
  • Redis

Overview

Let’s cover the main parts of the project src/ directory:

  • app/: all the routes used in the client application
  • components/: reusable components used throughout the application
  • hooks/: mainly used for global state management
  • lib/: includes interfaces for 3rd party libraries and services
  • models/: includes zod schemas for verifying data from 3rd parties
  • services/: any sufficiently complex code taken outside controllers
  • workers/: any long-running code that runs in the background

Authors

License

AGPL 3.0 License

GitHub

View Github