Let $(X,d)$ be a second-countable, locally compact and locally path-connected metric space. Suppose that $(X,d)$ has enough rectifiable paths* (as explained at the end). $\forall p \in X$, let $\Gamma_pX$ denote the space of all rectifiable paths $\gamma$ starting at $p=\gamma(0)$ and parametrized with constant speed (the constant path is denoted as $c_p$). Define $T_pX$, the formal tangent space at $p$ , to be the space of equivalent classes in $\Gamma_pX$, where $$\gamma_1 \sim \gamma_2 \iff d(\gamma_1(t),\gamma_2(t)) \sim o(t) \text{ as } t \rightarrow 0^+$$ endowed with a metric $$\rho ([\gamma_1],[\gamma_2])=\overline{\lim}_{t \rightarrow 0^+} \dfrac{d(\gamma_1(t),\gamma_2(t))}{t}$$$$\rho ([\gamma_1],[\gamma_2])=\varlimsup_{t \rightarrow 0^+} \dfrac{d(\gamma_1(t),\gamma_2(t))}{t}$$ This metric is well-defined since $$d(\gamma_1(t),\gamma_2(t))\, \le\, d(\gamma_1(t),p)+d(\gamma_2(t),p)\, \le\, \mathrm{len}(\gamma_1)|^t_0+\mathrm{len}(\gamma_2)|^t_0\, \le\, Ct$$ for some non-negative constant $C$ by definition. It can be shown that $T_pX$ admits a non-negative homogeneous structure: For $s \ge 0$, let $s[\gamma(t)]:=[\gamma(s \cdot t)] \subseteq T_pX$, then we have equalities similar to the ones in normed vector spaces like $s[c_p]=[c_p]$ and $\rho(s[\gamma_1],s[\gamma_2])=s \rho ([\gamma_1],[\gamma_2])$.
We can also give a global topology $\tau$ on $\bigsqcup_{p \in X}T_pX$. For any open set $U \subseteq X$ and continuous function $f:U \rightarrow \Bbb{R}^+$, let $$V(U,f)=\{ (p,[\gamma]) \ :\ p \in U,\, [\gamma] \in T_pX,\, \rho([\gamma],[c_p])<f(p) \}$$ The topology $\tau$ is generated by such $V$. We call this space the formal tangent bundle of $(X,d)$ and denote it as $TX$. There is a canonical embedding from $X$ to $TX$ by mapping $p$ to $(p,[c_p])$, which is probablyactually a cofibration.
*:$(X,d)$ is said to have enough rectifiable paths if $\forall p,q \in X$$\forall p \ne q \in X$ and for every countable nowhere-dense set $S \subseteq X$ such that $p,q$ belong to the same path-connected component of $X \backslash S$, there exists a rectifiable path $\gamma \subseteq X \backslash S$ connecting $p,q$. In particular, this property is enough to ensure that given any point and direction at the point, there will be rectifiable paths from $p$ to $q$ avoiding that direction.
Post Scripts: We can modify the definition by changing "paths" to "arcs", which may make discussions simpler.