Skip to content

imadarchid/ucits-ma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

43 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ˆ ucits-ma

image

About

ucits-ma is a small tool that allows potential investors (and curious souls like myself) to display information about Moroccan OPCVM funds (Basic information, 7-day performance, and fee structure).

โžก๏ธ What's a UCITS? Check AMMC's (Morocco's Securities and Exchange Commission) document to learn more.

Project Structure

  • app: Next.js + TRPC + Prisma project
  • db: SQL file for tables creation
  • ucits-bot: a collection of lambda functions that are used to scrap and update data

Run locally

If you'd like to run ucits-ma locally, you have two options:

  • Docker

If you have docker installed, simply run:

npm run dev:docker

If you'd like to populate the database with seed data, make sure to run the following command within the container:

npx prisma db seed

If you only need an instance of the ready-to-use Postgres DB, run:

npm run dev:db

The app will be available on localhost:3000, and you can access the Postgres instance for debugging purposes through localhost:5200.

  • Manual installation

You will need to have a DATABASE_URL environment variable set for your DB connection string.

Install dependencies

cd app && npm i

Run the app

npm run dev

Project Architecture

archi

Data Layer

The data layer refers to the resources dedicated to retrieve and populate data on the database instance.

  • initDb: A lambda function to initiate the DB instance (Creation + Seed)
  • updateFunds: A lambda function to retrieve funds from the ASFIM website and populating them on the database. This is run daily thanks to a Cloudwatch cron event.
  • updatePerformance: A lambda function to retrieve performance records from the ASFIM website and populating them on the database according to the available funds. This is run daily thanks to a Cloudwatch cron event.

All interactions are done securely by retrieving DB secrets from AWS Secrets Manager.

App Layer

An EC2 instance (with PM2 & NGINX) to run the app. Why not AWS Amplify ?: The app has to be in the same VPC as the RDS instance + Accessing AWS Secrets Manager is a hassle on Amplify.

Roadmap

WIP