The client owns the IP (intellectual property) and source code at the end of the project in most engagements, unless the contract says otherwise.
Ownership of the source code, documentation, design files, and other custom work usually transfers to you once you pay in full. Contracts make this official through a “work made for hire” clause or an IP assignment clause, both of which state that what the firm builds for you belongs to you.
Third-party and open-source components, meaning ready-made code that is freely available or licensed from other companies, stay under their own licenses.
Some firms also keep ownership of tools they built before your project and give you a license to use them. To avoid disputes, make sure your contract states that full IP and source code ownership transfers to you upon payment, with no usage limits.