Skip to content

hollyolive/aska-backend

Repository files navigation

aska-backend

python AWS lambda GitHub git github-actions postgresql terraform

環境構築

  • nodenv
  • pyenv
  • wsl2 Ubuntu
  • Docker

ここら辺参考になるかも

Versions

使用している言語やソフトウェアのバージョン情報

言語・フレームワーク バージョン
Python 3.11.6
volta 1.1.1
Node.js v18.12.1
npm 8.19.2
Docker ^4.20.0

Installation

pyenvを使ってPythonのバージョン合わせる場合はこちらの記事を参考にPython 3.11.6を使用してください。

# install poetry
pip install poetry
# Poetry to use project-specific virtual env
poetry config virtualenvs.in-project true
# install virtual env
poetry install
# install npm dependencies
npm install

Usage

Docker

# コンテナの立ち上げ (フォアグランド)
docker compose up
# コンテナの立ち上げ (バックグラウンド)
docker compose up -d

Task Runner

Python

# migration
poetry run task migrate
# format
poetry run task format
# lint
poetry run task lint
# pytest
poetry run task test

npm

# run local api server (use .vnev interpreter)
npm run dev
# clean up cache dirs
npm run clean

Run local server

health check 用エンドポイント: http://localhost:3333/local/api/v1/health

# activate python venv shell
poetry shell
# run local api server (serverless offline)
npm run dev

Migrations

参考:https://qiita.com/penpenta/items/c993243c4ceee3840f30

cd src/v1
# 新しくモデルを追加した場合
alembic revision --autogenerate -m "migration message"
# データベースに最新のマイグレーションを反映
alembic upgrade head

Terraform

cd terraform/environment/dev
terraform apply

Branch

基本的には Git-flow です

Branch naming rule

ブランチ名 説明 補足
main 最新リリース
dev/main 開発用最新
hotfix/{モジュール名}/{主題}
sandbox/{なんでも} テストコードなど

Branch rule

  • 作業は各最新ブランチから分岐させる
  • 作業ブランチはマージ後に削除
  • できるだけレビューする(誰かにしてもらう)
  • ビルドやデプロイなどは別途検討

Commit message

Please refer to the following template for the commit message.

🐞 バグとパフォーマンス
#🐛 :bug: バグ修正
#🚑 :ambulance: 重大なバグの修正
#🚀 :rocket: パフォーマンス改善
#💻 コードの品質とスタイル
#👍 :+1: 機能改善
#♻️ :recycle: リファクタリング
#👕 :shirt: Lintエラーの修正やコードスタイルの修正

🎨 UI/UXとデザイン
#✨ :sparkles: 新しい機能を追加
#🎨 :art: デザイン変更のみ

🛠️ 開発ツールと設定
#🚧 :construction: WIP (Work in Progress)
#⚙ :gear: config変更
#📦 :package: 新しい依存関係追加
#🆙 :up: 依存パッケージなどのアップデート

📝 ドキュメントとコメント
#📝 :memo: 文言修正
#📚 :books: ドキュメント
#💡 :bulb: 新しいアイデアやコメント追加

🛡️ セキュリティ
#👮 :op: セキュリティ関連の改善

🧪 テストとCI
#💚 :green_heart: テストやCIの修正・改善

🗂️ ファイルとフォルダ操作
#📂 :file_folder: フォルダの操作
#🚚 :truck: ファイル移動

📊 ログとトラッキング
#💢 :anger: コンフリクト
#🔊 :loud_sound: ログ追加
#🔇 :mute: ログ削除
#📈 :chart_with_upwards_trend: アナリティクスやトラッキングコード追加

💡 その他
#🧐 :monocle_face: コードのリーディングや疑問
#🍻 :beers: 書いているときに楽しかったコード
#🙈 :see_no_evil: .gitignore追加
#🛠️ :hammer_and_wrench: バグ修正や基本的な問題解決
erDiagram

users || --o{ posters: ""
users || --o{ favorites : ""
users || --o{ collaborators: ""
users || --o{ comments : ""
users || --o{ members : ""
organizations || --o{ members : ""
posters|| --o{ favorites : ""
posters|| --o{ collaborators : ""
posters|| --o{ assets : ""
posters|| --o{ comments : ""
posters|| --o{ histories : ""


users {
    string id PK
    string username
    string(256) email
    string first_name
    string last_name
    string(512) description
    string profile_picture
    timestamp created_at
    timestamp updated_at
}

favorites {
    string id PK
    string user_id FK
    string poster_id FK
    timestamp created_at
    timestamp updated_at
}

collaborators {
    string id PK
    string poster_id FK
    string user_id FK
    string role
    timestamp created_at
    timestamp updated_at
}

posters {
    string id PK
    string owner_id FK
    string(256) title
    string(512) description
    string body
    string thumbnail
    bool is_archive
    timestamp created_at
    timestamp updated_at
}

assets {
    string id PK
    string poster_id FK
    string object_key
    string src
    string(512) alt
    bool is_uploaded
    timestamp created_at
    timestamp updated_at
}

comments {
    string id PK
    string user_id FK
    string poster_id FK
    string parent_comment_id FK
    string body
    json position
    bool is_deleted
    bool resolved
    timestamp created_at
    timestamp updated_at
}

organizations {
    string id PK
    string name
    string description
    string logo
    timestamp created_at
    timestamp updated_at
}

members {
    string id PK
    string user_id FK
    string organization_id FK
    string role
    timestamp created_at
    timestamp updated_at
}

histories {
    string id PK
    string poster_id FK
    string object_key
    string comment
    string user_id FK
    string body
    timestamp created_at
    timestamp updated_at
}

Loading

aska-backend

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published