Light passes through a tiny hole and an image is formed in the camera. There are several formulae for the optimal diameter of the pinhole. The diameter depends on the distance from hole to film plane. Depth of field is almost infinite. For light sensitive material film or photographic paper is used.
Cameras vary in size, from miniature format to large rooms in a building.
My first camera was a Norwegian equivalent of a Quaker Oats Box. I prefer wide angles for the sense of space in the images. My next camera will be for paper negatives 40 x 50 cm. Making the cameras is often as much fun as making the images. Focal length 87 mm.