Skip to main content

Setup portal

InvestSense Portal

This is a T3 Stack project bootstrapped with create-t3-app.

Getting Started

Environment Variables

The environment variables for this project are not included in the repository for security reasons. Please copy the env.example file and place it into your .env file in the root directory of the project. Please ask Daniel for certain environment variables when you require them.

Running the PostgreSQL Database

This project uses Docker to run the PostgreSQL database. Make sure you have Docker installed on your machine. To start the database, navigate to the project directory in your terminal and run the following command:

docker-compose up -d

This command will start the PostgreSQL database as defined in the docker-compose.yml file.

Setup Minio for S3

After running docker-compose, you will need to setup Minio for S3. To do this, navigate to http://localhost:9000 in your browser. The username and password are both minioadmin. After logging in you will need to create a bucket e.g.named investsense. Then set this bucket name in the .env file as the value for S3_STORAGE_BUCKET_NAME and NEXT_PUBLIC_S3_STORAGE_BUCKET_NAME.

Then go the access keys section and create a pair of access keys. Set these keys in the .env file as the values for S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY.

Running the Project

To run the project, you will need to use the following commands from the package.json file:

Install the dependencies:

pnpm install
  • pnpm run dev: This command starts the Next.js development server.
  • pnpm run worker: This command starts the worker process.

You can run these commands in separate terminal windows to have them running concurrently.

Restoring the DB

Before running this ask Matthew for the db.dump file. This will give you a database to work with.

To run the restore script located in the restore.sh file, navigate to the project directory in your terminal and run the following command:

sh restore.sh

This command will execute the script and restore the database to its initial state.

Running Migrations

Migrations are run using the prisma CLI. To run the migrations, navigate to the project directory in your terminal and run the following command:

pnpm exec prisma migrate dev

Familiarise yourself with the Prisma Migrate documentation for more information.

Background Jobs and Workers

This project uses BullMQ for running background jobs and scheduled tasks. The worker process handles various automated tasks:

  1. Data Processing Jobs:

To run the worker process:

pnpm run worker:start

External Services and Integrations

This project integrates with several external services. You'll need to set up credentials for each in your .env file:

  1. Investment Data Services:

    • FactSet API: For financial data and analytics
    • HUB24: For portfolio management data
    • Netwealth: For wealth management data
    • Praemium: For investment platform data
  2. Infrastructure Services:

    • Redis: For caching
    • Sentry: For error tracking
    • Axiom: For logging and analytics
    • Mailjet: For email services
    • Infisical: For secrets management
  3. Storage and Media:

    • S3/Digital Ocean Spaces: For file storage
    • PDF Service: For document generation

Each service requires specific environment variables to be set. Refer to .env.example for the complete list of required variables.

Learn More

To learn more about the T3 Stack, take a look at the following resources:

You can check out the create-t3-app GitHub repository — your feedback and contributions are welcome!

How do I deploy this?

Follow our deployment guides for Vercel, Netlify and Docker for more information.

Update Configuration and Apply Changes. After modifying your docker-compose.yml or application code, run:

docker compose up -d --build --remove-orphans

Init husky for commitlint

pnpm exec husky init

After init we need to remove "npm test" in the pre-commit file as well