Skip to content

chore(documentation): Update-local-setup-guide-and-add-contribution-guide #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
66 changes: 66 additions & 0 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Contribution Guide

Thank you for your interest in contributing to JamAndFlow-API! Please follow these steps to ensure a smooth workflow and maintain code quality.

## 1. Fork & Clone
- Fork the repository on GitHub.
- Clone your fork locally:
```bash
git clone <your-fork-url>
cd JamAndFlow-API
```

## 2. Set Up Environment
- Follow the setup instructions in `local_setup.md` to create and activate a Python virtual environment.
- Install dependencies:
```bash
pip install -r requirements.txt
```

## 3. Pre-commit Hooks
- Install pre-commit:
```bash
pip install pre-commit
pre-commit install
```
- Run pre-commit checks before pushing:
```bash
pre-commit run --all-files
```

## 4. Linting
- Ensure code style with flake8 or black:
```bash
pip install flake8 black
flake8 .
black .
```

## 5. Testing
- Run tests (add your test commands here, e.g. pytest):
```bash
pip install pytest
pytest
```

## 6. Workflow
1. Create a new branch for your feature or fix:
```bash
git checkout -b feature/your-feature-name
```
2. Make your changes and commit with clear messages.
3. Ensure all tests pass and code is linted.
4. Push your branch and open a Pull Request.

## 7. Docker & Database
- Use Docker for local development as described in `local_setup.md`.
- For database migrations, see the migration section in `local_setup.md`.
- For inspecting tables, see the Postgres section in `local_setup.md`.

## 8. Code Review
- All contributions are reviewed before merging.
- Address any requested changes promptly.

---

For more details, refer to `local_setup.md`.
42 changes: 36 additions & 6 deletions local_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@
## Settings up environment variables
6. Create a `.env` file in the root directory of the project and add the following environment variables:
```env
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_USER=<POSTGRES_USER>
POSTGRES_PASSWORD=<POSTGRES_PASSWORD>
POSTGRES_DB=JamAndFlow
POSTGRES_HOST=db
POSTGRES_PORT=5432
FROM_EMAIL=<EMAIL_ID_TO_SEND_EMAILS_FROM>
SMTP_PASSWORD=<SMTP_PASSWORD>
SMTP_USERNAME=<EMAIL_ID_TO_SEND_EMAILS_FROM>
SECRET_KEY=<SECRET_KEY>
ALGORITHM=<ALGORITHM>
ACCESS_TOKEN_EXPIRE_MINUTES=<ACCESS_TOKEN_EXPIRE_MINUTES>
```

# TODO: Add docker setup instructions below
Expand All @@ -55,10 +61,34 @@
docker compose down
```

# How to crete a new migration
1. go to root directory
2. run the following command:
# How to create a new migration
1. Accessing the jam_and_flow_api Docker Container
```bash
alembic -c app/alembic.ini revision --autogenerate -m "testing"
docker exec -it jam_and_flow_api bash
```
2. Run command:
```bash
cd app
alembic revision --autogenerate -m "migration_name"
alembic upgrade head
```

# How to inspect postgres table
1. Accessing the postgres_db Docker Container
```bash
docker exec -it postgres_db bash
```
2. Run command:
```bash
psql -U postgres -d JamAndFlow
```
3. To list tables:
```sql
\dt
```
4. To view a specific table:
```sql
SELECT * FROM table_name;
```

# TODO: Add testing instructions below