We start projects with a 'Sprint 0'. We use this sprint to set up the project's code base and expand the 'surface area' of code. We do this so that when more developers are assigned to the project in Sprint 1, they can work on different features without treading on each other's toes.
Sprint 0 should not be included in the project velocity since setting up is a slow process. Including Sprint 0 makes the team feel as though they're always playing catch up.
We try to finish a project with a sprint long feature freeze, meaning we stop adding features. We use this time to fix any bugs, optimise inefficient code, tackle technical debt and ensure the project is ready for user testing.