Skip to content

fehomeh/feed-reader

Repository files navigation

Feed Reader demo

Requirements

To run the project, Docker (depends on your operating system) and Docker compose should be available on your computer.

Run the project

There are some helper scripts to deliver smoother experience, but they require sh-like environment (e.g. Bash, zsh).

The way to use scripts (this will take a while):

./start.sh

After all steps are finished, wait Docker containers to start and execute following:

./run_migrations.sh

To run tests launch the following command:

./run_tests.sh

If it does not work for you for some reason, do the following steps in your console manually:

  1. Build the project:
docker-compose build
docker-compose up
  1. Run migrations:
docker exec feed_php bin/console doctrine:migrations:migrate
  1. Run tests:
docker exec feed_php bin/phpunit
  1. Launch the project

Go to http://localhost:4210/

Technologies used

Infrastructure

  • DB: MySQL 8
  • PHP 7.4
  • Nginx

Languages and frameworks

  • Angular7 + TypeScript
  • PHP + Symfony5
  • PHPUnit

API

Register

URL: POST /api/v1.0/users/register Body:

{
    "email": "[email protected]",
    "password": "SecureP@ssw0rd",
    "repeat": "SecureP@ssw0rd"
}

Password must be at least 6 symbols containing both letters and numbers.

Response (Response code is 201):

{
    "success": true
}

Login

URL: POST /api/v1.0/users/login Body:

{
    "username": "[email protected]",
    "password": "SecureP@ssw0rd"
}

Response:

{
    "success": true,
    "username": "[email protected]"
}

Is email registered already

URL: GET /api/v1.0/users/email/[email protected]

Response:

{
    "is_free": true
}

Get feed

URL: GET /api/v1.0/feeds

Response:

{
    "mostPopularWords": {
        "word1": 33,
        "word2": 16,
        "word3": 10
    },
    "items": [
        {
            "title": "Title",
            "link": "https://link.go.com/test",
            "summary": "<h4>Some text</h4>",
            "lastModified": "2011-12-26T15:58:18+00:00",
            "authorName": "",
            "authorEmail": "",
            "authorUri": ""
        }
    ],
    "title": "The Register - Software",
    "logo": "https://www.theregister.co.uk/Design/graphics/Reg_default/The_Register_r.png",
    "url": ""
}

User should be authorized to use this endpoint.

Trade-offs, assumptions, simplifications

  • Sensitive data are stored in project (like DB password for Docker setup). In production, all this should be done through special utilities like helm for Docker or Chef for hardware setup.
  • Backend is not fully covered with all possible tests. Frontend is not covered with tests at all.
  • PHP session is used for authentication(Any token authentication system should be used instead).
  • No API docs generators (NelmioApiDocBundle can be used).
  • Not a real REST project (API Platform or FOSRestBundle can be used instead).
  • No pre-commit hooks with Code style validation and static analysis added (I would use GrumPHP) for that.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published