Skip to content

Commit

Permalink
feat: transferring code from private to public repo
Browse files Browse the repository at this point in the history
  • Loading branch information
belousm committed Oct 10, 2023
1 parent 33cd042 commit 7ef32a9
Show file tree
Hide file tree
Showing 259 changed files with 11,759 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Hello
This is an application for mini-app contest

The application consists of two parts (backend and front)

### BACKEND
Express.js & sequlize is used (to work with the database), openai is also used

### FRONT
SvelteKit is built on Svelte, a UI framework that uses a compiler to let you write breathtakingly concise components that do minimal work in the browser, using languages you already know - HTML, CSS and JavaScript. It's a love letter to web development.


## Launch
Use docker-compose.yml to start the project, this file will assemble two containers + nginx

```bash
docker-compose run app node init # (only the first run, to fill the database)
```

```bash
docker-compose up -d # (for full launch)
```

## Attention! Don't forget to set your environment variables
```
/.env - common variables of the backend and frontend are configured here (see example .env_defaults)
/backend/app/.env - only backend variables are configured here (if, for example, your frontend is running on another domain)
```


# For developer
Use ./backend/Psy.postman_collection.json for test and visualize API interface

# Kubernetes
Use Kompose for deploy to kuber
https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/
2 changes: 2 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
data
337 changes: 337 additions & 0 deletions backend/Psy.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
{
"info": {
"_postman_id": "4857baf9-251a-411c-9ffe-0f61af8a5c2b",
"name": "Psy",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "724167"
},
"item": [
{
"name": "ai-test",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{url}}/test-ai",
"host": [
"{{url}}"
],
"path": [
"test-ai"
]
}
},
"response": []
},
{
"name": "get cards",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{url}}/api/get-cards?user_uid=asd1",
"host": [
"{{url}}"
],
"path": [
"api",
"get-cards"
],
"query": [
{
"key": "user_uid",
"value": "asd1"
}
]
}
},
"response": []
},
{
"name": "get collections",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{url}}/api/get-collections?user_uid=asd1",
"host": [
"{{url}}"
],
"path": [
"api",
"get-collections"
],
"query": [
{
"key": "user_uid",
"value": "asd1"
}
]
}
},
"response": []
},
{
"name": "select",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "task_uid",
"value": "fe57e748-d1e9-4995-b373-96f4461f3ad6",
"type": "text"
},
{
"key": "card_ids",
"value": "[1]",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}/api/select",
"host": [
"{{url}}"
],
"path": [
"api",
"select"
]
}
},
"response": []
},
{
"name": "run (system)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{url}}/run?task_uid=f99656db-e8a3-476a-a46b-26529882b7d7",
"host": [
"{{url}}"
],
"path": [
"run"
],
"query": [
{
"key": "task_uid",
"value": "f99656db-e8a3-476a-a46b-26529882b7d7"
}
]
}
},
"response": []
},
{
"name": "result",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "task_uid",
"value": "ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5",
"type": "text"
},
{
"key": "card_ids",
"value": "[1,2,3]",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}/api/result?task_uid=ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5",
"host": [
"{{url}}"
],
"path": [
"api",
"result"
],
"query": [
{
"key": "task_uid",
"value": "ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5"
}
]
}
},
"response": []
},
{
"name": "get day",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "task_uid",
"value": "ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5",
"type": "text"
},
{
"key": "card_ids",
"value": "[1,2,3]",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}/api/result?task_uid=ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5",
"host": [
"{{url}}"
],
"path": [
"api",
"result"
],
"query": [
{
"key": "task_uid",
"value": "ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5"
}
]
}
},
"response": []
},
{
"name": "user get",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "task_uid",
"value": "ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5",
"type": "text"
},
{
"key": "card_ids",
"value": "[1,2,3]",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}/api/result?task_uid=ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5",
"host": [
"{{url}}"
],
"path": [
"api",
"result"
],
"query": [
{
"key": "task_uid",
"value": "ea9e83ff-c8da-453b-b01e-ac69f3ff8ff5"
}
]
}
},
"response": []
},
{
"name": "user set",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "user_uid",
"value": "asd1",
"type": "text"
},
{
"key": "name",
"value": "test",
"type": "text"
},
{
"key": "sex",
"value": "Male",
"type": "text"
},
{
"key": "date_birth",
"value": "2023-01-01 23:23:59",
"type": "text"
},
{
"key": "occupation",
"value": "test",
"type": "text"
},
{
"key": "relationship",
"value": "test",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}/api/user",
"host": [
"{{url}}"
],
"path": [
"api",
"user"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "url",
"value": "",
"type": "string"
}
]
}
3 changes: 3 additions & 0 deletions backend/app/.env_defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APP_DB_DSN=mysql://root:password@mysql:3306/app
OPENAI_API_KEY=sk-xxx
TG_MINI_APP_URL=https://your-domain.com
2 changes: 2 additions & 0 deletions backend/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env

0 comments on commit 7ef32a9

Please sign in to comment.