You should start with designing the API. Take this https://swagger.io/
sketch and everything you need.
Swagger allows you to combine the routing, documentation, and examples of the challenges into a unified whole.
In addition, it allows you to generate stubs
for different programming languages and frameworks.
In principle, you can find a significant number
of integrations for different frameworkof.
Generally API better to do with frameworks, because they have implemented the trivial moments for security, authentication and authorization. You can use microframework, such as the Slim
. You can even generate a routing to it using the generator
In REST there are 6 principles, are well summarized in Wiki
. In REST there is nothing complicated and special. It's just a superstructure over the standard HTTP Protocol. That is why there are no special lessons. The work will study the HTTP and you will understand how the web in General and REST in particular.
Regarding a separate server for the API. There are many different approaches. In recent time become more and more important Serverless application
. Serverless architecture fits in with the REST. But I think for you it is still too early and complicated. Too much for start.
It is more logical to keep the project in the mono repository if it is not large. If you are not sure how big it will be, it is possible to break the project into components and use Composer for dependency management
(recommend fully to read this page from cover to cover).
About best practices there is a very good resource https://12factor.net/ru/
It generally applies for all applications.
Remember: the first pancake is always lumpy. Read all of the resources that I brought for you. They have a lot of links to other, walk around it, look. Write the first version of the API so, as you think convenient. Try to apply the practice of the articles.
You need experience and you don't gain until you do something yourself. You can spend a year at reading, but will remain at the same place from which started. And another person will write on the knee of the API, and then rewrite it 20 times in a year and he will tell you 10 times more than what you have studied during the year.
Go for it!