Skip to content

backjoao88/education-by-subscription-api

Repository files navigation

Description

Education platform based on subscriptions plans written in .NET that uses Asaas, a payment plataform widely used in Brazil.

Badges

build and deploy to app service

Stack and concepts applied

  • .NET 8;
  • Entity Framework Core 9.0;
  • SQL Server 16.0.1000;
  • Clean Architecture;
  • Outbox Pattern;
  • Serilog for logs;
  • Asaas for charging;
  • Quartz for recurrent jobs;

Use cases and requirements

  • The admin users must be able to insert, list and update subscriptions plans;
  • The admin user must be able to insert, list and update courses and lessons;
  • The user must be able to sign himself into the system and update his informatioin;
  • The user must not have access to a course that is not in his allowed courses;
  • The app must be able to accept a HTTP post request from the payment server (webhook) and confirm it internally;

Running

Pre-requisites

Testing the app locally

Before start, ensure you have with you:

Clone the GitHub repository

Download or clone the repository from GitHub. Use the following command to clone:

git clone https://github.com/backjoao88/education-by-subscription-api

Setting up the Azure Key Vault

In the EducationBySubscription\Api folder, init the .NET secret manager.

dotnet user-secrets init

Set your Azure Key Vault Uri.

dotnet user-secrets set "Vault:VaultUri" "<vault-uri>"

Ensure it was created with the following command.

dotnet user-secrets list

Setting up the Azure Vault credentials

Navigate to your vault in Azure and ensure you have the following secrets set.

  • EduSubscriptionStorageAccountName: For referring to azure account name.
  • EduSubscriptionStorageAccountKey: For referring to azure account key.
  • EduSubscriptionStorageContainerName: For referring to azure blob container.
  • AsaasApiKey: For referring your Asaas sandbox account.
  • JwtIssuer: For referring to your Jwt token issuer.
  • JwtAudience: For referring to your Jwt audience.
  • JwtPrivateKey: For referring to your JWT private key.
  • EduSubscriptionDbConnectionString: For referring to your SQL Server instance connection string.

For running it with local credentials you must edit the EducationBySubscription\Infrastructure\DepdendencyInjection.cs file, and change all vault options setup to local options setup. Example (JWT service):

From

public static IServiceCollection AddJwt(this IServiceCollection services)
{
    services
        .ConfigureOptions<JwtOptionsVaultSetup>()
        .ConfigureOptions<JwtBearerOptionsSetup>()
        .AddScoped<IJwtProvider, JwtProvider>();
    return services;
}

To

public static IServiceCollection AddJwt(this IServiceCollection services)
{
    services
        .ConfigureOptions<JwtOptionLocalSetup>()
        .ConfigureOptions<JwtBearerOptionsSetup>()
        .AddScoped<IJwtProvider, JwtProvider>();
    return services;
}

Then you can navigate to appsettings.json and set the corresponding sections (Storage example).

"Storage": {
    "AccountName": "<your-account-name>",
    "AccountKey": "<your-account-key>",
    "ContainerName": "<your-container-name>"
},

Run

Restore the project.

dotnet restore

Run the API.

dotnet watch

You can check the available requests at EducationBySubscription\Api\Requests folder.

Contributions

You can contribute to this project, send a pull request and i'll be happily evaluated.

About

Education platform based on subscriptions that uses Asaas.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published