Code Monkey home page Code Monkey logo

stocktracker's Introduction

StockTracker

OVERVIEW:

Stock Tracker consists of two applications, a server application and a client application.

The server application is a console application built in .NET 6.0 which can run on Linux, Mac and Windows The client application is a .Net MAUI Blazor Hybrid application built in .NET 7.0 and can also run on Linux, Mac and Windows. The client application can also run on Android and iOS, however I have not built the application with these platforms in mind and it therefore is not recommended to run on these platforms.

RUNNING THE PROJECT:

To run the application, open either Visual Studio or Rider on your computer and clone the StockTracker Repository (Or open the solution from your files) Following this, the solution should load within your IDE. Open a powershell/terminal within your IDE and run the command "dotnet restore" - This will restore all of the nuget packages used within the solution. I would then recommend that you run the command "dotnet build" which will build the solution.

Following this, you need to configure the IP addresses of some of the services within the client to point to correctly point to the server: If you are running both the server and the client applications on the same machine, your IP address will be "127.0.0.1". If you are running the server and client applications on different machines, you will to find out your PRIVATE IP address - on this website you can find out how to do this : "https://www.wikihow.com/Find-Out-Your-IP-Address"

Once you have your private Ip address - if you goto the file "NetmqClientTransportService" (StockTrackerApp/Services/NetmqClientTransportService) and change the value of the variable "SERVER_IP_ADDRESS" to be your private IP address Then goto the file "BroadcastListenerService" (StockTrackerApp/Services/BroadcastListenerService) and change the value of the variable "PUBLISHER_ENDPOINT" to include your private IP address - "{yourIPAddress:5557}".

Following changing the IP Addresses in these locations, you can now run the application. To do this, right click on the project StockTrackerServer and press the debug option, and then press "Start New Instance" (or the equivelant on your IDE). This will run the server application. Then right click on the project StockTrackerApp and do the same to start the client application. (NOTE - you can only run the MAUI application on a mac - you cannot debug it)

NOTE: To build on a mac, you must have iOS installed, which you can do using XCode

DATABASE:

This project is NOT using a conventional database server. Due to the requirements from the university, We need to mock a database and to do this, I am taking advantage of Entity Framework's "In Memory Database", which creates a new instance of a database every time that the server application is ran. Entity framework uses ORM which allows you to create data tables based on your objects, to read more about EF, read this article - "https://learn.microsoft.com/en-us/ef/core/"

NETMQ: This project uses NetMq which is an implementation of Zero Mq build for .NET. I use the Request/Response model in this solution to handle requests and responses to and from the server. The Request/Response model is also used within the implementation of the private messaging feature. To handle broadcasting to many users, I use the Publisher/Subscriber model, where clients subscribe to topics and receive broadcast objects from the topics they subscribe to To learn more about NetMq, here is some of the NetMq documentation - "https://netmq.readthedocs.io/en/latest/introduction/"

ENCRYPTION: I have implemented symmetric encryption into this project using Microsofts "System.Security.Cryptography" library, which makes the application less vulnerable to attacks like a "man in the middle" attacks, which is necessary for when we are sending sensitive data using TCP and UDP.

HASHING: I have created a "HashingHelper" class which hashes data. This has not been used within the code as I didnt find it necessary with me storing using very simple passwords within the mock database, but If i were to implement a real database into the project, I would implement this class to increase the security of the program. To learn more about hashing, read this article - "https://www.techtarget.com/searchdatamanagement/definition/hashing"

UNIT TESTING (and mocking): I have implemented unit tests into this application using the XUnit unite testing framework. I have implemented unit tests within the applciation using XUnit and I have mocked services using Moq, a library which allows you to mock services. All of the unit tests pass.

stocktracker's People

Contributors

nathparnell avatar

Watchers

 avatar

stocktracker's Issues

User => supplier and customer

Update the structure of the project to add more separation between a supplier and a customer.
have two separate objects and tables. Have two different services also.

Hash Passwords

Implement a hashing function to encrypt password to protect the system

Add Encryption for Data

Implement Symmetric Encryption so that TCP messages cannot be sniffed and decoded without the encryption key. This will greatly improve the security of the application.

Set up Data Types

Set up the data types which will be used through out the system.
Prefill the mocked database with default values for these data types (e.g. prefill the users table with users of the User datatype)

Add unit tests

Add unit tests for both the server application and Stock Tracker common

Allow users to view and manage a basket

Users can have a basket which they can add and remove products to.
They will be able to view the items in their basket and make an order of the items in this basket.

Improve authorization

Implement Authorization service which will help to manage the current user and user roles and permissions.

Implement Logging

Implement both console logging and file logging for the server

Implement file logging for the client app

Logging should log notable events - essentially acting as an audit logger but also providing system information such as key events and/or errors

Merge Products and Stock

The way I had it before was more like a retailsite, now we are more like a supplier system like costco.
Merging the Stock and Product objects allows simplifies the system and reduces the need for unnecessary administration

Implement NetMQ

Create a new implementation of the IClientTransportService and the IServerTransportServer which uses NetMQ instead of System.Net.Sockets.

This is beneficial as it is a higher level of abstraction and it allows for more advanced patterns such as Request-response and Publisher-subscriber

Migrate to MAUI

University want the app to be cross platform so I therefore must switch from windows forms to a platform like MAUI
I am choosing MAUI as it allows me to learn a new technology, which runs on all platforms and I am still somewhat familiar with the syntax coming from a .NET background

New message threads

Add the ability for users to start new message threads to one or multiple users

Allow customers to view suppliers

Upon selecting a supplier on the customer home screen. the user will be brought to a page where they will be able to view the products they can purchase from a supplier

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.