https://github.com/reznikovroman/hackathon-october-codebattle
https://github.com/reznikovroman/hackathon-october-codebattle
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/reznikovroman/hackathon-october-codebattle
- Owner: ReznikovRoman
- Created: 2022-10-12T14:22:01.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-26T06:43:50.000Z (about 2 years ago)
- Last Synced: 2025-06-27T22:37:59.909Z (7 months ago)
- Language: Python
- Homepage:
- Size: 254 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CodeBattle Hackathon
API for October CodeBattle Hackathon.
## Live Demo
API docs: http://51.250.44.9/api/v1/docs
## Stack
[Starlite](https://starlite-api.github.io/starlite/),
[SQLAlchemy](https://www.sqlalchemy.org/), [Alembic](https://alembic.sqlalchemy.org/en/latest/front.html),
[Postgres](https://www.postgresql.org/), [Redis](https://redis.io/), [Traefik](https://doc.traefik.io/traefik/)
## Configuration
Docker containers:
1. server
2. db
3. redis
4. traefik
docker-compose files:
1. `docker-compose.yml` - for local development.
2. `tests/functional/docker-compose.yml` - for functional tests.
To run docker containers, you need to create a `.env` file in the root directory.
**`.env` example:**
```shell
cp .env.example .env
```
### Start project:
Locally:
```shell
docker-compose build
docker-compose up
```
## Development
Sync environment with `requirements.txt` / `requirements.dev.txt` (will install/update missing packages, remove redundant ones):
```shell
make sync-requirements
```
Compile requirements.\*.txt files (have to re-compile after changes in requirements.\*.in):
```shell
make compile-requirements
```
Use `requirements.local.in` for local dependencies; always specify _constraints files_ (-c ...)
Example:
```shell
# requirements.local.txt
-c requirements.txt
ipython
```
### Tests
Run unit tests (export environment variables from `.env` file):
```shell
export $(echo $(cat .env | sed 's/#.*//g'| xargs) | envsubst) && make test
```
To run functional tests, you need to create `.env` in ./tests/functional directory
**`.env` example:**
```shell
cd ./tests/functional && cp .env.example .env
```
Run functional tests:
```shell
cd ./tests/functional && docker-compose up test
```
Makefile recipe:
```shell
make dtf
```
### Code style:
Before pushing a commit run all linters:
```shell
make lint
```
### pre-commit:
pre-commit installation:
```shell
pre-commit install
```
## Documentation
OpenAPI 3 documentation:
- `${PROJECT_BASE_URL}/api/v1/docs` - Swagger
- `${PROJECT_BASE_URL}/api/v1/docs/redoc` - ReDoc
- `${PROJECT_BASE_URL}/api/v1/docs/openapi.json` - OpenAPI json