This guide takes you from zero to a working API session. The fastest path uses Docker and Docker Compose, which handle the MySQL database and the Spring Boot application together. If you prefer to run the application directly on your machine, a local Maven option is also covered in the Deployment page.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/alvarezlautaro/BancoAlimentos/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Docker path
- Docker 24+
- Docker Compose v2+
Local path
- JDK 21+
- Maven 3.9+ (or use the included
mvnwwrapper) - MySQL 8 running locally
Steps
Create an environment file
The
docker-compose.yml reads all sensitive values from environment variables. Create a .env file in the project root to supply them:.env
Start the stack with Docker Compose
Build the application image and bring up both services (MySQL and the Spring Boot app). The Watch for the Spring Boot startup banner in the logs. The API is ready when you see output similar to:The application listens on port 8080.
app service waits for MySQL’s health check to pass before starting.On the first start,
DataInitializer runs and seeds the database with all roles, permissions, and the three default user accounts. Because ddl-auto is set to create-drop, the schema and seed data are recreated on every restart.Log in and obtain a JWT token
Use the
A successful response returns a JSON object containing your bearer token:Copy the value of
POST /api/auth/login endpoint with one of the three seeded credentials. The deposito user has the broadest permissions and is a good starting point.| Username | Password | Role |
|---|---|---|
deposito | deposito123 | USER_DEPOSITO |
tesoreria | tesoreria123 | USER_TESORERIA |
institucional | institucional123 | USER_INSTITUCIONAL |
Log in as deposito
Login response
token — you will send it as a Bearer header on every subsequent request.Make your first authenticated request
Fetch the list of donors with the token you just received. Replace On a fresh install
<YOUR_TOKEN> with the actual value from the login response.List all donors
DataInitializer does not seed any donor data, so you will receive an empty array. The important thing is the 200 OK status — confirming that authentication and authorisation are working:GET /api/donantes response
Next steps
Authentication overview
Understand how JWT tokens are generated, what claims they carry, and how the security filter validates each request.
Deployment options
Configure environment variables, switch to a persistent database schema, and run the application locally with Maven.