We study an inhomogeneous sparse random graph, $${\mathcal G }_N$$
G
N
, on $$[N]=\{1,\dots ,N\}$$
[
N
]
=
{
1
,
⋯
,
N
}
as introduced in a seminal paper by Bollobás et al. (Random Struct Algorithms 31(1):3–122, 2007): vertices have a type (here in a compact metric space $${\mathcal S }$$
S
), and edges between different vertices occur randomly and independently over all vertex pairs, with a probability depending on the two vertex types. In the limit $$N\rightarrow \infty $$
N
→
∞
, we consider the sparse regime, where the average degree is O(1). We prove a large-deviations principle with explicit rate function for the statistics of the collection of all the connected components, registered according to their vertex type sets, and distinguished according to being microscopic (of finite size) or macroscopic (of size $$\asymp N$$
≍
N
). In doing so, we derive explicit logarithmic asymptotics for the probability that $${\mathcal G }_N$$
G
N
is connected. We present a full analysis of the rate function including its minimizers. From this analysis we deduce a number of limit laws, conditional and unconditional, which provide comprehensive information about all the microscopic and macroscopic components of $${\mathcal G }_N$$
G
N
. In particular, we recover the criterion for the existence of the phase transition given in Bollobás et al. (2007).