Skip to content

murillosnds/TMA

Repository files navigation

📝 TMA | Task Manager API

👨🏻‍💻 Made by: Murillo Sergio

Java Spring Boot JUnit Swagger PostgreSQL Docker Argon2

Endpoints:

User:

  • POST: /users
  • GET: /users/{id}

Task:

  • POST: /tasks
  • GET: /tasks/{id}
  • GET: /tasks

Request

POST /users Example:

{
  "name": "João Silva",
  "email": "joao@email.com",
  "password": "stringstring"
}

Minimum password length: 12

GET /users/{id} Example:

{
  "id": 1,
  "name": "João Silva",
  "email": "joao@email.com",
  "tasks": []
} 

POST /tasks Example:

{
  "title": "Minha primeira task",
  "description": "Estudar Spring Security",
  "userId": 1
}

GET /tasks Example:

[
  {
    "id": "1",
    "title": "Minha primeira task",
    "description": "Estudar Spring Security",
    "completed": true,
    "createdAt": "2026-07-18",
    "userId": 1
  }
]

POST /auth/login Example:

{
  "email": "joao@email.com",
  "password": "stringstring"
}

Response

  • 200: OK
  • 201: Created with success
  • 400: The request syntax is incorrect
  • 401: Requires authentication (login required)
  • 403: "Forbidden – token expired or insufficient permissions"

Swagger

Swagger

Access the interactive API documentation at:

http://localhost:8080/swagger-ui.html

PostgreSQL (example)

Postgresql-picture

Prerequisites

  • Java 21
  • Maven
  • PostgreSQL (running locally, with a tma database created)

How to run the project

git clone https://github.com/murillosnds/TMA.git
cd TMA

1. Configure the environment variables

Copy the example file and edit it:

cp .env.example .env

Open .env and fill in your values:

JWT_SECRET_KEY=<your-generated-key>
DB_URL=jdbc:postgresql://localhost:5432/tma
DB_USERNAME=postgres
DB_PASSWORD=your_password

How to generate a secure key

Run the following command in your terminal:

Linux:

openssl rand -base64 32

Windows (Powershell):

$bytes = New-Object byte[] 32; [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes); [Convert]::ToBase64String($bytes)

2. Run the application

Linux/macOS:

export $(cat .env | xargs) && ./mvnw spring-boot:run

Windows (PowerShell):

Get-Content .env | ForEach-Object { $name, $value = $_ -split '=', 2; Set-Item -Path "env:$name" -Value $value }
./mvnw spring-boot:run

The API will be available at http://localhost:8080.

How to run the project with Docker Compose

Follow the previous steps for generating the secure key and editing the .env file.

Now, run:

docker compose up -d

⭐ If this project has been helpful to you, please consider giving the repository a star!

This project is licensed under the MIT License.
See the file LICENSE for more details.

Contributors

Languages