A .NET Minimal API implementation of the Malawi Charity Donations API.
The Charity Donation API project aims to provide a platform for facilitating online donations to charitable organizations in Malawi. It enables individuals to contribute to various causes and make a positive impact on society. The API will integrate with popular payment gateways to securely handle financial transactions.
The Charity Donation API project is driven by the goal to modernize charitable giving in Malawi, a country where many important causes often face limited funding avenues. By creating an accessible online platform, the project aims to connect donors with charitable organizations seamlessly. This initiative seeks to enhance transparency, efficiency, and global reach in philanthropic efforts, making positive social impact easier to achieve.
You may find out about the project in the documentation here
The application is built with the following technologies:
- .NET 7.0
- Microsoft SQL Server for database
- Auth0 for authentication and authorization
- Download and install .NET 7.0 SDK
- Download and install Docker
- Download and install Postman
- Create an Auth0 Account and register your API by following this APIs registration process.
-
Clone the repository to your local machine.
-
Navigate to the root directory of the project in the terminal:
cd charity-donations cd CharityDonations.Api
-
Restore the project dependencies:
dotnet restore
-
Build the application:
dotnet build
-
Start mssql server with docker
Set an SA (System Administrator) password:
$sa_password = "[SET YOUR SA PASSWORD HERE]"
Pull the docker image:
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$sa_password" -p 1433:1433 -v sqlvolume:/var/opt/mssql -d --rm --name mssql mcr.microsoft.com/mssql/server:2022-latest
Run
docker ps
to see the docker container.Run
docker stop mssql
whenever you want to stop the docker container.Run the same command you used for pulling to restart the docker container.
-
Safe storage of app secrets using .NET secret manager
We are using Secret Manager provided by .NET to safely store secrets such as connection strings and secret keys. Read more about .NET secrets manager.
To safe secrets, first enter your SA password:
$sa_password = "[YOUR SA PASSWORD HERE]"
Safe a connection string:
dotnet user-secrets set "ConnectionStrings: CharityOrganizationsContext" "Server=localhost; Database=CharityDonationsApi; User Id=sa; Password=$sa_password;TrustServerCertificate=True"
Safe Auth0 Domain
dotnet user-secrets set "Auth0:Domain" "[YOUR AUTH0 DOMAIN HERE]"
Safe Auth0 Audience
dotnet user-secrets set "Auth0:Audience" "[YOUR AUTH0 AUDIENCE HERE]"
To see the list of your secrets, run
dotnet user-secrets list
-
Run the application:
dotnet run
The application runs on
http://localhost:5073/
.You can test the application with swagger or postman. We recommend testing with postman.
Contributions to the project are welcome! Make sure you read and understand project requirements before starting making contributions.
Here are the steps to contribute:
- Fork the project repository.
- Create a new branch for your feature or bug fix.
- Make your changes.
- Submit a pull request.
Please make sure your code adheres to the existing style for consistency.
This project is licensed under the MIT License - see the LICENSE file for details.
- Taurai Gombera Feel free to reach out if you have any questions or suggestions!