Giter Club home page Giter Club logo

crypton's Introduction

Crypton

This is a sample ASP.NET Core Web API project that showcases the usage of Clean Architecture and Domain Driven Design principles. The project is built on .NET 8 preview and utilizes various technologies, including Microsoft Identity framework with JWT tokens, Entity Framework Core, Digital Signature from the local Diamond project (which is similar to OnlyFans' Digital Signature algorithm), MediatR, pipeline behaviors, and EF Core interceptors.

Project Structure

The project follows a modular structure based on Clean Architecture and Domain Driven Design, which promotes a clear separation of concerns and facilitates maintainability and scalability.

The solution is structured into the following projects:

  1. Crypton.Domain

    • The Domain layer holds the core business entities, aggregates, value objects, and domain repositories/interfaces.
    • It represents the heart of the application and is independent of any infrastructure or application services.
  2. Crypton.Application

    • The Application layer contains the business logic of the application and implements use cases and application services.
    • It references the Domain layer for domain entities and repositories and interfaces with infrastructure services.
  3. Crypton.Infrastructure

    • The Infrastructure layer provides implementations for the interfaces defined in the Application layer and interacts with external services.
  4. Crypton.Infrastructure.Identity

    • The Identity project provides the user authentication and authorization functionality using Microsoft Identity framework with JWT tokens.
  5. Crypton.Infrastructure.Persistence

    • The Persistence project provides the data persistence functionality using Entity Framework Core.
  6. Crypton.Infrastructure.Diamond

    • The Diamond project provides the Digital Signature functionality that is used in the application.
  7. Crypton.WebAPI

    • The Web API project serves as the entry point for the application and handles HTTP requests/responses.
    • It references the Application layer for business logic and MediatR for handling commands and queries.
  8. Crypton.WebUI

    • The WebUI project is a client application that consumes the Web API and provides a user interface for the application.

Technologies Used

  • ASP.NET Core 8 preview: The foundation of the project, providing the web API functionality.
  • Clean Architecture: A software architecture design that separates concerns into layers for maintainability and testability.
  • Domain Driven Design (DDD): A design approach that focuses on modeling the application based on the business domain.
  • Microsoft Identity framework with JWT tokens: Handling user authentication and authorization using JWT tokens instead of cookies.
  • Entity Framework Core: An Object-Relational Mapping (ORM) tool for database interactions.
  • MediatR: A library for implementing the Mediator pattern to handle commands and queries.
  • Pipeline Behaviors: Custom behaviors to enrich the MediatR pipeline with cross-cutting concerns.
  • EF Core Interceptors: Intercepting database commands to apply additional logic or actions.
  • Digital Signature from the Diamond project: Implementing digital signature functionality within the application.

Getting Started

Eventually this project will have docker compose

Contributing

I welcome contributions to this project. If you want to add new features, fix bugs, or suggest improvements, feel free to submit a pull request, or open an issue.

License

This project is licensed under the MIT License.

Acknowledgments

  • The clean architecture and DDD concepts used in this project were inspired by various online resources and books.
  • The Digital Signature functionality is based on the Diamond project, which itself is based on OnlyFans' Digital Signature algorithm.

crypton's People

Contributors

ddjerqq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

crypton's Issues

Refactor TransactionService

we should convert it into a scoped service which will use another abstraction for the Transaction list, which will expose the readonly list with a method to add transactions to it. it will be a bare-bones, in-memory store for the transactions, which will be initialized only once when the app starts.

Captcha, 2fa, Email confirmation

I will eventually (not in the V1 tho) implement Captcha (for some endpoints), 2Fa, Email confirmation, and maybe even phone confirmation providers.

Optimize Sha256 calculation and block mining.

the current code is allocating excessive amounts of memory and is using too much resources to mine transactions
image

image

Ideally I want to box the complex logic of optimized mining of the transactions, and abstract it into a simple class which will handle all the complexities.

Implement Rate limiting

this looks like a good start to implement rate limiting for transaction and auth endpoints, so that users can't spam them, and load the API.
we will also have multiple configs for rate limiting different kinds of endpoints.

Better rate limiting, per user + timed

a rate limiter, which will time how often users can perform actions, this seems complex as ****, we will need to save the action performances in the database, or some other way.

Implement Idempotency for transaction endpoints

we must implement Idempotency for all non-idempotent endpoints, such as, for example, transaction/create.
I am thinking about having the client generate and send the idempotent keys (GUIDs for simplicity) and then making a service which will track idempotent keys and the states of their requests started / finished.

basic UI/UX

Pages to implement:

  • Register
  • Login
  • Collect daily
  • Create Transaction
  • See other users
  • See / Manage inventory / sell items

Add daily coins

users should be able to collect coins daily, and have a property to see the streak (upto 7) and collection time utc

Transaction completion notifications and subscribers.

Modify the Transaction worker, so that it returns the scheduled transaction's Id, which will eventually be mined.
Also modify the TransactionService so that it publishes some kind of INotification when a transaction gets mined, so that not only can we notify the user about this, but also let everyone subscribe to the live blockchain.

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.