RESTful API for managing establishments and stores, with JWT authentication, Swagger documentation and modular structure.
Develop with:
-
Golang
-
Echo Framework
-
PostgreSQL
-
JWT (Autenticação simulada)
-
Swagger (via Swag)
-
Docker + Docker Compose
-
GoMock + Testify (testes unitários)
store-manager-api/
├── app/
│ ├── core/
│ ├── config/
│ ├── docs/
│ ├── middlewares/
│ ├── modules/
│ │ ├── establishment/
│ │ └── store/
│ └── routes/
├── scripts/
├── Dockerfile
├── docker-compose.yml
├── go.mod
├── go.sum
├── main.go
└── README.md
Follow the steps below to set up and run the database and backend application locally.
Docker Desktop installed on the environment. (Windows
)
Docker Engine and Compose installed on the environment. (Linux
)
Steps:
# Clone the repository
git clone https://github.com/your-user/store-manager-api.git
cd store-manager-api
# Run the environment with PostgreSQL
docker-compose up --build
The API will be available at: 📍 http://localhost:8080
The Swagger documentation will be at: 📄 http://localhost:8080/swagger/index.html
Use the login endpoint to get a JWT token:
POST /v1/api/login
{
"username": "admin",
"password": "123"
}
Use the returned token as a Bearer Token in Swagger or in the headers of protected requests.
1 - http://localhost:8080/v1/api/login
2 - Copy the token returned and use in Authorized Button option:
3 - Paste token with Bearer prefix. Example: Bearer ue54da221dd...
# Enter the container
$ docker exec -it store-manager-api sh
# Run tests
@container go test ./... -v -cover