Backend API for Slightly Techie CRM
See TODO
This project is a CRM API for Slightly Techie. It is built using these technologies.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Poetry: Dependency manager for Python.
- Postgres: A relational database.
- Python 3.10^: The Python programming language.
- AutoPEP8: An auto-formatter for Python code.
https://github.com/Slightly-Techie/crm-api.git
or with GithubCLI
gh repo clone Slightly-Techie/crm-api
# Linux, macOS, Windows (WSL)
curl -sSL https://install.python-poetry.org | python3 -
# Windows (PowerShell)
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Note: If you have installed Python through the Microsoft Store, replace py with python in the command above.
Reference: Poetry Installation
virtualenv crmenv
OR by using the virtualenvwrapper
mkvirtualenv crmenv
Activate the virtual environment with
source crmenv/bin/activate
pip install -r requirements.txt
Note to add a package to the project, run
pip install <package-name>
Step 5: Create a .env
file in the project's root directory and add the following environment variables, replacing the placeholders with your specific values:
POSTGRES_USER= #e.g postgres
POSTGRES_PASSWORD= #e.g password123
POSTGRES_SERVER= #e.g localhost
POSTGRES_PORT= #e.g 5432
POSTGRES_DB= #e.g st_crm_db
SECRET= #notasecretkey
BASE_URL= #http://127.0.0.1:8080/
[email protected]
EMAIL_PASSWORD=xxxxxxxxxxx
EMAIL_SERVER=smtp.gmail.com
EMAIL_PORT=587
AWS_ACCESS_KEY=xxxxxxxxxxxxx
AWS_SECRET_KEY=xxxxxxxxxxx
AWS_BUCKET_NAME=stncrmutilities
AWS_REGION=eu-west-1
URL_PATH=/users/reset-password/new-password
POSTGRES_USER= #e.g postgres
POSTGRES_PASSWORD= #e.g password123
POSTGRES_SERVER= #e.g localhost
POSTGRES_PORT= #e.g 5432
POSTGRES_DB= #e.g st_crm_db
uvicorn app:app --reload
To interact with the database, you can use tools like psql, pgAdmin or any database client that supports PostgreSQL. Here are some basic commands:
- Connect to the database:
psql -U postgres -d st_crm_db
- List all tables:
\d
- Execute SQL queries:
SELECT * FROM table_name;
To ensure the code is functioning correctly, you can run tests by executing the following command:
pytest
Make sure your
test.env
file is correctly configured with test-specific environment variables.
- Clone the project and from the main, create your feature branch if you are about to make changes. Else stay on the main branch
- From the
.env.sample
create a.env
file with the correct credentials - Ensure you have docker and docker compose installed on your local system
- To build the docker image use
docker-compose -f docker-compose.dev.yml build
- To start the services
doker-compose -f docker-compose.dev.yml up
- A combination of build and start command is
docker-compose -f docker-compose.dev.yml up --build
- To run tests
docker-compose -f docker-compose.dev.yml run --rm app sh -c "python -m pytest test"
β app.py
β Dockerfile
β fly.toml
β poetry.lock
β pyproject.toml
β README.md
β test_app.py
β __init__.py
β
ββββ.github
β ββββworkflows
β build.yml
β fly.yml
β
ββββAlembic
β β env.py
β β README
β β script.py.mako
β
ββββapi
β β __init__.py
β β
β ββββapi_models
β β β announcements.py
β β β skills.py
β β β stacks.py
β β β tags.py
β β β user.py
β β
β ββββroutes
β β β announcements.py
β β β auth.py
β β β feeds.py
β β β profile_page.py
β β β skills.py
β β β stacks.py
β β β tags.py
β β β techieotm.py
β β β __init__.py
β
ββββcore
β β config.py
β β exceptions.py
β
ββββdb
β β database.py
β β __init__.py
β ββββmodels
β β users.py
β ββββrepository
β users.py
ββββdocs
β TODO.md
β
ββββtest
β β conftest.py
β β test_announcements.py
β β test_auth.py
β β test_feeds.py
β β test_profile_page.py
β β test_skills.py
β β test_stacks.py
β β test_tags.py
β β test_techieotm.py
β β test_users.py
β β utils_test.py
β β __init__.py
β
ββββutils
β oauth2.py
β permissions.py
β utils.py
β __init__.py
We welcome contributions from the community. To contribute to the CRM API project, follow these guidelines:
- Follow the PEP 8 coding style for Python.
- Ensure your code is well-documented with clear comments and docstrings.
- Use meaningful variable and function names.
Create a new branch for your feature or bug fix using the format below.
git checkout -b <initials/issue_no/feature> eg. # RG/121/Fixed-login-page
- Commit your changes to your branch with a clear and descriptive commit message:
git add .
git commit -m "Made this in this file"
- Push your branch to the repository on GitHub:
git push -u origin <name-of-branch>
- Open a pull request in the original repository, providing a detailed description of your changes and any relevant information.
please try building the project on your local machine to confirm everything works before pushing...Thanks
visit the API Documentation at https://crm-api.fly.dev/docs