Turbocommerce is a full fledged e-commerce solution written with latest cutting edge technology. It absolutely free to use. It's written in python3, django3 and React JS with react-bootstrap. It uses Docker as a container, poetry for managing pip dependencies and yarn for managing react project dependencies.
If you already setup backend, you can see all the API documentation under https://0.0.0.0:8000/swagger
.
You can try out APIs to experiment request/response.
-
Setup pre-commit
- Setup pre-commit to keep code well formatted, it's recommended but optional unless you are contributing to this project. To read more check out pre-commit docs.
brew install pre-commit pre-commit install
-
Setup .env files
- Create a
.env.local
file based on.env.example file
. This file includes environment variables that backend requires. You will need get your ownAWS_S3_REGION_NAME
,AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
. Here is how to create the.env.local
file.
cd backend cat .env.example | tee .env.local
- Similarly, You can create
.env.development
,.env.testing
,.env.staging
,.env.production
. - Remember to word the file names exactly as mentioned above for smooth docker build experience.
- Create a
-
Run backend api server and postgreql db
docker-compose build backend docker-compose up
-
Build backend docker image with target environment
# For local environment, using --build-arg is not required. docker-compose build backend OR docker-compose build --build-arg TARGET_ENV=local backend # For development environment docker-compose build --build-arg TARGET_ENV=development backend # For testing environment docker-compose build --build-arg TARGET_ENV=testing backend # For staging environment docker-compose build --build-arg TARGET_ENV=staging backend # For production environment docker-compose build --build-arg TARGET_ENV=production backend
-
Setup frontend
cd frontend cat .env.example | tee .env yarn install yarn start
-
Add turbocommerce as a host (optional)
- Open hosts file
sudo vi /etc/hosts/
- Press
i
when file opens - Add
0.0.0.0 turbocommerce
at the end of the file - Press Esc, type
:x
and hit Enter. - Open
https://turbocommerce:8000
-
Run pre-commit on whole project
pre-commit run --all-files
-
Run backend tests
docker run --rm -it turbocommerce_backend bash ./run_backend_tests.sh
-
create docker postgresql db user
docker ps # copy <container_id> docker exec -it <container_id> bash psql -U postgres -c "CREATE USER username WITH PASSWORD 'password';"
-
Delete all data from postgres for a fresh start
docker rm -f -v turbocommerce_db_1
-
Travis add secret environment variables
- make sure to install travis,
brew install travis
- To login,
travis login --pro --github-token <your_github_token
, generate the github_token from here - To add a new secret env,
travis encrypt --com SOMEVAR="secretvalue"
- make sure to install travis,
-
Copy file from local to AWS EC2
- Example:
scp -i <.pem file path> <path to turbocommerce/deploy/deploy_backend> [email protected]:/home/ubuntu/
- Example:
-
deploy deploy/deploy_backend
-
Login to ecr or docker hub
-
docker network create --driver bridge turbocommerce-network
-
docker run -dit --rm -p 80:8000 --network turbocommerce-network --name turbocommerce-container <ecr_repo_OR_dockerhub_repo_url>:<image_id> sh -c "chmod +x start_server.sh && ./start_server.sh"
-
Backend
-
Frontend
For contributing, please have a look at this doc.