Giter VIP home page Giter VIP logo

investment-tools's Introduction

investment-tools

A website that provides variety of tools for personal long-term investment.

Requirements

Web (Website)

  1. node.js 20+
  2. yarn

Backend

Docker based

  1. Docker

non-Docker based

  1. Go 1.21+

Setup Project

Common

Run make setup for setting up codebase

Firebase

We use Firebase for user authentication and Firestore for storage (NoSQL).

Here we need to create a firebase project for this project.

Sentry

We use Sentry for performance monitoring and error tracking.

We need to have two sentry project for website and backend each.

Web (Website)

Config

You need to fill environment variables in web/.env to start the website for development

Firebase

For firebase config, fill in variables with prefix APP_FIREBASE.

Sentry

For Sentry config, fill in DSN in APP_SENTRY_DSN.

Backend

You need to fill environment variables in backend/.env to start the backend server for development

Firebase

  1. Get Firebase adminSDK credentials file from firebase console. Reference
  2. Specify where you put the credentials file in variable FIREBASE_ADMIN_SDK_CREDENTIALS_FILE in .env. Or you may use the default file path.
  3. Update the firestore rules by replacing with the rules here

Sentry

For Sentry config, fill in DSN in SENTRY_DSN.

Linter (golangci-lint)

We use golangci-lint for linter. If you want to run linter on local machine. Please follow this link for installation. If you are using docker for development, then no need to install the linter in your machine

Development

Docker based

make dev

Before committing the code, run format and linter first and fix the issues:

make format
make lint

non-Docker based

Please refer to development section for website and backend for non-Docker development

investment-tools's People

Contributors

nagchanallen avatar dependabot[bot] avatar

Watchers

 avatar

investment-tools's Issues

[Website] Add Basic Routes and SSO Login with firebase

Todos

  • Setup routes using react-router-dom
  • Setup Config and add Config File
  • Setup Firebase Web SDK
  • Add Firebase UI for SSO Sign in (https://github.com/firebase/firebaseui-web-react)
  • Add Sign out feature for Home Page
  • Setup Route Guard for Home Page
  • Error handling

Planned Routes

  • Root Screen
    • Entry point of website, redirect user to home page or login page base on auth state
  • Sign In Screen
    • For unauthenticated user
    • Firebase UI
    • Google SSO
  • Home Screen
    • For authenticated user
    • Sign out button
  • Loading Screen
  • Error Screen

[Backend] Add CRUD operations for stock transactions

User Story

User should be able to create, list, update and delete stock transactions on website via API. We save the transactions in firestore.

Checklist

  • Create API
  • List API
  • Update API
  • Delete API

Data Structure

type StockTransaction struct {
  id string // UUID string
  code string
  action string // BUY or SELL
  date time.Time
  amount int64
  price float64
  commision flaot64
  remark string
  updatedAt time.Time // Server UTC time
}

API Endpoint (Draft)

Noted that we also need to pass firebase access token to do the operations by HTTP authentication header
https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication

POST /portfolio/stock-transaction

Sample Request

{
  "code": "QQQ", // string
  "action": "BUY", // string
  "date": "2023-10-20", // YYYY-MM-DD ISO8601 string
  "amount": 30, // int
  "price": 20.5, // float
  "commision": 0.5, // float optional
  "remark": "abc", // string optional
}

Sample Response 201 Created

{
  "id": "550e8400-e29b-41d4-a716-446655440000" // UUID string 
}

POST /portfolio/stock-transactions

Sample Request

{
  "orderBy": "", // string
  "sortDirection": "ASC", // string (ASC or DESC)
  "limit": 20, // int
  "cursor":  "550e8400-e29b-41d4-a716-446655440000" // UUID string Optional
}

Sample Response 200 OK

{
  "data": [...], // list of stock transaction with id and updated_at, see POST /stock-transaction
  "nextCursor": "550e8400-e29b-41d4-a716-446655440000", // UUID string Optional
  "totalCount": 20 // int
}

PUT /portfolio/stock-transaction

Sample Request

{
  "id": "550e8400-e29b-41d4-a716-446655440000", // UUID string
  "code": "QQQ", // string
  "action": "BUY", // string
  "date": "2023-10-20", // YYYY-MM-DD ISO8601 string
  "amount": 30, // int
  "price": 20.5, // float
  "commision": 0.5, // float
  "remark": "abc", // string
}

Sample Response 200 OK

{
  "id": "550e8400-e29b-41d4-a716-446655440000" // UUID string
}

DELETE /portfolio/stock-transaction/{id}

Sample Request

No request body

Sample Response 200 OK

{
  "id: "550e8400-e29b-41d4-a716-446655440000" // UUID string
}

Project Services Deployment

Use helm and kubernetes for deployment.
For CD, use GitHub Action.

  • Write helm chart for web and backend
  • Setup CD for deployment

Setup Sentry

It is setup for monitoring app errors and performance

  • Website
  • Backend

Setup Project

  • Setup React Project

  • Setup API Server

    • Gin with Golang
  • Setup Firebase Project

    • project name: investment-tools-dev
  • Write README on setup project for development

Folder structure

- web
- api
Makefile
.gitignore
README.md

Setup Docker

It is not a must now.
We can setup docker for both website and backend for smoother developement.
At the future, we may adopt k8s deployment and we need to build the docker image for two apps first.

  • Create Dockerfile for backend
  • Create Dockerfile for website
  • Create docker-compose file

[Website] Add Portfolio screen

User Story

As a user, I want to see a list of stock transactions that inputted before, at the same time I would be able to create, update and delete the transactions.

Tasks

  • Scaffold Portfolio screen (Protected Screen)
  • Integrate backend API, refer to #12 for the specification
  • Add stock transaction create form using react-hook-form
  • Add stock transaction table using AG Grid or React Table
  • Add Delete button on each row of stock transaction table, with confirmation Dialog
  • Add edit modal for stock tranction

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.