Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,38 @@ OpenAPI JSON:
| GET | `/health` | Health check |
| GET | `/api/links/{code}` | Redirect by short code |

---
## Deployment

The project is automatically deployed to a remote server via **GitHub Actions**.
Every merge/push to the `master` branch triggers the workflow (`.github/workflows/deploy.yml`) which:

1. Connects to the server (`user@ip` via SSH)
2. Executes the `deploy.sh` script
3. Updates the repository (`git pull origin master`)
4. Rebuilds Docker containers and restarts the application (`docker compose up -d --build`)

**Note:** Private keys for GitHub Actions are stored in GitHub Secrets and **are not published** in the README.

---

## Postman Collections

There are two collections in the `postman/` folder:

- `Linkshortener_local_postman_collection.json` – for local version (`http://localhost:8080`)
- `Linkshortener_deployed_postman_collection.json` – for the production server (`http://91.225.7.129:8080`)

To use the collections, import them into Postman.

---

## Swagger (Production)

API documentation for the production server is available here:
[Go to Swagger](http://91.225.7.129:8080/swagger-ui/index.html)


---

## What this app can do
Expand Down
273 changes: 273 additions & 0 deletions docs/postman/Linkshortener_deployed_postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
{
"info": {
"_postman_id": "f71610e2-9b1d-48a4-9a86-3807272a7e18",
"name": "Linkshortener(fromLoclhost)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "43658247"
},
"item": [
{
"name": "Health",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://91.225.7.129:8080/health",
"protocol": "http",
"host": [
"91.225.7.129"
],
"port": "8080",
"path": [
"health"
]
}
},
"response": []
},
{
"name": "Register User",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"testuser1\",\r\n \"password\": \"Password123\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/auth/register",
"host": [
"{{baseUrl}}"
],
"path": [
"auth",
"register"
]
}
},
"response": []
},
{
"name": "Login User",
"event": [
{
"listen": "test",
"script": {
"exec": [
"const response = pm.response.json();\r",
"pm.collectionVariables.set(\"token\", response.token);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"testuser\",\r\n \"password\": \"Password123\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/auth/login",
"host": [
"{{baseUrl}}"
],
"path": [
"auth",
"login"
]
}
},
"response": []
},
{
"name": "Add link",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0dXNlcjEiLCJpYXQiOjE3NTc2MTY3ODAsImV4cCI6MTc1NzYyMDM4MH0.JPOQIjd8q4aiV6vYI5sApmS7RVmzmdn6j8dcyBTdmwU",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"url\": \"https://github.com/RuslanLomaka/GoitJavaDevProjLinkShortener\"\r\n}"
},
"url": {
"raw": "{{baseUrl}}/auth/api/links",
"host": [
"{{baseUrl}}"
],
"path": [
"auth",
"api",
"links"
]
}
},
"response": []
},
{
"name": "Forward by link",
"request": {
"method": "GET",
"header": []
},
"response": []
},
{
"name": "My links",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0dXNlcjEiLCJpYXQiOjE3NTc2MTkwMzMsImV4cCI6MTc1NzYyMjYzM30.5K9GRMiGptBQgyIxOGMWSMmJeADu80kIkPbeL_KSPac",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/links/my_all_links",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"links",
"my_all_links"
]
}
},
"response": []
},
{
"name": "Delete link by id",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0dXNlcjEiLCJpYXQiOjE3NTc2MTkwMzMsImV4cCI6MTc1NzYyMjYzM30.5K9GRMiGptBQgyIxOGMWSMmJeADu80kIkPbeL_KSPac",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/links/delete/8d426643-ed03-42cf-9eb5-20d25800223c",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"links",
"delete",
"8d426643-ed03-42cf-9eb5-20d25800223c"
]
}
},
"response": []
},
{
"name": "JSON API docs",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://91.225.7.129:8080/v3/api-docs",
"protocol": "http",
"host": [
"91.225.7.129"
],
"port": "8080",
"path": [
"v3",
"api-docs"
]
}
},
"response": []
},
{
"name": "Refresh Token",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0dXNlciIsImlhdCI6MTc1NzUzMDk0MSwiZXhwIjoxNzU4MTM1NzQxfQ.3dtnvIqBNaGGpPF6qIP3BkXE85gS4HLC74R7kQmAxho",
"type": "text"
}
],
"url": {
"raw": "{{baseUrl}}/auth/refresh",
"host": [
"{{baseUrl}}"
],
"path": [
"auth",
"refresh"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://91.225.7.129:8080",
"type": "string"
},
{
"key": "token",
"value": "",
"type": "string"
}
]
}
Loading