An open API service indexing awesome lists of open source software.

https://github.com/tyronejosee/project_marketly

This repository implements a Django application following the principles of Clean Architecture and Domain-Driven Design (DDD). It serves as a practical example of how to structure a robust and maintainable application.
https://github.com/tyronejosee/project_marketly

api-rest django django-rest-framework docker docker-compose github-actions httpx pillow postgresql pre-commit-hooks python redis

Last synced: about 2 hours ago
JSON representation

This repository implements a Django application following the principles of Clean Architecture and Domain-Driven Design (DDD). It serves as a practical example of how to structure a robust and maintainable application.

Awesome Lists containing this project

README

          



logo



Marketly


Ecommerce API




This repository implements a Django application following the principles of Clean Architecture and Domain-Driven Design (DDD). It serves as a practical example of how to structure a robust and maintainable application.




python-version


django-version


django-rest-framework-version

## ๐Ÿ“š Documentation

- ๐Ÿงญ Product
- [Vision](./docs/product/vision.md)
- [Roadmap](./docs/product/roadmap.md)
- [Changelog](./docs/product/changelog.md)
- [Team](./docs/product/team.md)
- โš™๏ธ Functional
- [Functional Specifications](./docs/functional/functional-specs.md)
- [Use Cases](./docs/functional/use-cases.md)
- [Glossary](./docs/functional/glossary.md)
- ๐Ÿ—๏ธ Architecture/
- [System Overview](./docs/architecture/system-overview.md)
- [Components](./docs/architecture/components.md)
- [Database Schema](./docs/architecture/database-schema.md)
- [Security](./docs/architecture/security.md)
- ๐Ÿ“˜ Architecture Decision Records (ADR)
- [0001 - Clean Architecture & DDD](./docs/architecture/adr/0001-clean-architecture-ddd.md)
- [0002 - Framework](./docs/architecture/adr/0002-framework.md)
- [0003 - Testing & Coverage](./docs/architecture/adr/0003-testing-coverage.md)
- [0004 - Environment Configuration](./docs/architecture/adr/0004-enviroment-configuration.md)
- [0005 - Docker](./docs/architecture/adr/0005-docker.md)
- [0006 - Linting & Code Formatting](./docs/architecture/adr/0006-linting-code-formatting.md)
- [0007 - Continuous Integration](./docs/architecture/adr/0007-continuous-integration.md)
- [0008 - JWT-based Authentication](./docs/architecture/adr/0008-jwt-based-authentication.md)
- [0009 - API Documentation](./docs/architecture/adr/0009-api-documentation.md)
- [0010 - Branching Strategy](./docs/architecture/adr/0010-branching-strategy.md)
- ๐Ÿš€ Operations
- [Local Setup](./docs/operations/local-setup.md)
- [Deployment](./docs/operations/deployment.md)
- [DevOps Guide](./docs/operations/devops-guide.md)
- [Environment Variables](./docs/operations/environment-variables.md)
- [Monitoring](./docs/operations/monitoring.md)
- ๐Ÿงช Testing
- [Test Strategy](./docs/testing/test-strategy.md)
- [Coverage](./docs/testing/coverage.md)
- ๐Ÿค Contributing
- [Contributing Guide](./docs/contributing/contributing.md)
- [Commit Convention](./docs/contributing/commit-convention.md)
- [Code Style](./docs/contributing/code-style.md)

## โš™๏ธ Installation

Clone the repository.

```bash
git clone git@github.com:tyronejosee/project_marketly.git
cd project_marketly
```

>๐Ÿ’ก We recommend using [uv](https://docs.astral.sh/uv/getting-started/installation/) for this project. It is a fast, modern Python package manager that handles dependency resolution, virtual environments, and installs with superior performance and safety.

Install the project dependencies.

```bash
uv sync
```

Create a copy of the `.env.example` file and rename it to `.env`.

```bash
cp .env.example .env
```

**Update the values of the environment variables (Important).**

> ๐Ÿ’ก Make sure to correctly configure your variables before building the container.

## ๐Ÿณ Docker

Build your container; it will take time the first time, as Docker needs to download all dependencies and build the image.
Use the `-d` (detached mode) flag to start your containers in the background.
Use the `--build` flag if you have changes and need to rebuild.

```bash
docker compose up
docker compose up -d
docker compose up --build
```

Stop the running containers (does not remove them).

```bash
docker compose stop
```

Start previously created and stopped containers.

```bash
docker compose start
```

Show container logs in real-time.

```bash
docker compose logs -f
```

Restart a service with issues (Replace ``).

```bash
docker compose restart
```

Remove your container.

```bash
docker compose down
```

## ๐Ÿ Django

Access the `web` service console that runs Django.

```bash
docker compose exec web bash
```

Inside the Django console, create the migrations.

```bash
python manage.py makemigrations
```

Run the migrations.

```bash
python manage.py migrate
```

If you need to be more specific, use:

```bash
python manage.py migrate
```

List all available migrations and their status.

```bash
python manage.py showmigrations
```

> ๐Ÿ’ก Manually create the migration if Django skips an app; this happens because Django did not find the `/migrations` folder.

Create a superuser to access the entire site without restrictions.

```bash
python manage.py createsuperuser
```

Log in to `admin`:

```bash
http://127.0.0.1:8000/admin/
```

Access Swagger or Redoc.

```bash
http://127.0.0.1:8000/api/schema/swagger/
http://127.0.0.1:8000/api/schema/redoc/
```

## ๐Ÿšจ Important Notes

Check the creation of migrations before creating them.

```bash
docker compose exec web python manage.py makemigrations users
```

> ๐Ÿ’ก Checking migrations before their creation is necessary to avoid inconsistencies in user models.

## ๐Ÿ˜ PostgreSQL

Access the PostgreSQL console.

```bash
docker compose exec db psql -U postgres -d fandomhub_db
```

List all the tables in the database.

```bash
\dt
```

Show the detailed structure of a specific table.

```bash
\d
```

Create a backup of your database (Optional).

```bash
docker compose exec web python manage.py dumpdata > backup.json
```

Load the created backup if needed (Optional).

```bash
docker compose exec web python manage.py loaddata
```

## ๐Ÿงช Testing

Run all tests.

```bash
pytest
```

Run tests for a specific domain.

```bash
pytest tests/
```

Run unit tests for a specific domain (with coverage).

```bash
pytest tests/ -o addopts="--cov=src/modules/ --cov-report=term-missing"
```

## โš–๏ธ License

This project is under the [MIT License](https://github.com/tyronejosee/project_marketly/blob/main/LICENSE).

Enjoy! ๐ŸŽ‰