Great question! End-to-end testing typically fits best after the build and unit tests, but before deploying to production, either in a later stage of your initial pipeline or in your release pipeline. Since your app depends on backend services and a database, it's common to spin up your Docker containers (backend, database, etc.) as part of the pipeline using a docker-compose file. This way, your E2E tests (e.g., via Puppeteer) can run against a real environment.
You’re not meant to mimic the database — instead, treat it like a test environment and seed it with test data if needed. If you're looking for structured help or best practices around this, DeviQA has some great cases into setting up robust end-to-end testing services that integrate smoothly with CI/CD pipelines.