kbventures / next-mtrade

Mtrade

Home Page:https://next-mtrade.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is MTrade Deployed Logo
Table of Contents
  1. About The Project
  2. Getting Started
  3. What I have learned
  4. Roadmap
  5. Contributing
  6. File Structure
  7. Linting
  8. License
  9. Contact

About The Project

(back to top)

MTrade is a crypto exchange trade analysis web application which enables users with crypto exchange API keys to consolidate and vizualise select data from all their accounts.

Built With

  • NodeJS
  • Postgresql
  • React
  • Next.js
  • Vercel
  • SASS
  • Jest
  • Git
  • Javascript
  • TypeScript
  • HTML
  • CSS
  • Docker

(back to top)

Getting Started

This is an example of how you go about setting up our project locally. To get a local copy up and run follow these simple example steps.

Prerequisites

Installation

  1. Clone the repo
    git clone https://github.com/kbventures/next-mtrade.git
  2. Go to cloned folder
    cd next-mtrade
  3. Install dependencies
    npm install
  4. Add .env.local file inside root directory
    NEXTAUTH_URL="http://localhost:3000"
    NEXTAUTH_SECRET="yourSecretGoesHere"
    DATABASE_URL="postgresql://mtrade:mtrade-pwd@postgres:5432/mtrade-db"
  5. Start Containers:
    docker-compose up -d
  6. Push schema:
    docker exec -it mtrade-app npx dotenv -e .env.local -- prisma db push
  7. Access Postgresql shell within its container:
     docker-compose exec postgres psql -U mtrade -d mtrade-db 
  8. Insert hard code data
    INSERT INTO "Exchange" (id, name) 
    VALUES 
    (gen_random_uuid(), 'Commex'),
    (gen_random_uuid(), 'Kraken'),
    (gen_random_uuid(), 'Coinbase'),
    (gen_random_uuid(), 'OkCoin'),
    (gen_random_uuid(), 'KuCoin'),
    (gen_random_uuid(), 'Gemini'),
    (gen_random_uuid(), 'Deribit'),
    (gen_random_uuid(), 'Binance');
  9. Exit postgres shell
    exit

Start Application

  1. Start App
docker-compose -f docker-compose.dev.yml up -d
  1. Go to http://localhost:3000/

(back to top)

Run Unit Tests

  1. Terminal
    npm run test

(back to top)

Production build

  1. Terminal
npm run build

(back to top)

Run production build

  1. Terminal
npm run start

(back to top)

What I have learned

  1. Authentication with next-auth
  2. Psql, Postgresql
  3. Docker, docker-compose
  4. Creating Next.js Image
  5. Containerizing a next.js app and postgresl instance
  6. Internationalization with next-i18-next

Roadmap

  • Consolidation Of Trades screen
  • Visual Analysis
  • Automated testing: Unit, e2e and intergration tests
  • Devops: Github actions linting and testing before introducing to production
  • Utilizing email in the authentication process
  • Password reset utilizing email
  • Administrative access to database(Golan Back End)
  • Debugging CSS glitches
  • User Information Input & Change
  • Invidual trade access with url for sharing
  • Stripe Payment for Premium Users
  • Expand user schema
  • Delete & Modify exisiting user private and public keys
  • Leaderboard
  • Paper trade funtionality
  • Live websocket price tracking

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

How Do I Contribute Using Git?

  1. Clone the repository with this command if you don't have it:

    git clone https://github.com/kbventures/next-mtrade
  2. Run the following command to make sure you have the latest changes on the main branch

    git pull
  3. Create a new feature branch with a descriptive name and only make your changes here. For example, to add this README documentation I would call this branch add-git-workflow.

    git checkout -b <your feature branch name>
  4. Make as many changes as you need in your feature branch. You can use the following commands per commit message.

    git add .
    git status
    git commit -m <your commit message>
  5. Once your feature is ready and you're ready to merge into the main branch first make sure to push your local branch changes to GitHub's computers.

    git push --set-upstream origin <your feature branch name>
  6. Go to https://github.com/kbventures/ecommerce/branches and you should see your newly pushed feature branch. Find and click the button "New pull request" to request for your changes to be "pulled" into the main branch.

  7. When you click the button, complete the form required for each pull request and click "Create pull request".

  8. In the top-right corner click "Reviewers" and add one person on the team as a reviewer for the pull request.

  9. Once the Reviewer has looked at your pull request and verified everything is OK, they will merge your pull request into the main branch.


What if I have a Conflict?

  1. From within your feature branch, fetch the latest changes from the main branch

    git fetch origin main
  2. Rebase so that your feature branch history is stacked on top of the latest main branch history

    git rebase origin/main
  3. Now resolve the conflicts manually in your code editor one at a time. Git will tell you which files have a conflict. Once you've resolved the conflicts run the following commands:

    git add .
    git rebase --continue
  4. Write and save a commit message if all conflicts are resolved.

  5. Push your rebased feature branch changes to GitHub's computers.

    git push -f origin <your feature branch name>
  6. Go back to your pull request on Github your pull request should have no conflicts and you can merge into the main branch!

Also, don't forget the most important rule of rebasing:

NEVER REBASE ON A REMOTE BRANCH >

How Do I Write Good Commit Message?

Why do we care to write a good commit message? A well-crafted Git commit message is the best way to communicate context about a change to other developers working on that project, and indeed, to your future self.

A commit has two parts: a subject (max 50 characters) and a description. Use the following command to separate a subject from the description.

git commit -m "Subject" -m "Description..."

In each commit message:

  1. Specify the type of commit in the subject. Example: Feat: create landing page.

    • feat: The new feature you're adding to a particular application
    • fix: A bug fix
    • style: Feature and updates related to styling
    • refactor: Refactoring a specific section of the codebase
    • test: Everything related to testing
    • docs: Everything related to documentation
    • chore: Regular code maintenance.
  2. Separate the subject from the body

  3. Remove whitespace errors

  4. Remove unnecessary punctuation marks

  5. Do not end the subject line with a period

  6. Capitalize the subject line and each paragraph

  7. Use the body to explain what changes you have made and why you made them.

  8. Do not assume the reviewer understands what the original problem was, ensure you add it.

  9. Do not think your code is self-explanatory

(back to top)

File Structure

My Next.js project follows a structured organization where configuration files, setup scripts, installation instructions, testing suites, Prisma schemas, and Docker Compose files are located at the project's root directory. The actual project files, including source code and assets, are contained within the 'src' directory. This separation allows for a clear distinction between project configuration and implementation details, facilitating ease of maintenance and collaboration among developers. See Grouping by features or routes

(back to top)

Linting

We are using ESLint with Airbnb rules, alongside Prettier to format code and follow modern standarts when writhing Javascript In addition, we can minimize runtime errors.

(back to top)

PRE-COMMIT

PRE-PUSH

We are using husky to use create git hooks to run linting pre-commit and automated tests pre-push that will stop the respective git command if the checks fail.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Ken Beaudin - @kb9700

(back to top)

About

Mtrade

https://next-mtrade.vercel.app/

License:MIT License


Languages

Language:TypeScript 68.2%Language:SCSS 27.3%Language:CSS 3.3%Language:JavaScript 0.9%Language:Dockerfile 0.2%Language:Shell 0.0%