A proof of concept of a highly scalable Personal Server. The application was developed keeping a personal utility of a user domain in mind, but the principles used can easily be applied to design software solutions for any domain. One of the primary challenges for a user application domain is the ability to expand as per requirement, giving the ability to explore more on top of existing. To do so, we have to architect the application supporting the scale. After understanding several different system architectures, a Domain-Driven Design was considered to meet the requirement. This approach holds Framework-Agnositic Design, PostgreSQL, MongoDB and Test Driven Development.
At the bare minimum you'll need the following for your development environment:
It is strongly recommended also to install and use the following tools:
I have included the following for you to assume that you have all of the recommended tools listed above installed.
$ git clone https://github.com/gnknithin/Personify-Service.git
$ cd Personify-Service
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip3 install -r requirements.txt
If you have docker-compose installed and docker running; it is really simple to spin up the entire application stack or use docker-compose as shown below.
Make sure you are in the root directory of the repository where the docker-compose file is.
All the environment variables for the application need to be specified in the docker-compose file, this allows us to separate environment configuration concerns from our application code meaning it can easily spin up for local, development and production environments with different db credentials, ports etc.
POSTGRES_HOST=localhost
POSTGRES_USER=personifydev
POSTGRES_PASSWORD=testenv123
POSTGRES_DATABASE=personify
APPLY_MIGRATIONS=1
ALEMBIC_CONFIG=src/infra/data/migrations/alembic.ini
MONGODB_HOST=localhost
MONGODB_USERNAME=personifydev
MONGODB_PASSWORD=testenv123
MONGODB_DATABASE=personify
MINIO_HOST=localhost
MINIO_PORT=9000
MINIO_SECURE="False"
MINIO_ACCESS_KEY=personifydev
MINIO_SECRET_KEY=testenv123
MINIO_BUCKET_NAME=personify
MINIO_APP_USER_ACCESS_KEY=appuserdev
MINIO_APP_USER_SECRET_KEY=appuserdevenv123
docker-compose -f ./docker-compose.dev.yml up -d --force-recreate --renew-anon-volumes
URL=http://localhost:8080
SYSTEM=PostgreSQL
SERVER=personify-postgres-db
USERNAME=personifydev
PASSWORD=testenv123
DATABASE=personify
URL=http://localhost:8081
URL=http://localhost:9001
USERNAME=personifydev
PASSWORD=testenv123
python3 src/server.py -p 8888 -c ./configs/development.yaml -d
press Cntrl + c
docker-compose -f ./docker-compose.dev.yml down --remove-orphans
Installing Dependencies and checking
pip3 install pytest pytest-asyncio pytest-cov pytest-dotenv
pytest -vv --cov --cov-report=term-missing ./tests/unit
pytest -vv --cov --cov-report=term-missing ./tests/integration
pytest -vv --cov --cov-report=term-missing ./tests/e2e
pytest -vv --cov --cov-report=term-missing
Installing Dependencies and checking
pip3 install ruff
ruff check .
Installing Dependencies and checking
pip3 install mypy
mypy .
Once you run the entire application stack using docker-compose, you should be able to access the public routes below:
Feature | Type | Route | Access |
---|---|---|---|
Health Check | GET | http://localhost:8888/health | Public |
Add a new user | POST | http://localhost:8888/api/v1/signup | Public |
Authenticate a user | POST | http://localhost:8888/api/v1/signup | Public |
Get all contacts | GET | http://localhost:8888/api/v1/contact | Protected |
Add a new contact | POST | http://localhost:8888/api/v1/contact | Protected |
Get a specific contact | GET | http://localhost:8888/api/v1/contact/{contact_id} | Protected |
Update a specific contact | PUT | http://localhost:8888/api/v1/contact/{contact_id} | Protected |
Delete a specific contact | DELETE | http://localhost:8888/api/v1/contact/{contact_id} | Protected |
- Documentation - Swagger
- Code Coverage
- Markdown Diagrams
- Ruff Linting
- MyPy Typing
- Testing
- Unit Testing
- Integration Testing
- End2End Testing
- Postman
- Deployment Solution and Documentation
- Final: Production READY
GNU General Public License v3.0. See the bundled LICENSE file for more details.