The Open Terraria API, known as OTAPI, is a unique low-level API for Terraria that exposes events and provides performance optimisations while supporting both client and server executables on all official platforms.
You can use this modification as a NuGet package to power your own project with minimal update downtime*, or you can build plugins for Pryaxis's TShock which uses OTAPI under the hood.