A backend API for managing geek collections, built with .NET 8.0. It provides features like user authentication with JWT, managing collections and shared items, and CRUD operations.
The project uses Docker and Docker Compose for containerization, making it easy to deploy and run the API along with a MariaDB database.
Check out the frontend of the application: Geek Collection App
To initialize a MariaDB instance required by the backend, use the following Docker command:
docker-compose upYou can find the database schema in db.sql, which will be loaded into the database upon initialization.
To restore and build the backend project, follow these steps:
- Restore the project dependencies:
dotnet restore src/Web/Web.csproj- Compile and run the backend:
dotnet run --project src/Web/Web.csprojThis will start the API server on the configured host and port.
The API uses token-based authorization to secure its endpoints. After logging in, the user must include the JWT token in the request headers to authenticate and authorize their actions. The token must be passed in the Authorizatio header of each request as a bearer token.
Here is an example of how to include the token in a request header after login:
Authorization: Bearer <your-token-here>POST {{API_URL}}/user/login
Content-Type: application/json{
"email": "user@example.com",
"password": "yourpassword"
}POST {{API_URL}}/user/register
Content-Type: application/json{
"username": "newuser",
"email": "newuser@example.com",
"password": "yourpassword"
}After successful registration or login, the API returns a JWT token, which must be used for subsequent authenticated requests.
You can find more detailed documentation, including all available API endpoints and example requests, through the Swagger interface, accessible after running the backend.