This approach to the firm was developed in papers by Alchian and Demsetz (1972), Jensen and Meckling (1976), Barzel (1997), Fama (1980) and Cheung (1983). The important innovation here was the recognition that it is difficult to draw a line between firms and markets, firms are seen as a special type of market contracting. What distinguishes firms from other forms of market contract is the continuity of the relationship between input owners.
Most famously in the Alchian and Demsetz version of this approach, they argue that the authority relationship between the employer and employee is in no way the defining characteristic of a firm. The employer has no more authority over an employee than a customer has over his grocer. ‘Firing’, of either the employee or grocer, is the ultimate punishment that either the employer or customer can use in cases of ‘disobedience’. Alchian and Demsetz argue that, in economic terms, the customer ‘firing’ his grocer is no different from the employer firing his employee. In both cases one party stops dealing with the other, terminating the ‘contract’ between them. In this approach the firm is seen as little more than a nexus of contracts, special in its legal standing and characterised by long term nature of the relationship between the input owners. In this approach it is not generally useful to talk about firms as distinctive entities, a nexus of contracts could be called more firm-like if, for example, the residual claimants belong to a concentrated group but the term ‘firm’ has little meaning beyond this.
Roberts (2004: 104) responds to this line of argument:
“[w]hile there are several objections to this argument, we focus on one. It is that, when a customer “fires” a butcher, the butcher keeps the inventory, tools, shop, and other customers she had previously. When an employee leaves a firm, in contrast, she is typically denied access to the firm’s resources. The employee cannot conduct business using the firm’s name; she cannot use its machines or patents; and she probably has limited access to the people and networks in the firm, certainly for commercial purposes and perhaps even socially”.To be fair, in later work Alchian has stated that their assertion is incorrect (Alchian 1984: 38) while Demsetz (1995: 37) claims the idea “is a mere aside” in their paper.
Alchian and Demsetz (1972) extend their discussion by noting that the firm is more than just a special legal arrangement, it is also characterised by team production. The problem that arises here is that with team production, the marginal products of the individual members of the team are hard to measure. This means that free-rider behaviour is now possible since team production can act as a cover for shirking. The Alchian and Demsetz solution is to give the right to hire and fire the members of the team to a monitor who observes the employees and their marginal products. To ensure that the efficient amount of monitoring takes place, the monitor is given the rights to the residual income of the team. Here we see the start of the "firm as a solution to moral hazard in teams approach" to the firm.
You can find this work and a lot more worth reading in Alchian’s Collected Works.