potegni.me backend
To learn more about the project, visit GitHub organization
- Framework: ASP.NET Core 8.0
- Database: PostgreSQL with Entity Framework Core
- Authentication: JWT
- Password Security: BCrypt for password hashing (ans salting)
- Email Service: SendGrid for email notifications and password resets
Prerequisites:
- .NET 8 - runtime and SDK
- Database client (eg: pgAdmin)
- Set secrets
To run the backend, you need to set secrets inside the.envfile. Seeexample.envfile regarding file contents. Contact code owners if you need access to app secrets. - Generate RS256 key pair
You will need.env,public.pemandprivate.pemin the same location where the app runs. This is usuallypotegnime-api/PotegniMe/bin/Debug/net8.0. Create.envfile and folderkeyswith the keys mentioned above in this folder. You can generate key pair by running:
If you want to run potegnime-scraper locally as well, make sure theopenssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048 openssl rsa -pubout -in private.pem -out public.pempublic.pemkey is the same for the API and the scraper. - Run the API:
API runs on http://localhost:5194. Swagger is available at http://localhost:5194/swagger/index.htmlcd PotegniMe/ dotnet restore dotnet build dotnet run
- Use primary constructors when creating new classes
- Check for unused using statements before committing
- Use file scoped namespaces
For deployment info consult internal potegnime-wiki
If you want to try out the production build locally run:
# build the app
dotnet publish -c Release -o PotegniMe/publish
# create .env file in the same location where the Potegni.me dll lives
nano .env # copy contents from your .env
# create keys folder with public.pem and private.pem
mkdir keys
cd keys
nano public.pem
nano private.pem
dotnet PotegniMe/publish/PotegniMe.dll --urls "http://127.0.0.1:5194"