This repo is part of a client/server project. The client (front-end) is served using Nuxt v3 and the server (back-end) serves RESTful JSON API using Symfony 7.2 built on PHP 8.3
The intention is that the back-end server is deployed behind a firewall and is only accessible by the front-end (Nuxt) server. The BFF (back-end for front-end) pattern is used in the front-end.
Therefore, this Symfony codebase is not as secure as a typical Symfony web/API project (eg CORS is not enabled).
However, I have configured 2FA for the Users and have implemented multi-tenant
functionality - limiting users who are not in Client 1
to their own data.
This documentation applies to working on the project locally. It is not for deployment to a remote server (eg staging/production).
You will need a PostgreSQL (v16) server. This is provided for you in the docker compose configuration.
Edit the .env.local
with the correct connection string for your database.
This works best with the symfony cli.
- Ensure the
.env.local
reflects your local environment composer install
symfony serve -d
symfony console doctrine:migrations:migrate
symfony console doctrine:fixtures:load
You should be able to visit: https://127.0.0.1:8000/
and browse the API docs (which are in the project /docs
directory).
NB: The docs can only be browsed in a
dev
environment whereAPP_ENV = dev
PHPUnit is used for testing. You will need a test db and to load the fixtures.
Ensure you have a valid .env.test.local
file first.
symfony console doctrine:database:create --env=test
symfony console doctrine:migrations:migrate --env=test
symfony console doctrine:fixtures:load --env=test
Run the tests:
bin/phpunit